From 5bde4790fbc7000f8cc225cc24a6737f55a06491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Tue, 26 Mar 2024 14:16:10 +0100 Subject: [PATCH] chore: switch to docker compose v2 (#1325) --- Makefile | 4 ++-- doc/how-to-guides/deployment/dev-install.md | 2 +- doc/how-to-guides/deployment/maintenance.md | 6 +++--- doc/how-to-guides/test-and-debug.md | 2 +- doc/introduction/contributing.md | 2 +- docker/docker-livecheck.sh | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 1f42f81742..35a8767eb9 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ NAME = "robotoff" ENV_FILE ?= .env MOUNT_POINT ?= /mnt HOSTS=127.0.0.1 robotoff.openfoodfacts.localhost -DOCKER_COMPOSE=docker-compose --env-file=${ENV_FILE} -DOCKER_COMPOSE_TEST=COMPOSE_PROJECT_NAME=robotoff_test PO_LOCAL_NET=po_test docker-compose --env-file=${ENV_FILE} +DOCKER_COMPOSE=docker compose --env-file=${ENV_FILE} +DOCKER_COMPOSE_TEST=COMPOSE_PROJECT_NAME=robotoff_test PO_LOCAL_NET=po_test docker compose --env-file=${ENV_FILE} ML_OBJECT_DETECTION_MODELS := tf-universal-logo-detector tf-nutrition-table tf-nutriscore # mount information for robotoff backup ZFS dataset diff --git a/doc/how-to-guides/deployment/dev-install.md b/doc/how-to-guides/deployment/dev-install.md index a7857f7bf1..d0c7de491c 100644 --- a/doc/how-to-guides/deployment/dev-install.md +++ b/doc/how-to-guides/deployment/dev-install.md @@ -68,7 +68,7 @@ After cloning the repository: 5. To debug in a running container, you need to run poetry in the container. For example: ``` - docker-compose run --rm api poetry run python + docker compose run --rm api poetry run python ``` Here we run the `api` service. This opens a Python command prompt, you may debug with [pdb](https://docs.python.org/3/library/pdb.html) or play with the code. diff --git a/doc/how-to-guides/deployment/maintenance.md b/doc/how-to-guides/deployment/maintenance.md index 3a040072be..52456ab874 100644 --- a/doc/how-to-guides/deployment/maintenance.md +++ b/doc/how-to-guides/deployment/maintenance.md @@ -26,15 +26,15 @@ All Robotoff services are running on one of the two Docker instances (OVH 200 VM see [dev-install](./dev-install.md) You can then use: -`docker-compose start [service-name]` or `docker-compose stop [service-name]` +`docker compose start [service-name]` or `docker compose stop [service-name]` -Or `make up` when you refresh the product (it will re-build and run `docker-compose up -d`). +Or `make up` when you refresh the product (it will re-build and run `docker compose up -d`). Take the time to become a bit familiar with docker-compose if it's your first use. ## Monitor -To display the logs of the container, `docker-compose logs [service-name]`. +To display the logs of the container, `docker compose logs [service-name]`. (without service-name, you got all logs). Two options are often used: `-f` to follow output and `--tail n` to only display last n lines. diff --git a/doc/how-to-guides/test-and-debug.md b/doc/how-to-guides/test-and-debug.md index 199ab0b0b4..e37e18c125 100644 --- a/doc/how-to-guides/test-and-debug.md +++ b/doc/how-to-guides/test-and-debug.md @@ -19,7 +19,7 @@ We recommend [Factory](https://factoryboy.readthedocs.io/en/stable/) to create If you have installed Robotoff via Docker, you can run Python using Poetry and execute Factory like so: ``` -$ docker-compose run --rm api poetry run python +$ docker compose run --rm api poetry run python ... > from tests.integration.models_utils import * > PredictionFactory() diff --git a/doc/introduction/contributing.md b/doc/introduction/contributing.md index 301c09a731..898da2815c 100644 --- a/doc/introduction/contributing.md +++ b/doc/introduction/contributing.md @@ -79,7 +79,7 @@ Ready to contribute code? Here's how to set up Robotoff for local development. To test the APIs on your localhost run ``` - docker-compose up + docker compose up ``` You can make a post request through [Postman](https://www.postman.com/) or simply paste the url in a web browser to make a get request like this one http://localhost:5500/api/v1/insights/ diff --git a/docker/docker-livecheck.sh b/docker/docker-livecheck.sh index fd7444e669..0009ae792f 100755 --- a/docker/docker-livecheck.sh +++ b/docker/docker-livecheck.sh @@ -2,8 +2,8 @@ ENV_FILE="${ENV_FILE:-.env}" RET_CODE=0 -for service in `docker-compose --env-file=${ENV_FILE} config --service | tr '\n' ' '`; do - found=$(docker-compose --env-file=${ENV_FILE} ps -- ${service}|grep ${service}|grep '\bUp\b') +for service in `docker compose --env-file=${ENV_FILE} config --service | tr '\n' ' '`; do + found=$(docker compose --env-file=${ENV_FILE} ps -- ${service}|grep ${service}|grep '\bUp\b') if [ -z "$found" ] then echo "$service: DOWN"