-
-
Notifications
You must be signed in to change notification settings - Fork 344
Establish an e2e backend instance locally and in CI/CD #2429
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
Changes from 6 commits
b5c57b4
1e9254b
69092ce
4002a19
0a05fdf
58507cc
36258b5
4119c73
0688a77
a66029c
9846482
f8be096
fbac331
837c665
143ce39
1a42d21
f619928
93f3180
8893db1
1e39448
a659f0a
009b32c
54f09ee
f1b0af0
3376a65
3f76de1
0300e4e
89ad0a6
ee3055f
8c73507
e2f1162
bf347ef
c5909b3
fae06b4
78cd6c8
d054d25
dcd91be
913ffcb
ba9671b
c080a41
f43728e
14178dd
70562bf
2e7dd25
61551c3
eb0af68
55f717f
da0bb58
6de7222
ff08b13
d3e48dd
fc9f270
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
ahmedxgouda marked this conversation as resolved.
Show resolved
Hide resolved
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How was this dump created and what data is already there?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can add a command to dump the local backend instance |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| services: | ||
| backend: | ||
| container_name: nest-backend-e2e | ||
| command: > | ||
| sh -c ' | ||
| python manage.py migrate && | ||
| python manage.py runserver 0.0.0.0:8000 | ||
| ' | ||
| build: | ||
| context: ../backend | ||
| dockerfile: docker/Dockerfile | ||
| depends_on: | ||
| db: | ||
| condition: service_healthy | ||
| env_file: ../backend/.env | ||
| environment: | ||
| DJANGO_DB_HOST: ${DJANGO_DB_HOST:-db} | ||
| DJANGO_DB_NAME: ${DJANGO_DB_NAME:-nest_db_e2e} | ||
| DJANGO_DB_PASSWORD: ${DJANGO_DB_PASSWORD:-nest_user_e2e_password} | ||
| DJANGO_DB_PORT: ${DJANGO_DB_PORT:-5432} | ||
| DJANGO_DB_USER: ${DJANGO_DB_USER:-nest_user_e2e} | ||
| networks: | ||
| - nest-network | ||
| ports: | ||
| - 8000:8000 | ||
| db: | ||
| container_name: nest-db-e2e | ||
| image: pgvector/pgvector:pg16 | ||
| environment: | ||
| POSTGRES_DB: ${DJANGO_DB_NAME:-nest_db_e2e} | ||
| POSTGRES_PASSWORD: ${DJANGO_DB_PASSWORD:-nest_user_e2e_password} | ||
| POSTGRES_USER: ${DJANGO_DB_USER:-nest_user_e2e} | ||
| healthcheck: | ||
| interval: 5s | ||
| retries: 5 | ||
| test: [CMD-SHELL, pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB -h localhost -p 5432] | ||
| timeout: 5s | ||
| networks: | ||
| - nest-network | ||
| volumes: | ||
| - db-e2e-data:/var/lib/postgresql/data | ||
| ports: | ||
| - 5433:5432 | ||
|
|
||
|
|
||
| volumes: | ||
| db-e2e-data: | ||
|
|
||
| networks: | ||
| nest-network: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| services: | ||
| production-nest-backend: | ||
| container_name: production-nest-backend | ||
| entrypoint: /home/owasp/entrypoint.sh | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify the entrypoint script exists and is properly configured. The production service now explicitly calls
Run the following script to verify the entrypoint is present in the backend image: 🏁 Script executed: #!/bin/bash
# Verify entrypoint script exists in the backend production image
docker run --rm --entrypoint ls owasp/nest:backend-production -la /home/owasp/entrypoint.sh 2>&1 || echo "Entrypoint script not found or image not available locally"Length of output: 103 🏁 Script executed: #!/bin/bash
# Search for entrypoint.sh in the repository
fd -t f entrypoint.shLength of output: 28 🏁 Script executed: #!/bin/bash
# Find Dockerfile for the backend service
fd -t f -e Dockerfile | grep -i "backend\|nest" || fd -t f -e DockerfileLength of output: 0 🏁 Script executed: #!/bin/bash
# Search for references to the entrypoint path in docker-compose and Dockerfiles
rg -n "entrypoint.sh|/home/owasp" --type yaml --type dockerfileLength of output: 34 🏁 Script executed: #!/bin/bash
# Examine the entrypoint script content
cat backend/docker/entrypoint.shLength of output: 160 🏁 Script executed: #!/bin/bash
# Find all Dockerfiles (remove type filter to avoid errors)
fd -t f "Dockerfile" -o "Dockerfile.*"Length of output: 143 🏁 Script executed: #!/bin/bash
# Look for Docker-related files in backend/docker directory
ls -la backend/docker/ 2>/dev/null || echo "Directory not found"Length of output: 365 🏁 Script executed: #!/bin/bash
# Search for COPY and ADD commands that reference entrypoint in any files
rg -n "COPY|ADD" -A 1 -B 1 | grep -A 2 -B 2 "entrypoint\|/home/owasp"Length of output: 1355 🏁 Script executed: #!/bin/bash
# View full backend/docker/Dockerfile to understand working directory and path resolution
cat backend/docker/DockerfileLength of output: 1731 🏁 Script executed: #!/bin/bash
# Check if entrypoint.sh is marked executable in git
git ls-files -s backend/docker/entrypoint.shLength of output: 78 Add signal handlers to entrypoint script for graceful shutdown in production. The script exists at Location: Fix: Add signal forwarding before gunicorn: #!/bin/sh
set -e
python manage.py migrate
python manage.py collectstatic --noinput
python manage.py clear_cache
exec gunicorn wsgi:application --bind 0.0.0.0:8000The 🤖 Prompt for AI Agents |
||
| image: owasp/nest:backend-production | ||
| env_file: .env.backend | ||
| depends_on: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.