Removed hardcoded paths, make workflow changes

I removed some hardcoded paths for logging and where the default db should be located.
I also organized deployment stuff a bit
This commit is contained in:
TinyAtoms
2020-08-15 02:40:03 -03:00
parent 1b8d81bd3c
commit 75099ca05e
7 changed files with 60 additions and 43 deletions

29
deployment/Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
## pull official base image
FROM python:3.8.3-alpine
EXPOSE 8080
## set work directory
WORKDIR /usr/src/app
## install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt .
RUN pip install -r requirements.txt
RUN apk add nginx supervisor
# do nginx stuff
# RUN adduser -D -g 'www' www
RUN mkdir -p /run/nginx
COPY ./deployment/nginx.conf /etc/nginx/
## copy project
COPY ./CalibreWebCompanion ./CalibreWebCompanion
## gunicorn borks started with supervisord
COPY ./deployment/supervisord.conf /etc/
ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf
# 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

View File

@@ -3,7 +3,7 @@ worker_processes 1;
# user nobody nogroup;
# user massiveatoms; # TEMP disabled
# user nobody nobody; # for systems with 'nobody' as a group instead
# error_log /home/massiveatoms/Desktop/logs/nginx.log warn;
error_log /usr/src/app/data/logs/nginx.log warn;
# pid /var/run/nginx.pid;
events {
@@ -49,10 +49,10 @@ http {
keepalive_timeout 5;
# # MASSIVEATOMS
# location /download/ {
# alias "/run/media/massiveatoms/1AEEEA6EEEEA421D/Documents and Settings/MassiveAtoms/Documents/Calibre Library/";
# # Never forget the fact that this little statement being root instead of alias caused us to lose more than a day troubleshooting
# }
location /download/ {
alias "/usr/src/app/calibredir";
# Never forget the fact that this little statement being root instead of alias caused us to lose more than a day troubleshooting
}
location /static/ {
alias "/usr/src/app/CalibreWebCompanion/static/";

View File

@@ -0,0 +1,26 @@
[supervisord]
nodaemon=true
logfile=/tmp/supervisord.log
childlogdir=/tmp
pidfile = /tmp/supervisord.pid
[program:gunicorn]
directory=/usr/src/app/CalibreWebCompanion
command=gunicorn CalibreWebCompanion.wsgi
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0
startsecs = 0
[program:nginx]
# user=www
command=nginx
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
autorestart=false
startretries=0