diff --git a/Makefile b/Makefile index 07e838c5801fe..0264453b9067a 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ SHELL := $(shell which bash) # some vars ENV_FILE ?= .env NAME = "ProductOpener" +VERSION = $(shell cat version.txt) MOUNT_POINT ?= /mnt DOCKER_LOCAL_DATA_DEFAULT = /srv/off/docker_data DOCKER_LOCAL_DATA ?= $(DOCKER_LOCAL_DATA_DEFAULT) @@ -85,7 +86,7 @@ _FORCE: # Info # #------# info: - @echo "${NAME} version: ${VERSION}" + @echo "${NAME} version: v${VERSION}" usage: @echo "🥫 Welcome to the Open Food Facts project" diff --git a/docker-compose.yml b/docker-compose.yml index 448f41eb8de8e..f6cc33e5febe0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,4 @@ -version: "3.7" - -x-backend-conf: &backend-conf +x-backend-conf: &backend-conf image: ghcr.io/openfoodfacts/openfoodfacts-server/backend:${TAG} environment: - PRODUCERS_PLATFORM diff --git a/docker/admin-uis.yml b/docker/admin-uis.yml index e2e630442bdf6..2bd552aaefe45 100644 --- a/docker/admin-uis.yml +++ b/docker/admin-uis.yml @@ -1,5 +1,4 @@ -version: "3.7" -services: +services: mongoku: image: huggingface/mongoku:1.3.0 depends_on: diff --git a/docker/dev.yml b/docker/dev.yml index 4a2999d6c238d..13e095bc659f1 100644 --- a/docker/dev.yml +++ b/docker/dev.yml @@ -1,6 +1,4 @@ -version: "3.7" - -x-backend-conf: &backend-conf +x-backend-conf: &backend-conf image: openfoodfacts-server/backend:dev build: context: . diff --git a/docker/devcontainer.yml b/docker/devcontainer.yml index a7854c4d577d6..7566344e0d1d0 100644 --- a/docker/devcontainer.yml +++ b/docker/devcontainer.yml @@ -1,4 +1,3 @@ -version: "3.7" services: backend: build: diff --git a/docker/geolite2.yml b/docker/geolite2.yml index 5b138eb076bd2..fa9110a545d09 100644 --- a/docker/geolite2.yml +++ b/docker/geolite2.yml @@ -1,5 +1,4 @@ -version: "3.7" -services: +services: backend: volumes: - geolite2:/usr/local/share/GeoLite2-Country diff --git a/docker/jslint.yml b/docker/jslint.yml index 6e2fa8d1beff8..2e9e55251c570 100644 --- a/docker/jslint.yml +++ b/docker/jslint.yml @@ -1,6 +1,4 @@ -version: "3.7" - -# Some tweaks to be able to run npm run lint +# Some tweaks to be able to run npm run lint services: dynamicfront: command: ["npm", "run", "lint"] diff --git a/docker/monitor.yml b/docker/monitor.yml index 2ecefe15c45fd..1fa75e0b2c40d 100644 --- a/docker/monitor.yml +++ b/docker/monitor.yml @@ -1,4 +1,3 @@ -version: "3.7" services: apache_exporter: image: solsson/prometheus-exporter-apache:latest diff --git a/docker/perldb.yml b/docker/perldb.yml index c382401efbdba..53dcabaa16da4 100644 --- a/docker/perldb.yml +++ b/docker/perldb.yml @@ -1,4 +1,3 @@ -version: "3.7" services: backend: image: productopener-backend-perldb diff --git a/docker/prod.yml b/docker/prod.yml index 77b854d7a9914..33270e7d1f2fc 100644 --- a/docker/prod.yml +++ b/docker/prod.yml @@ -1,4 +1,3 @@ -version: "3.7" services: memcached: restart: always diff --git a/docs/dev/how-to-develop-using-docker.md b/docs/dev/how-to-develop-using-docker.md index 26cd3b5ed9993..95949e6c5d0c8 100644 --- a/docs/dev/how-to-develop-using-docker.md +++ b/docs/dev/how-to-develop-using-docker.md @@ -229,11 +229,7 @@ You will need: * `.env.opff`: configuration for Open Ped Food Facts dev env. -* `COMPOSE_PROJECT_NAME` set to different values in each `.env` file, so that container names across deployments are unique. - -* `FRONTEND_PORT` and `MONGODB_PORT` - set to different values in each `.env` file, - so that frontend containers don't port-conflict with each other. +* `COMPOSE_PROJECT_NAME`, `COMPOSE_PROFILES`, `PRODUCT_OPENER_DOMAIN`, `PRODUCT_OPENER_PORT`, `PRODUCT_OPENER_FLAVOR` and `PRODUCT_OPENER_FLAVOR_SHORT` set to different values in each `.env` file, so that container names across deployments are unique and frontend containers don't port-conflict with each other. See example below. To switch between configurations, set `ENV_FILE` before running `make` commands, (or `docker compose` command): @@ -281,3 +277,28 @@ A good strategy is to have multiple terminals open, one for each deployment: ``` **Note:** the above case of 4 deployments is ***a bit ambitious***, since ProductOpener's `backend` container takes about ~6GB of RAM to run, meaning that the above 4 deployments would require a total of 24GB of RAM available. + +**Example:** if you already have Open Food Facts up and running and you would like to have Open Beauty Facts as well. Then, copy `.env` to `.env.obf` and modify the following variables: +``` +COMPOSE_PROJECT_NAME=po_off +COMPOSE_PROFILES=off +PRODUCT_OPENER_DOMAIN=openfoodfacts.localhost +PRODUCT_OPENER_PORT=80 +PRODUCT_OPENER_FLAVOR=openfoodfacts +PRODUCT_OPENER_FLAVOR_SHORT=off +``` +to +``` +COMPOSE_PROJECT_NAME=po_obf +COMPOSE_PROFILES=obf +PRODUCT_OPENER_DOMAIN=openbeautyfacts.localhost +PRODUCT_OPENER_PORT=81 +PRODUCT_OPENER_FLAVOR=openbeautyfacts +PRODUCT_OPENER_FLAVOR_SHORT=obf +``` +Run: +``` +export ENV_FILE=.env.obf +make dev +``` +If you have error like `Errors in the labels taxonomy definition at /opt/product-opener/lib/ProductOpener/Tags.pm line 1622.`, due to conflict between taxonomies, a small hack is to comment the lines (it appears 2 times in the file) raising error in the **Tags.pm** file.