make the database persistant (v2)
This commit is contained in:
parent
36769ef6ac
commit
4b0ae78bf0
4
Makefile
4
Makefile
|
@ -4,3 +4,7 @@ prod: # execute this target on the production server in the nix-shell
|
||||||
sed "s/change_me/$(shell shuf -i1-1000000 -n1)/g" .env.prod.orig > .env.prod
|
sed "s/change_me/$(shell shuf -i1-1000000 -n1)/g" .env.prod.orig > .env.prod
|
||||||
sed "s|change_me|$(shell dd if=/dev/urandom bs=1024 count=1|base64)|g" .env.prod.orig > .env.prod
|
sed "s|change_me|$(shell dd if=/dev/urandom bs=1024 count=1|base64)|g" .env.prod.orig > .env.prod
|
||||||
docker-compose -f docker-compose.prod.yml up -d --build
|
docker-compose -f docker-compose.prod.yml up -d --build
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
chmod -f 660 db.sqlite3
|
||||||
|
echo "make sure that db.sqlite3 is owned by group users"
|
|
@ -5,8 +5,12 @@ services:
|
||||||
dockerfile: Dockerfile.prod
|
dockerfile: Dockerfile.prod
|
||||||
command: gunicorn franklincce.wsgi:application --bind 0.0.0.0:8000
|
command: gunicorn franklincce.wsgi:application --bind 0.0.0.0:8000
|
||||||
volumes:
|
volumes:
|
||||||
- static_volume:/home/app/web/staticfiles
|
- type: volume
|
||||||
- db_persist:/home/app/web/franklincce/db.sqlite3
|
source: static_volume
|
||||||
|
target: /home/app/web/staticfiles
|
||||||
|
- type: bind
|
||||||
|
source: ./db.sqlite3
|
||||||
|
target: /home/app/web/db.sqlite3
|
||||||
expose:
|
expose:
|
||||||
- 8000
|
- 8000
|
||||||
env_file:
|
env_file:
|
||||||
|
|
|
@ -22,6 +22,7 @@ RUN mkdir -p /home/app
|
||||||
|
|
||||||
# create the app user
|
# create the app user
|
||||||
RUN addgroup --system app && adduser --system --group app
|
RUN addgroup --system app && adduser --system --group app
|
||||||
|
RUN usermod -a -G users app
|
||||||
|
|
||||||
# create the appropriate directories
|
# create the appropriate directories
|
||||||
ENV HOME=/home/app
|
ENV HOME=/home/app
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
python3 manage.py makemigrations
|
||||||
|
python3 manage.py migrate
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
|
@ -10,6 +10,7 @@ server {
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
client_max_body_size 100M;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /static/ {
|
location /static/ {
|
||||||
|
|
Loading…
Reference in New Issue