Skip to content

Commit

Permalink
docs: upd docs, fix version, rm docker composer version (#11175)
Browse files Browse the repository at this point in the history
### What
- Update docs for how-to-develop-using-docker
- Remove version in docker files, this is obsolete now, and print a
warning
- Fix "make info"

### Related issue(s) and discussion
- Fixes #-none-
  • Loading branch information
benbenben2 authored Dec 30, 2024
1 parent fc76285 commit 27cdb39
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 23 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions docker/admin-uis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version: "3.7"
services:
services:
mongoku:
image: huggingface/mongoku:1.3.0
depends_on:
Expand Down
4 changes: 1 addition & 3 deletions docker/dev.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
version: "3.7"

x-backend-conf: &backend-conf
x-backend-conf: &backend-conf
image: openfoodfacts-server/backend:dev
build:
context: .
Expand Down
1 change: 0 additions & 1 deletion docker/devcontainer.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.7"
services:
backend:
build:
Expand Down
3 changes: 1 addition & 2 deletions docker/geolite2.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version: "3.7"
services:
services:
backend:
volumes:
- geolite2:/usr/local/share/GeoLite2-Country
Expand Down
4 changes: 1 addition & 3 deletions docker/jslint.yml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
1 change: 0 additions & 1 deletion docker/monitor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.7"
services:
apache_exporter:
image: solsson/prometheus-exporter-apache:latest
Expand Down
1 change: 0 additions & 1 deletion docker/perldb.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.7"
services:
backend:
image: productopener-backend-perldb
Expand Down
1 change: 0 additions & 1 deletion docker/prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.7"
services:
memcached:
restart: always
Expand Down
31 changes: 26 additions & 5 deletions docs/dev/how-to-develop-using-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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.

0 comments on commit 27cdb39

Please sign in to comment.