More Infos :
-----------------------------------------------------
Install Docker on your system.
- Install instructions for Mac OS X
- Install instructions for Ubuntu
- Install instructions for Windows (prefer "Docker For Windows" than deprecated "Docker Toolbox")
Note that using "Docker Toolbox" on Windows OS can occur unexpected issues ...
Install Docker Compose on your system.
- Install instructions for all supported systems
Check that you can use docker commands without sudo ! [LINUX USER ONLY]
-
To run docker command without sudo, you need to add your user (who has root privileges) to docker group & restart your sessions.
$ sudo usermod -aG docker <user_name>
-----------------------------------------------------
A Makefile is used to provide some useful shortcuts for manipulating docker & docker-compose commands
-
1- Create .env file :
First, you need to create a copy of
.env.example
and call it.env
# Assume you are in project root, on Unix system $ cp .env.example .env
This files contains sensible data that not be committed on GIT, you can modify it to you own needs !
-
1- Set the .env file :
Update variables in
.env
file to fit your config# Assume you are in project root, on Unix system $ vi .env
Because we use grumphp, we need to configure git inside the container to be able to commit properly
-
2- Make the ☕ :
Run following command :
$ make init
This command will create & build Docker images, also start & configures required Containers, and run provisioning script. A lot of stuff is downloaded from Internet, so it can take a lot of time, depending on your Internet speed.
-
3- Your done !
You can now access to following services on your host machine:
- Symfony app http://localhost
- Mailhog http://localhost:1080
- PhpMyAdmin http://localhost:8080
When you reboot your computer :
-
Just simply run following command to start your Containers (docker Images already created):
$ make start
-----------------------------------------------------
You can read Makefile located at project root, it contain some comments on what "recipes" do. Feel free to add more extra recipes depending on your needs.
# List available make commands:
$ make help
Recipes | Utility |
---|---|
start | Start containers (Also builds & pull images, if there not exists) |
stop | Stop containers & remove docker networks |
list | List current running containers |
ssh | Start new bash terminal inside the Symfony Container |
init | Execute "start" tasks and run provisioning scripts |
tests | Execute the entire Unitary & Functional PhpUnit tests suit |
code-coverage | Run the entire tests with code coverage |
logs | Display current running containers logs (Press "Ctrl + c" to exit) |
clean-sf-cache | Clean symfony cache & logs files |
clean-container | Remove stopped useless containers |
help | Display available make commands |
-----------------------------------------------------
You can use make ssh
to connect inside the symfony container.
What is inside ?
- PHP 7.1-fpm with xdebug (dev) or OpCache & APCu (prod)
- Nodejs (6.x)
- Yarn
- Phpmetrics
- Php-cs-fixer
- Grumphp
- Git (with user config)
- Tig
Other service
- Mailhog for email testing during development
- PhpMyAdmin a simply mysql administrator
-----------------------------------------------------
If you want to use in production, you need to :
-
Get SSL certificates, Let's Encrypt provide them for free
-
You also need to generate a
dhparam.pem
keys to enforce SSL encryption# To generate your dhparam.pem file, run in the terminal openssl dhparam -out dhparam.pem 4096
-
Copy your
fullchain.pem
&privkey.pem
&dhparam.pem
to.data/web
directory -
Update
.env
file and setENV
to "prod" -
Update nginx prod conf and set
server_name
at line 4 & line 39 -
Run
make start
-
The first time, you need to build app yourself (like installing vendor & set parameter.yml ...)
Test your app, http redirect to https. ssl labs analysis give you a A+ baby !