I created another project with all knowledge I learned on working on this project. I will focus on this one so I set this repository read-only.
I learned Docker with this project, and I try to implement my own logic into this one.
All your Symfony development environment in HTTPS with only 1 command ! 😎 🤯
- If not already done, install Docker Compose
- Copy
.env.sample
to.env
and complete the information - Run
./run.sh -d
(or./run.sh
to see all logs), it will create the Symfony website skeleton automatically for you (it can take 1 or 2 minutes) - Open https://localhost in your favorite web browser and accept the auto-generated TLS certificate
- Let's code your Symfony website ! 🎉 👨💻 👩💻
- Open https://localhost:8888 to access to your phpMyAdmin
(All those localhost links are valid if you let the .env by default.)
- Caddy
- PHP-FPM
- MariaDB
- phpMyAdmin
MARIADB_VERSION
: Version of MariaDB. (Default: 10)MYSQL_DATABASE
: Name of the database. (Default:symfony
)MYSQL_ROOT_PASSWORD
: Root's password. Please use a strong password. (Default:symfony
)MYSQL_USER
: Name of the user. (Default:symfony
)MYSQL_PASSWORD
: User's password. Please use a strong password. (Default:symfony
)PORT_PHPMYADMIN
: Port used for browser (https://localhost:8888 for example). (Default: 8888)
PHP_VERSION
: PHP version. (Default: 8)SYMFONY_VERSION
: Version of Symfony.PORT_SYMFONY
: Port used for browser (https://localhost:443 for example). (Default: 443)
CUSTOM_REPOSITORY
: Link of your git repository (git@github.com:Arkanii/symfony-website-docker.git or https://github.com/Arkanii/symfony-website-docker.git for example).CUSTOM_REPOSITORY_WITH_GIT_DIR
: If set to 1, this will replace the .git directory of the template by the .git directory located into the project located in theCUSTOM_REPOSITORY
variable. (Default: 0)SSH_KEY_PATH
: Path of your SSH key.
TIMEZONE
: Timezone to set the correct time on the containers.
Symfony uses the .env file. Into their best practices, Symfony asks to use environment variables for obvious security reasons so as not to commit environment variables or passwords.
However, Docker uses the .env file too, witch needs this file to get these secrets variables which are stored in .env.local file.
That's why I created a run.sh
in order to grab this information and run them into Symfony and Docker at the same time.
This script is also used to avoid permissions issues between files that are on your computer, and those that are in the Docker service.
If anyone has a better idea to avoid this file, don't hesitate to open a ticket !
Can I use Symfony CLI into my project when docker-compose is lunched ?
Of course, you can !
Just lunch symfony serve
after ./run.sh -d
and open https://127.0.0.1:8000. (by default)
If you decide to not use Symfony CLI, you need to explain the exact version of MariaDB you used in the MARIADB_VERSION
variable.
Check these links and look if your custom port is not reserved by your web browser.
Created by Théo Frison, inspired and taken for some parts from this project.