-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72d16d3
commit f2eb24b
Showing
11 changed files
with
132 additions
and
8 deletions.
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,5 @@ | ||
DB_NAME=dbname | ||
DB_USER=rootuser | ||
DB_PASS=changeme | ||
DJANGO_SECRET_KEY=changeme | ||
DJANGO_ALLOWED_HOSTS=127.0.0.1 |
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
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,43 @@ | ||
version: "3.9" | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
restart: always | ||
volumes: | ||
- static-data:/vol/web | ||
environment: | ||
- DB_HOST=db | ||
- DB_NAME=${DB_NAME} | ||
- DB_USER=${DB_USER} | ||
- DB_PASS=${DB_PASS} | ||
- SECRET_KEY=${DJANGO_SECRET_KEY} | ||
- ALLOWED_HOSTS=${DJANGO_ALLOWED_HOSTS} | ||
depends_on: | ||
- db | ||
|
||
db: | ||
image: postgres:13-alpine | ||
restart: always | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_DB=${DB_NAME} | ||
- POSTGRES_USER=${DB_USER} | ||
- POSTGRES_PASSWORD=${DB_PASS} | ||
|
||
proxy: | ||
build: | ||
context: ./proxy | ||
restart: always | ||
depends_on: | ||
- app | ||
ports: | ||
- 8000: 8000 | ||
volumes: | ||
- static-data/vol/static | ||
|
||
volumes: | ||
postgres-data: | ||
static-data: |
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 |
---|---|---|
|
@@ -20,6 +20,7 @@ services: | |
- DB_NAME=devdb | ||
- DB_USER=devuser | ||
- DB_PASS=changeme | ||
- DEBUG=1 | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM nginxinc/nginx-unprivileged:1-alpine | ||
LABEL maintainer="quarnstric" | ||
|
||
COPY ./default.conf.tpl /etc/nginx/defualt.conf.tpl | ||
COPY ./uwsgi_params /etc/nginx/uwsgi_params | ||
COPY ./run.sh /run.sh | ||
|
||
ENV LISTEN_PORT=8000 | ||
ENV APP_HOST=app | ||
ENV APP_PORT=9000 | ||
|
||
USER root | ||
|
||
RUN mkdir -p /vol/static && \ | ||
chmod 755 /vol/static && \ | ||
touch /etc/nginx/conf.d/defualt.conf && \ | ||
chown nginx:nginx /etc/nginx/conf.d/defualt.conf && \ | ||
chmod +x /run.sh | ||
|
||
VOLUME /vol/static | ||
|
||
USER nginx | ||
|
||
CMD [ "/run.sh" ] |
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,13 @@ | ||
server { | ||
listen ${LISTEN_PORT}; | ||
|
||
location /static { | ||
alias /vol/static; | ||
} | ||
|
||
location / { | ||
uwsgi_pass ${APP_HOST}:${APP_PORT}; | ||
include /etc/nginx/uwsgi_params; | ||
client_max_body_size 10M; | ||
} | ||
} |
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,6 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
envsubst < /etc/nginx/default.conf.tpl > /etc/nginx/conf.d/default.conf | ||
nginx -g 'daemon off;' |
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,13 @@ | ||
uwsgi_param QUERY_STRING $query_string; | ||
uwsgi_param REQUEST_METHOD $request_method; | ||
uwsgi_param CONTENT_TYPE $content_type; | ||
uwsgi_param CONTENT_LENGTH $content_length; | ||
uwsgi_param REQUEST_URI $request_uri; | ||
uwsgi_param PATH_INFO $document_uri; | ||
uwsgi_param DOCUMENT_ROOT $document_root; | ||
uwsgi_param SERVER_PROTOCOL $server_protocol; | ||
uwsgi_param REMOTE_ADDR $remote_addr; | ||
uwsgi_param REMOTE_PORT $remote_port; | ||
uwsgi_param SERVER_ADDR $server_addr; | ||
uwsgi_param SERVER_PORT $server_port; | ||
uwsgi_param SERVER_NAME $server_name; |
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,9 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
python manage.py wait_for_db | ||
python manage.py collectstatic --noinput | ||
|
||
|
||
uwsgi --socket :9000 --workers 4 --master --enable-threads --module app.wsgi |