rdmorganiser / rdmo-docker-compose

RDMO running in different docker images held together by docker compose
Apache License 2.0
3 stars 13 forks source link

make does not succeed #29

Open martinkoehler opened 10 months ago

martinkoehler commented 10 months ago

Hi, after cloning git clone https://github.com/rdmorganiser/rdmo-docker-compose.git test into test and issuing make in this dir I encountered the following error:

 => ERROR [rdmo  3/17] RUN rm "$(find /usr/lib/python?.??/ -regex ".*EXTERNALLY-MANAGED.*")"                   0.5s
------
 > [rdmo  3/17] RUN rm "$(find /usr/lib/python?.??/ -regex ".*EXTERNALLY-MANAGED.*")":
0.398 find: ‘/usr/lib/python?.??/’: No such file or directory
0.399 rm: cannot remove '': No such file or directory
------
failed to solve: process "/bin/sh -c rm \"$(find /usr/lib/python?.??/ -regex \".*EXTERNALLY-MANAGED.*\")\"" did not complete successfully: exit code: 1
make: *** [makefile:24: run_build] Error 17

It seems the current base image does not cotain Externally managed python libs?! Commenting the offending RUN in the dockerfile

diff --git a/docker/rdmo/Dockerfile b/docker/rdmo/Dockerfile
index 3885915..ff67656 100644
--- a/docker/rdmo/Dockerfile
+++ b/docker/rdmo/Dockerfile
@@ -9,7 +9,7 @@ ENV LC_ALL C.UTF-8

 RUN apt update -y && apt upgrade -y && apt install -y \
   python3 python3-dev python3-pip locales
-RUN rm "$(find /usr/lib/python?.??/ -regex ".*EXTERNALLY-MANAGED.*")"
+#RUN rm "$(find /usr/lib/python?.??/ -regex ".*EXTERNALLY-MANAGED.*")"
 RUN ln -s /usr/bin/python3 /usr/bin/python
 RUN python3 -m pip install --upgrade pip

successfully builds the containers, but the won't start: The postgres container shows:

rdc-postgres exited with code 1
rdc-postgres  | The files belonging to this database system will be owned by user "postgres".
rdc-postgres  | This user must also own the server process.
rdc-postgres  |
rdc-postgres  | initdb: error: invalid locale settings; check LANG and LC_* environment variables
rdc-postgres  | The files belonging to this database system will be owned by user "postgres".
rdc-postgres  | This user must also own the server process.

It seems that the en_US.utf locale is not installed in the container. This can be fixed by adding RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen in the Dockerfile of the postgres container:

diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile
index c5f6726..fa7e3b2 100644
--- a/docker/postgres/Dockerfile
+++ b/docker/postgres/Dockerfile
@@ -6,6 +6,10 @@ ENV PATH="${PATH}:/opt:${HOME}/sh"
 RUN apt update && apt upgrade -y && apt install -y postgresql-client vim
 RUN rm -rf /var/lib/apt/lists/*

+# Set the locale
+RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
+    locale-gen

After cleaning up, e.g. make run_remove && rm -fr vol && docker volume rm rdcpostgres rdcvol the rdc-caddy and rdc-postgres container start. However the rdc-rdmo container complains:

rdc-rdmo      | python: can't open file '/vol/rdmo-app/manage.py': [Errno 2] No such file or directory
rdc-rdmo      | python: can't open file '/vol/rdmo-app/manage.py': [Errno 2] No such file or directory
rdc-rdmo      | python: can't open file '/vol/rdmo-app/manage.py': [Errno 2] No such file or directory
rdc-rdmo      | python: can't open file '/vol/rdmo-app/manage.py': [Errno 2] No such file or directory
rdc-rdmo      | Run gunicorn
rdc-rdmo      | gunicorn failed to start, retry in 60s

This is due to the fact, that sh/prepare.sh creates vol/rdmo-app. If this exists, the rdmo initialisation is skipped. A fix is:

diff --git a/sh/prepare.sh b/sh/prepare.sh
index 6edbf5b..9ca0db4 100755
--- a/sh/prepare.sh
+++ b/sh/prepare.sh
@@ -61,7 +61,8 @@ cat ${dc_master} | envsubst >${dc_temp}

 mkdir -p ${VOLDIR}/log
 mkdir -p ${VOLDIR}/postgres
-mkdir -p ${VOLDIR}/rdmo-app
+# rdmo-app will be created by the rdc-rdmo container
+#mkdir -p ${VOLDIR}/rdmo-app

 docker_compose_command="docker compose -p ${GLOBAL_PREFIX}"
 if ! groups | grep docker >/dev/null 2>&1; then

With these fixes a fresh installation can be done.