rdmorganiser / rdmorganiser/rdmo-docker-compose

make does not succeed

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3
Forks
13
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docker/rdmo/Dockerfile, docker/postgres/Dockerfile, sh/prepare.sh, and the Makefile target that runs the build. Reproduce the reported errors with a fresh checkout and clean volumes, then verify that a fresh make builds and starts all containers without the locale, missing manage.py, or initialization failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, postgresql, python
Domain
databases, devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.