make the database persistant in production
This commit is contained in:
parent
d5e74175e6
commit
07dd23a396
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 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
|
||||
|
||||
permissions:
|
||||
chmod -f 660 db.sqlite3
|
||||
echo "make sure that db.sqlite3 is owned by group users"
|
|
@ -5,7 +5,12 @@ services:
|
|||
dockerfile: Dockerfile.prod
|
||||
command: gunicorn franklincce.wsgi:application --bind 0.0.0.0:8000
|
||||
volumes:
|
||||
- static_volume:/home/app/web/staticfiles
|
||||
- type: volume
|
||||
source: static_volume
|
||||
target: /home/app/web/staticfiles
|
||||
- type: bind
|
||||
source: ./db.sqlite3
|
||||
target: /home/app/web/db.sqlite3
|
||||
expose:
|
||||
- 8000
|
||||
env_file:
|
||||
|
@ -20,3 +25,4 @@ services:
|
|||
- web
|
||||
volumes:
|
||||
static_volume:
|
||||
db_persist:
|
||||
|
|
|
@ -22,6 +22,7 @@ RUN mkdir -p /home/app
|
|||
|
||||
# create the app user
|
||||
RUN addgroup --system app && adduser --system --group app
|
||||
RUN usermod -a -G users app
|
||||
|
||||
# create the appropriate directories
|
||||
ENV HOME=/home/app
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
python3 manage.py makemigrations
|
||||
python3 manage.py migrate
|
||||
|
||||
exec "$@"
|
||||
|
|
|
@ -10,6 +10,7 @@ server {
|
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
|
|
Loading…
Reference in New Issue