Compare commits
	
		
			11 Commits
		
	
	
		
			master
			...
			7375ffe830
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 7375ffe830 | |||
| 8ba82ef0db | |||
| f7093e5e58 | |||
| 19c5b0830a | |||
| 23c1ff7140 | |||
| 8187817752 | |||
| 9160a37378 | |||
| fd77792688 | |||
| 9f5e2e93dd | |||
| 3a2a2ce268 | |||
| 48443d9855 | 
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
# project specific
 | 
			
		||||
settings.json
 | 
			
		||||
#settings.json
 | 
			
		||||
db.sqlite3
 | 
			
		||||
dummyusers.json
 | 
			
		||||
*.prof
 | 
			
		||||
 
 | 
			
		||||
@@ -190,7 +190,7 @@ WSGI_APPLICATION = 'CalibreWebCompanion.wsgi.application'
 | 
			
		||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
 | 
			
		||||
 | 
			
		||||
if usersettings["ISDOCKER"]:
 | 
			
		||||
    defaultdb_path = "/usr/src/app/data/"
 | 
			
		||||
    defaultdb_path = "calibre"
 | 
			
		||||
else:
 | 
			
		||||
    defaultdb_path = BASE_DIR
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								CalibreWebCompanion/CalibreWebCompanion/uwsgi.ini
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								CalibreWebCompanion/CalibreWebCompanion/uwsgi.ini
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
[uwsgi]
 | 
			
		||||
base = /cwebcomp
 | 
			
		||||
chdir = %(base)
 | 
			
		||||
home = %(base)
 | 
			
		||||
pidfile= %(base)/cwebcomp.pid
 | 
			
		||||
pythonpath= /usr/local
 | 
			
		||||
uid = www-data
 | 
			
		||||
gid = www-data
 | 
			
		||||
module = wsgi:application # path to wsgy.py file
 | 
			
		||||
socket = :8000
 | 
			
		||||
processes = 8
 | 
			
		||||
threads = 4
 | 
			
		||||
master = true
 | 
			
		||||
chmod-socket = 660
 | 
			
		||||
vacuum = true
 | 
			
		||||
die-on-term = true
 | 
			
		||||
harakiri = 20 
 | 
			
		||||
max-requests = 5000
 | 
			
		||||
logs = %(base)/uwsgi_info.logs
 | 
			
		||||
daemonize = %(base)/uwsgi.logs
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{
 | 
			
		||||
    "CALIBRE_DIR": "/usr/src/app/calibredir",
 | 
			
		||||
    "CALIBRE_DIR": "calibre",
 | 
			
		||||
    "SECRET_KEY": "u(8^+rb%rz5hsx4v^^y(ul7g(4n7a8!db@s*9(m5cs*2_ppy8+",
 | 
			
		||||
    "ALLOWED_HOSTS": [
 | 
			
		||||
        "127.0.0.1"
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
        "127.0.0.1"
 | 
			
		||||
    ],
 | 
			
		||||
    "DEBUG" : true,
 | 
			
		||||
    "LOGFOLDER" : "/usr/src/app/data/logs/",
 | 
			
		||||
    "LOGFOLDER" : "/cwebcomp/logs",
 | 
			
		||||
    "ISDOCKER" : true
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										35
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
FROM python:3.9.1-slim-buster
 | 
			
		||||
 | 
			
		||||
RUN apt-get clean && \
 | 
			
		||||
    apt-get update && \
 | 
			
		||||
    apt-get install -y nginx smbclient default-libmysqlclient-dev \
 | 
			
		||||
     gcc python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 \
 | 
			
		||||
     libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
 | 
			
		||||
 | 
			
		||||
# set environment variables
 | 
			
		||||
ENV PYTHONDONTWRITEBYTECODE 1
 | 
			
		||||
ENV PYTHONUNBUFFERED 1
 | 
			
		||||
 | 
			
		||||
RUN mkdir /cwebcomp
 | 
			
		||||
WORKDIR /cwebcomp
 | 
			
		||||
ADD . /cwebcomp/
 | 
			
		||||
# only add this next one if you have static files
 | 
			
		||||
RUN mkdir static
 | 
			
		||||
 | 
			
		||||
RUN pip install -r requirements.txt
 | 
			
		||||
RUN python CalibreWebCompanion/manage.py collectstatic
 | 
			
		||||
 | 
			
		||||
# only if you need celery 
 | 
			
		||||
#RUN useradd -ms /bin/bash celery 
 | 
			
		||||
#COPY broker/init.d_celeryd /etc/init.d/celeryd
 | 
			
		||||
#COPY broker/celeryd /etc/default/celeryd
 | 
			
		||||
 | 
			
		||||
# nginx config and script to be run
 | 
			
		||||
COPY deployment/docker/nginx.conf /etc/nginx/sites-available/default
 | 
			
		||||
COPY deployment/docker/start.sh /usr/local/bin/start.sh
 | 
			
		||||
 | 
			
		||||
# set proper file permissions
 | 
			
		||||
RUN chmod u+x /usr/local/bin/start.sh
 | 
			
		||||
 | 
			
		||||
EXPOSE 80
 | 
			
		||||
CMD ["/bin/bash", "-c", "start.sh"]
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
 | 
			
		||||
## pull official base image
 | 
			
		||||
FROM python:3.8.3-alpine
 | 
			
		||||
FROM python:slim-buster
 | 
			
		||||
EXPOSE 8080
 | 
			
		||||
## set work directory
 | 
			
		||||
WORKDIR /usr/src/app
 | 
			
		||||
@@ -17,7 +17,7 @@ COPY ./deployment/nginx.conf /etc/nginx/
 | 
			
		||||
 | 
			
		||||
## copy project
 | 
			
		||||
COPY ./CalibreWebCompanion ./CalibreWebCompanion
 | 
			
		||||
copy ./deployment/startupscript.py ./
 | 
			
		||||
COPY ./deployment/startupscript.py ./
 | 
			
		||||
## gunicorn borks started with supervisord
 | 
			
		||||
COPY ./deployment/supervisord.conf /etc/
 | 
			
		||||
ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								deployment/docker/nginx.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								deployment/docker/nginx.conf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
server {
 | 
			
		||||
    listen 80;
 | 
			
		||||
    server_name 127.0.0.1;
 | 
			
		||||
    charset utf-8;
 | 
			
		||||
    client_max_body_size 75M;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    location /static/ {
 | 
			
		||||
        alias /cwebcomp/static/;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    location /media/ {
 | 
			
		||||
        alias /cwebcomp/media/;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
     location / {
 | 
			
		||||
        include     uwsgi_params;
 | 
			
		||||
        uwsgi_pass  127.0.0.1:8000;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								deployment/docker/start.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								deployment/docker/start.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
uwsgi --ini app.ini --venv /usr/local
 | 
			
		||||
nginx -g 'daemon off;'
 | 
			
		||||
		Reference in New Issue
	
	Block a user