-
Notifications
You must be signed in to change notification settings - Fork 0
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
[story/EDROP-14] #15
Open
jophals
wants to merge
2
commits into
develop
Choose a base branch
from
story/EDROP-14
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[story/EDROP-14] #15
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM python:3.13 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
WORKDIR /edrop | ||
|
||
RUN apt-get update && apt-get install -y supervisor && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
COPY edrop-gunicorn.sh /edrop/edrop-gunicorn.sh | ||
COPY supervisor.service /etc/systemd/system/supervisor.service | ||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
|
||
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
version: "3.9" | ||
|
||
services: | ||
db: | ||
image: postgres:16 | ||
platform: linux/amd64 | ||
volumes: | ||
- ./data/db:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_DB=postgres | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
ports: | ||
- "5432:5432" | ||
web: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-prod | ||
platform: linux/amd64 | ||
volumes: | ||
- .:/edrop | ||
- ./data/files:/data/files | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
- POSTGRES_NAME=postgres | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
- DATA_PATH=/data/files/ | ||
- MEDIA_URL_PATH=/dashboard/files/ | ||
- MEDIA_ROOT_PATH=files | ||
depends_on: | ||
- db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
NAME="edrop" # Name of the application | ||
DJANGODIR=/edrop # Django project directory | ||
NUM_WORKERS=3 # Number of Gunicorn workers | ||
DJANGO_SETTINGS_MODULE=edrop.settings # Django settings module | ||
DJANGO_WSGI_MODULE=edrop.wsgi # WSGI module name | ||
|
||
echo "Starting $NAME as `whoami`" | ||
|
||
# Activate the virtual environment | ||
cd $DJANGODIR | ||
source .env_app | ||
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE | ||
export PYTHONPATH=$DJANGODIR:$PYTHONPATH | ||
mkdir -p /edrop/logs | ||
python -m pip install -r requirements.txt | ||
python manage.py migrate | ||
python manage.py collectstatic --noinput | ||
|
||
# Start your Django Unicorn | ||
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon) | ||
exec gunicorn ${DJANGO_WSGI_MODULE}:application \ | ||
--name $NAME \ | ||
--workers $NUM_WORKERS \ | ||
--bind=0.0.0.0:8000 \ | ||
--log-level=info \ | ||
--log-file /edrop/logs/edrop_supervisor.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
django==5.1 | ||
gunicorn==22.0.0 | ||
psycopg2==2.9.10 | ||
dj-static==0.0.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# /etc/systemd/system/supervisor.service | ||
|
||
[Unit] | ||
Description=Supervisor | ||
After=syslog.target network.target | ||
|
||
[Service] | ||
ExecStart=/usr/bin/supervisord --configuration=/etc/supervisor/conf.d/supervisord.conf --logfile=/edrop/logs/edrop_supervisor.log | ||
ExecStop=/usr/bin/supervisorctl shutdown | ||
ExecReload=/usr/bin/supervisorctl reload all | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:edrop] | ||
command=/edrop/edrop-gunicorn.sh | ||
directory=/edrop | ||
autostart=true | ||
autorestart=true | ||
stdout_logfile=/edrop/logs/edrop_supervisor.log | ||
stderr_logfile=/edrop/logs/edrop_supervisor.log | ||
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8 | ||
|
||
; Need to wait for currently executing tasks to finish at shutdown. | ||
; Increase this if you have very long running tasks. | ||
stopwaitsecs = 600 | ||
|
||
; When resorting to send SIGKILL to the program to terminate it | ||
; send SIGKILL to its whole process group instead, | ||
; taking care of its children as well. | ||
killasgroup=true | ||
|
||
; if rabbitmq is supervised, set its priority higher | ||
; so it starts first | ||
priority=998 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's create a separate docker compose file for production and leave this the way it was