feat: Promote Compose v2

This commit is contained in:
Maxime Hélias 2022-07-28 19:01:17 +02:00 committed by Maxime Helias
parent daef1cb0d5
commit 6a941f244d
9 changed files with 24 additions and 24 deletions

View File

@ -12,12 +12,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Pull images
run: docker-compose pull
run: docker compose pull
- name: Start services
run: docker-compose up --build -d
run: docker compose up --build -d
- name: Wait for services
run: |
while status="$(docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" "$(docker-compose ps -q php)")"; do
while status="$(docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" "$(docker compose ps -q php)")"; do
case $status in
starting) sleep 1;;
healthy) exit 0;;

View File

@ -7,10 +7,10 @@ A [Docker](https://www.docker.com/)-based installer and runtime for the [Symfony
## Getting Started
1. If not already done, [install Docker Compose](https://docs.docker.com/compose/install/)
2. Run `docker-compose build --pull --no-cache` to build fresh images
3. Run `docker-compose up` (the logs will be displayed in the current shell)
2. Run `docker compose build --pull --no-cache` to build fresh images
3. Run `docker compose up` (the logs will be displayed in the current shell)
4. Open `https://localhost` in your favorite web browser and [accept the auto-generated TLS certificate](https://stackoverflow.com/a/15076602/1352334)
5. Run `docker-compose down --remove-orphans` to stop the Docker containers.
5. Run `docker compose down --remove-orphans` to stop the Docker containers.
## Features

View File

@ -34,7 +34,7 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
if grep -q ^DATABASE_URL= .env; then
if [ "$CREATION" = "1" ]; then
echo "To finish the installation please press Ctrl+C to stop Docker Compose and run: docker-compose up --build"
echo "To finish the installation please press Ctrl+C to stop Docker Compose and run: docker compose up --build"
sleep infinity
fi

View File

@ -5,7 +5,7 @@
By default, Symfony Docker will install the minimalist skeleton.
To install the ["website skeleton"](https://symfony.com/doc/current/setup.html#creating-symfony-applications), use the following command:
SKELETON=symfony/website-skeleton docker-compose up --build
SKELETON=symfony/website-skeleton docker compose up --build
## Selecting a Specific Symfony Version
@ -13,7 +13,7 @@ Use the `SYMFONY_VERSION` environment variable to select a specific Symfony vers
For instance, use the following command to install Symfony 4.4:
SYMFONY_VERSION=4.4.* docker-compose up --build
SYMFONY_VERSION=4.4.* docker compose up --build
## Installing Development Versions of Symfony
@ -22,13 +22,13 @@ The value must be [a valid Composer stability option](https://getcomposer.org/do
For instance, use the following command to use the `master` branch of Symfony:
STABILITY=dev docker-compose up --build
STABILITY=dev docker compose up --build
## Customizing the Server Name
Use the `SERVER_NAME` environment variable to define your custom server name(s).
SERVER_NAME="symfony.localhost, caddy:80" docker-compose up --build
SERVER_NAME="symfony.localhost, caddy:80" docker compose up --build
If you use Mercure, keep `caddy:80` in the list to allow the PHP container to request the caddy service.
@ -36,6 +36,6 @@ If you use Mercure, keep `caddy:80` in the list to allow the PHP container to re
Use the environment variables `HTTP_PORT`, `HTTPS_PORT` and/or `HTTP3_PORT` to adjust the ports to your needs, e.g.
HTTP_PORT=8000 HTTPS_PORT=4443 HTTP3_PORT=4443 docker-compose up --build
HTTP_PORT=8000 HTTPS_PORT=4443 HTTP3_PORT=4443 docker compose up --build
to access your appplication on [https://localhost:4443](https://localhost:4443).

View File

@ -24,10 +24,10 @@ Double-check the changes, revert the changes that you don't want to keep:
Build the Docker images:
docker-compose build --no-cache --pull
docker compose build --no-cache --pull
Start the project!
docker-compose up -d
docker compose up -d
Browse `https://localhost`, your Docker configuration is ready!

View File

@ -5,7 +5,7 @@ To use it, create a new `Makefile` file at the root of your project. Copy/paste
the content in the template section. To view all the available commands, run `make`.
For example, in the [getting started section](/README.md#getting-started), the
`docker-compose` commands could be replaced by:
`docker compose` commands could be replaced by:
1. Run `make build` to build fresh images
2. Run `make up` (detached mode without logs)
@ -34,7 +34,7 @@ or use [Cygwin](http://cygwin.com) to use the `make` command. Check out this
```Makefile
# Executables (local)
DOCKER_COMP = docker-compose
DOCKER_COMP = docker compose
# Docker containers
PHP_CONT = $(DOCKER_COMP) exec php

View File

@ -66,7 +66,7 @@ Go into the directory containing your project (`<project-name>`), and start the
SERVER_NAME=your-domain-name.example.com \
APP_SECRET=ChangeMe \
CADDY_MERCURE_JWT_SECRET=ChangeMe \
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
```
Be sure to replace `your-domain-name.example.com` by your actual domain name and to set the values of `APP_SECRET`, `CADDY_MERCURE_JWT_SECRET` to cryptographically secure random values.
@ -82,7 +82,7 @@ Alternatively, if you don't want to expose an HTTPS server but only an HTTP one,
SERVER_NAME=:80 \
APP_SECRET=ChangeMe \
CADDY_MERCURE_JWT_SECRET=ChangeMe \
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
```
## Deploying on Multiple Nodes

View File

@ -2,16 +2,16 @@
## Editing Permissions on Linux
If you work on linux and cannot edit some of the project files right after the first installation, you can run `docker-compose run --rm php chown -R $(id -u):$(id -g) .` to set yourself as owner of the project files that were created by the docker container.
If you work on linux and cannot edit some of the project files right after the first installation, you can run `docker compose run --rm php chown -R $(id -u):$(id -g) .` to set yourself as owner of the project files that were created by the docker container.
## Fix Chrome/Brave SSL
If you have a TLS trust issues, you can copy the self-signed certificate from Caddy and add it to the trusted certificates :
# Mac
$ docker cp $(docker-compose ps -q caddy):/data/caddy/pki/authorities/local/root.crt /tmp/root.crt && sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/root.crt
$ docker cp $(docker compose ps -q caddy):/data/caddy/pki/authorities/local/root.crt /tmp/root.crt && sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/root.crt
# Linux
$ docker cp $(docker-compose ps -q caddy):/data/caddy/pki/authorities/local/root.crt /usr/local/share/ca-certificates/root.crt && sudo update-ca-certificates
$ docker cp $(docker compose ps -q caddy):/data/caddy/pki/authorities/local/root.crt /usr/local/share/ca-certificates/root.crt && sudo update-ca-certificates
## HTTPs and Redirects

View File

@ -56,13 +56,13 @@ services:
Build your image with your fresh new XDebug configuration:
```console
docker-compose -f docker-compose.yml -f docker-compose.debug.yml build
docker compose -f docker-compose.yml -f docker-compose.debug.yml build
```
Then run:
```console
docker-compose -f docker-compose.yml -f docker-compose.debug.yml up -d
docker compose -f docker-compose.yml -f docker-compose.debug.yml up -d
```
## Debugging with Xdebug and PHPStorm
@ -90,7 +90,7 @@ You can now use the debugger.
Inspect the installation with the following command. The Xdebug version should be displayed.
```console
$ docker-compose exec php php --version
$ docker compose exec php php --version
PHP ...
with Xdebug v3.1.2 ...