git clone https://github.com/shpran/docker-stack && cd docker-stack
app
directory:
mkdir app
Further you can store your symfony project inside this app
folder.
.env.example
file and name it .env
:
cp .env.example .env
.env
file./scripts/gencerts.sh
docker network create [PROJECT_NAME]
docker compose build && docker compose up -d
hosts
file and add new host 127.0.0.1 [PROJECT_NAME].docker.loc
. For example:
127.0.0.1 test.docker.loc
https://[PROJECT_NAME].docker.loc:[NGINX_SSL_PORT]
in your browser.Variable | Example | Default |
---|---|---|
CONTAINER_PREFIX | local | - |
PROJECT_NAME | test | - |
TIMEZONE | Europe/Minsk | - |
GITHUB_USER | user | - |
GITHUB_TOKEN | token | - |
GITHUB_EMAIL | test@test.com | - |
GITHUB_NAME | "Name Surname" | - |
XDEBUG_CLIENT_HOST | 192.168.100.1 | - |
NGINX_PORT | 10080 | 80 |
NGINX_SSL_PORT | 10443 | 443 |
MYSQL_ROOT_PASSWORD | root | root |
MYSQL_USER | dev | dev |
MYSQL_PASSWORD | dev | dev |
MYSQL_DATABASE | dev | dev |
MYSQL_PORT | 13306 | 3306 |
MAILHOG_PORT | 18025 | 8025 |
SMTP_PORT | 11025 | 1025 |
SMTP_HOSTNAME | mailhog.example | mailhog.example |
SWAGGER_API_URL | https://test.docker.loc:10443/api.yaml | - |
SWAGGER_PORT | 17000 | 7000 |
Use the following command to access your containers:
docker compose exec [container] [bash|sh]
or this command, if you are trying to access containers outside the docker-project directory:
docker exec -it [CONTATINER_PREFIX]_[container] [bash|sh]
The functionality only gets activated when a specific trigger is present when the request starts.
The name of the trigger is XDEBUG_TRIGGER
, and Xdebug checks for its presence in either $_ENV
(environment variable),
$_GET
or $_POST
variable, or $_COOKIE
(HTTP cookie name).
Also, you can set environment variable directly on the server:
export XDEBUG_TRIGGER=1
Or remove it:
unset XDEBUG_TRIGGER
The recommended way to initiate a debugging session is by configuring your IDE to accept incoming debugging
connections, and then use a browser extension which sets the right trigger cookie.
The extensions are:
Each extension adds an icon to your browser where you can select which functionality you want to trigger.
Xdebug will continue to start debugging for every request as long as the debug toggle has been enabled.
To access it go to http://localhost:[SWAGGER_PORT]
.