initial commit
This commit is contained in:
		
							
								
								
									
										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,6 +1,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## pull official base image
 | 
					## pull official base image
 | 
				
			||||||
FROM python:3.8.3-alpine
 | 
					FROM python:slim-buster
 | 
				
			||||||
EXPOSE 8080
 | 
					EXPOSE 8080
 | 
				
			||||||
## set work directory
 | 
					## set work directory
 | 
				
			||||||
WORKDIR /usr/src/app
 | 
					WORKDIR /usr/src/app
 | 
				
			||||||
@@ -17,7 +17,7 @@ COPY ./deployment/nginx.conf /etc/nginx/
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## copy project
 | 
					## copy project
 | 
				
			||||||
COPY ./CalibreWebCompanion ./CalibreWebCompanion
 | 
					COPY ./CalibreWebCompanion ./CalibreWebCompanion
 | 
				
			||||||
copy ./deployment/startupscript.py ./
 | 
					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
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										37
									
								
								deployment/docker/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								deployment/docker/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					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 yoi have static files
 | 
				
			||||||
 | 
					RUN mkdir static
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN pip install -r requirements/requirements.txt
 | 
				
			||||||
 | 
					RUN python 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 docker/nginx.conf /etc/nginx/sites-available/default
 | 
				
			||||||
 | 
					COPY docker/start.sh /usr/local/bin/start.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# set proper file permissions
 | 
				
			||||||
 | 
					RUN chmod u+x /etc/init.d/celeryd && \
 | 
				
			||||||
 | 
					  chmod u+x /etc/default/celeryd && \
 | 
				
			||||||
 | 
					  chmod u+x /usr/local/bin/start.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXPOSE 80
 | 
				
			||||||
 | 
					CMD ["/bin/bash", "-c", "start.sh"]
 | 
				
			||||||
							
								
								
									
										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;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										0
									
								
								deployment/docker/start.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								deployment/docker/start.sh
									
									
									
									
									
										Normal file
									
								
							
		Reference in New Issue
	
	Block a user