fixed some db stuff

This commit is contained in:
TinyAtoms 2020-08-15 11:00:25 -03:00
parent 75099ca05e
commit 9843299ef6
5 changed files with 43 additions and 7 deletions

View File

@ -11,13 +11,13 @@ RUN pip install -r requirements.txt
RUN apk add nginx supervisor RUN apk add nginx supervisor
# do nginx stuff # do nginx stuff
# RUN adduser -D -g 'www' www RUN adduser -D -g 'www' www
RUN mkdir -p /run/nginx RUN mkdir -p /run/nginx
COPY ./deployment/nginx.conf /etc/nginx/ COPY ./deployment/nginx.conf /etc/nginx/
## copy project ## copy project
COPY ./CalibreWebCompanion ./CalibreWebCompanion COPY ./CalibreWebCompanion ./CalibreWebCompanion
copy ./deployment/startupscript.py ./
## gunicorn borks started with supervisord ## gunicorn borks started with supervisord
COPY ./deployment/supervisord.conf /etc/ COPY ./deployment/supervisord.conf /etc/
ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf
@ -25,5 +25,5 @@ ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf
# docker run --publish 8000:80 \ # docker run --publish 8000:80 \
# -v '/home/massiveatoms/Desktop/logs:/usr/src/app/data' \ # -v '/home/massiveatoms/Desktop/logs:/usr/src/app/data' \
# -v '/run/media/massiveatoms/1AEEEA6EEEEA421D/Documents and Settings/MassiveAtoms/Documents/Calibre Library/:/usr/src/app/calibredir' \ # -v '/run/media/massiveatoms/1AEEEA6EEEEA421D1/Documents and Settings/MassiveAtoms/Documents/Calibre Library/:/usr/src/app/calibredir' \
# --name cw calibreweb:1.0.1 # --name cw calibreweb:1.0.1

View File

@ -1,4 +1,4 @@
# non docker stuff
1. clone repo 1. clone repo
2. pip install -r requirements.txt 2. pip install -r requirements.txt
3. install gunicorn and nginx 3. install gunicorn and nginx
@ -18,4 +18,19 @@ Suggestions:
1. We might want to use sockets instead of ip/port? 1. We might want to use sockets instead of ip/port?
2. logging 2. logging
3. autostart gunicorn/nginx 3. autostart gunicorn/nginx
4. some extra instrumentation for gunicorn https://docs.gunicorn.org/en/latest/deploy.html 4. some extra instrumentation for gunicorn https://docs.gunicorn.org/en/latest/deploy.html
# docker stuff
here are the commands i use to build and run:
1. build --tag calibreweb:1.0.1 . -f ./deployment/Dockerfile
2.
```
docker run --publish 8000:80\
-v '/home/massiveatoms/Desktop/logs:/usr/src/app/data' \
-v '/run/media/massiveatoms/1AEEEA6EEEEA421D/Documents and Settings/MassiveAtoms/Documents/Calibre Library/:/usr/src/app/calibredir' \
--name cw calibreweb:1.0.1
```
Docker stuff to fix:
1. permission/ownership issue with volumes and nginx
2. we need a setup script that changes secretkey, and generates the default db

View File

@ -1,7 +1,7 @@
worker_processes 1; worker_processes 1;
# user nobody nogroup; # user nobody nogroup;
# user massiveatoms; # TEMP disabled user www www; # TEMP disabled
# user nobody nobody; # for systems with 'nobody' as a group instead # user nobody nobody; # for systems with 'nobody' as a group instead
error_log /usr/src/app/data/logs/nginx.log warn; error_log /usr/src/app/data/logs/nginx.log warn;
# pid /var/run/nginx.pid; # pid /var/run/nginx.pid;

View File

@ -0,0 +1,11 @@
from os import system, chdir
system("chown -R www:www /usr/src/app/calibredir")
print("ownership of calibredir changed")
chdir("/usr/src/app/CalibreWebCompanion")
system("python ./manage.py makemigrations")
print("ran makemigrations")
system("python ./manage.py migrate")
print("migrate")

View File

@ -23,4 +23,14 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
autorestart=false autorestart=false
startretries=0
[program:startupscript]
directory=/usr/src/app
command=python ./startupscript.py
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0 startretries=0