Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] The .env.template as is is not enough to get the repo going locally via Docker #200

Open
1 task done
FatumaA opened this issue Oct 7, 2024 · 2 comments · May be fixed by #249
Open
1 task done

[Bug] The .env.template as is is not enough to get the repo going locally via Docker #200

FatumaA opened this issue Oct 7, 2024 · 2 comments · May be fixed by #249
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix help wanted Open to participation from the community 🟨 priority: medium Not blocking but should be fixed soon 🏁 status: ready for work Ready for work

Comments

@FatumaA
Copy link

FatumaA commented Oct 7, 2024

Description

There were many issues getting legalDB running, all related to environmental variables.

Reproduction

Clone the repo and follow the instructions in the README to run via docker. Notice the errors that show up.

First error:

/CreativeCommons/legaldb/docker-compose.yml: error while interpolating services.app.environment.[]: required variable DJANGO_SECRET_KEY is missing a value

Then:

/CreativeCommons/legaldb/docker-compose.yml: error while interpolating services.app.environment.[]: required variable DJANGO_SUPERUSER_PASSWORD is missing a value

Then: (I've shortened this, but at this point it gets stuck in a loop where it starts and restarts)

docker compose up --build
[+] Building 3.7s (14/14) FINISHED                  docker:desktop-linux
 => [app internal] load build definition from Dockerfile            0.0s
 => => transferring dockerfile: 1.66kB                              0.0s
 => [app internal] load .dockerignore                               0.0s
 => => transferring context: 95B                                    0.0s
 => [app internal] load metadata for docker.io/library/python:3.12  3.6s
 => [app 1/9] FROM docker.io/library/python:3.12@sha256:785fef11f4  0.0s
 => [app internal] load build context                               0.0s
 => => transferring context: 62B                                    0.0s
 => CACHED [app 2/9] WORKDIR /root                                  0.0s
 => CACHED [app 3/9] RUN apt-config dump | grep -E '^APT::Install-  0.0s
 => CACHED [app 4/9] RUN apt-get update     && apt-get install -y   0.0s
 => CACHED [app 5/9] RUN pip install --upgrade     pip     setupto  0.0s
 => CACHED [app 6/9] COPY Pipfile Pipfile.lock .                    0.0s
 => CACHED [app 7/9] RUN pipenv sync --dev --system                 0.0s
 => CACHED [app 8/9] WORKDIR /legaldb                               0.0s
 => CACHED [app 9/9] RUN useradd --create-home --shell /bin/bash u  0.0s
 => [app] exporting to image                                        0.0s
 => => exporting layers                                             0.0s
 => => writing image sha256:afed789dbe7b4c4b4b79b825716e3299af8e6b  0.0s
 => => naming to docker.io/library/legaldb-app                      0.0s
[+] Running 2/2
 ✔ Container legaldb-db-1   Recreated                               0.2s 
 ✔ Container legaldb-app-1  Recreated                               0.1s 
Attaching to legaldb-app-1, legaldb-db-1
legaldb-app-1  | bash: connect: Connection refused
legaldb-app-1  | bash: line 1: /dev/tcp/db/5432: Connection refused
legaldb-app-1  | bash: connect: Connection refused
legaldb-app-1  | bash: line 1: /dev/tcp/db/5432: Connection refused
legaldb-db-1   | 
legaldb-db-1   | PostgreSQL Database directory appears to contain a database; Skipping initialization
legaldb-db-1   | 
legaldb-db-1   | 2024-10-07 16:18:13.304 UTC [1] LOG:  starting PostgreSQL 16.4 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit
legaldb-db-1   | 2024-10-07 16:18:13.304 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
legaldb-db-1   | 2024-10-07 16:18:13.304 UTC [1] LOG:  listening on IPv6 address "::", port 5432
legaldb-db-1   | 2024-10-07 16:18:13.311 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
legaldb-db-1   | 2024-10-07 16:18:13.371 UTC [31] LOG:  database system was shut down at 2024-10-07 16:16:26 UTC
legaldb-db-1   | 2024-10-07 16:18:13.427 UTC [1] LOG:  database system is ready to accept connections
legaldb-app-1  | ERROR (1) Unhandled exception:
legaldb-app-1  | Traceback (most recent call last):
legaldb-app-1  |   File "/legaldb/./manage.py", line 32, in <module>
legaldb-app-1  |     main()
legaldb-app-1  |   File "/legaldb/./manage.py", line 27, in main
legaldb-app-1  |     execute_from_command_line(sys.argv)

From above, these seem to be the main issue:

bash: connect: Connection refused
bash: line 1: /dev/tcp/db/5432: Connection refused

ValueError: invalid truth value ''

This is where I got stuck before I realized I needed to set these two variables explicitly

DJANGO_COMPRESS_ENABLED=
DJANGO_COMPRESS_OFFLINE=

This may be obvious for people who use Django regularly, but it wasn't to me and some of the other Outreachy participants, as seen in the Slack channel discussions.

Expectation

Instructions should run the app seamlessly. The env.temnplate should be more specific and the README too.

Environment

MacOS 15.5

Additional context

Run into this while trying to set up for Outreachy

Resolution

  • I would be interested in resolving this bug.
@FatumaA FatumaA added 💻 aspect: code Concerns the software code in the repository 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents labels Oct 7, 2024
@TimidRobot
Copy link
Member

TimidRobot commented Oct 7, 2024

@FatumaA please update the description of this issue with the errors encountered

@TimidRobot TimidRobot added 🧹 status: ticket work required Needs more details before it can be worked on 🤖 aspect: dx Concerns developers' experience with the codebase 🟨 priority: medium Not blocking but should be fixed soon and removed 🟧 priority: high Stalls work on the project or its dependents 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 💻 aspect: code Concerns the software code in the repository labels Oct 7, 2024
@FatumaA
Copy link
Author

FatumaA commented Oct 7, 2024

Hi,
Done 🙂

@TimidRobot TimidRobot added help wanted Open to participation from the community 🏁 status: ready for work Ready for work and removed 🧹 status: ticket work required Needs more details before it can be worked on labels Oct 7, 2024
@FatumaA FatumaA linked a pull request Oct 22, 2024 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 aspect: dx Concerns developers' experience with the codebase 🛠 goal: fix Bug fix help wanted Open to participation from the community 🟨 priority: medium Not blocking but should be fixed soon 🏁 status: ready for work Ready for work
Projects
Status: Backlog
2 participants