/symfony-4-skeleton-docker

Symfony 4 skeleton docker

Primary LanguagePHPMIT LicenseMIT

Symfony 4 skeleton docker

Symfony 4 starter-kit for multi container stack.

Overview

  1. Install prerequisites

    Before installing project make sure the following prerequisites have been met.

  2. Clone the project

    We’ll download the code from its repository on GitHub.

  3. Configure Xdebug [Optional]

    We'll configure Xdebug for IDE PHPStorm.

  4. Run the application

    All will works well now.


Install prerequisites

For now, this project has been mainly created for Unix (Linux/MacOS). Perhaps it could work on Windows.

All requisites should be available for your distribution. The most important are :

Check if docker-compose is already installed by entering the following command :

which docker-compose

Check Docker Compose compatibility :

The following is optional but makes life better :

which make

Images to use

  • Nginx
  • Varnish
  • Postgres
  • Adminer

You should be careful when installing third party web servers such as MySQL or Nginx.

This project use the following ports :

Server Port
Postgres 5432
Adminer 2000
Nginx 8080
Varnish 8081
H2-Proxy (SSL) 80

Clone the project

To install Git, download it and install following the instructions :

git clone -b symfony-4-skeleton-docker git@github.com:woprrr/symfony-4-skeleton-docker.git

Go to the project directory :

cd symfony-4-skeleton-docker

Project tree

.
├── LICENSE
├── Makefile
├── README.md
├── client_secrets.json.enc
├── docker-compose.yml.dist
├── h2-proxy
│   ├── Dockerfile
│   └── conf.d
├── helm
│   └── symfony
└── symfony
    ├── Dockerfile
    ├── Dockerfile.nginx
    ├── Dockerfile.varnish
    ├── bin
    ├── composer.json.dist
    ├── config
    ├── docker
    ├── public
    └── src

Configure Xdebug

If you use another IDE than PHPStorm, go to the remote debugging section of Xdebug documentation.

For a better integration of Docker to PHPStorm, use the documentation.

  1. Edit docker-compose file docker-compose.yml edit/adjust the configuration as needed for XDEBUG_CONFIG AND PHP_IDE_CONFIG environment variables.

  2. If needed add a server for PHP as explained @see Add a debug server section.


Run the application

  1. Setup project environment variables :

    Setup your project by editing the .env file and customize all environement variables. By default the ENV file are in symfony folder ./symfony/.env

  2. Initialize/Install project dependencies :

    make docker-start
  3. Open your favorite browser :

  4. Stop and clear services :

    sudo docker-compose down -v
  5. Stop and delete all traces of changes from skeleton :

    sudo make clean

    That delete all files to reset skeleton at his initial state.

Help us

Any thought, feedback or (hopefully not!)