From 6a941f244df604e1412297dcf26c76adb11ad14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20H=C3=A9lias?= Date: Thu, 28 Jul 2022 19:01:17 +0200 Subject: [PATCH] feat: Promote Compose v2 --- .github/workflows/ci.yml | 6 +++--- README.md | 6 +++--- docker/php/docker-entrypoint.sh | 2 +- docs/build.md | 10 +++++----- docs/existing-project.md | 4 ++-- docs/makefile.md | 4 ++-- docs/production.md | 4 ++-- docs/troubleshooting.md | 6 +++--- docs/xdebug.md | 6 +++--- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1daa3af..484ad88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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;; diff --git a/README.md b/README.md index 1e652da..9395616 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker/php/docker-entrypoint.sh b/docker/php/docker-entrypoint.sh index 3cea9b5..fb032cf 100755 --- a/docker/php/docker-entrypoint.sh +++ b/docker/php/docker-entrypoint.sh @@ -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 diff --git a/docs/build.md b/docs/build.md index aeeb355..1b1fbf6 100644 --- a/docs/build.md +++ b/docs/build.md @@ -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). diff --git a/docs/existing-project.md b/docs/existing-project.md index eae231f..4fa5d3b 100644 --- a/docs/existing-project.md +++ b/docs/existing-project.md @@ -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! diff --git a/docs/makefile.md b/docs/makefile.md index 3283973..f456d44 100644 --- a/docs/makefile.md +++ b/docs/makefile.md @@ -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 diff --git a/docs/production.md b/docs/production.md index 3858be0..58b5448 100644 --- a/docs/production.md +++ b/docs/production.md @@ -66,7 +66,7 @@ Go into the directory containing your project (``), 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 diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index dd98bc1..d9b32b6 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -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 diff --git a/docs/xdebug.md b/docs/xdebug.md index 1a6ea89..08396dc 100644 --- a/docs/xdebug.md +++ b/docs/xdebug.md @@ -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 ...