pre fixing problems
This commit is contained in:
		@@ -66,36 +66,36 @@ STATIC_ROOT = BASE_DIR + "/static/"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
logfile = usersettings["LOGFILE"]
 | 
					# logfile = usersettings["LOGFILE"]
 | 
				
			||||||
LOGGING = {
 | 
					# LOGGING = {
 | 
				
			||||||
    "version": 1,
 | 
					#     "version": 1,
 | 
				
			||||||
    "disable_existing_loggers": False,
 | 
					#     "disable_existing_loggers": False,
 | 
				
			||||||
    "root": {"level": "INFO", "handlers": ["file"]},
 | 
					#     "root": {"level": "INFO", "handlers": ["file"]},
 | 
				
			||||||
    "handlers": {
 | 
					#     "handlers": {
 | 
				
			||||||
        "file": {
 | 
					#         "file": {
 | 
				
			||||||
            "level": "INFO",
 | 
					#             "level": "INFO",
 | 
				
			||||||
            "class": "logging.FileHandler",
 | 
					#             "class": "logging.FileHandler",
 | 
				
			||||||
            "filename": usersettings["LOGFILE"],
 | 
					#             "filename": usersettings["LOGFILE"],
 | 
				
			||||||
            "formatter": "app",
 | 
					#             "formatter": "app",
 | 
				
			||||||
        },
 | 
					#         },
 | 
				
			||||||
    },
 | 
					#     },
 | 
				
			||||||
    "loggers": {
 | 
					#     "loggers": {
 | 
				
			||||||
        "django": {
 | 
					#         "django": {
 | 
				
			||||||
            "handlers": ["file"],
 | 
					#             "handlers": ["file"],
 | 
				
			||||||
            "level": "INFO",
 | 
					#             "level": "INFO",
 | 
				
			||||||
            "propagate": True
 | 
					#             "propagate": True
 | 
				
			||||||
        },
 | 
					#         },
 | 
				
			||||||
    },
 | 
					#     },
 | 
				
			||||||
    "formatters": {
 | 
					#     "formatters": {
 | 
				
			||||||
        "app": {
 | 
					#         "app": {
 | 
				
			||||||
            "format": (
 | 
					#             "format": (
 | 
				
			||||||
                u"%(asctime)s [%(levelname)-8s] "
 | 
					#                 u"%(asctime)s [%(levelname)-8s] "
 | 
				
			||||||
                "(%(module)s.%(funcName)s) %(message)s"
 | 
					#                 "(%(module)s.%(funcName)s) %(message)s"
 | 
				
			||||||
            ),
 | 
					#             ),
 | 
				
			||||||
            "datefmt": "%Y-%m-%d %H:%M:%S",
 | 
					#             "datefmt": "%Y-%m-%d %H:%M:%S",
 | 
				
			||||||
        },
 | 
					#         },
 | 
				
			||||||
    },
 | 
					#     },
 | 
				
			||||||
}
 | 
					# }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##                                                                    ##
 | 
					##                                                                    ##
 | 
				
			||||||
########################################################################
 | 
					########################################################################
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,11 +6,10 @@ preload_app = True # By preloading an application you can save some RAM resource
 | 
				
			|||||||
keepalive = 5
 | 
					keepalive = 5
 | 
				
			||||||
# daemon = True # Detaches the server from the controlling terminal and enters the background. disabled for now
 | 
					# daemon = True # Detaches the server from the controlling terminal and enters the background. disabled for now
 | 
				
			||||||
# logging
 | 
					# logging
 | 
				
			||||||
 | 
					# errorlog = "/usr/src/app/data/logs/gunicorn_error.log"
 | 
				
			||||||
errorlog = "/home/massiveatoms/Desktop/logs/gunicorn_error.log"
 | 
					 | 
				
			||||||
loglevel = "warning"
 | 
					loglevel = "warning"
 | 
				
			||||||
accesslog = "/home/massiveatoms/Desktop/logs/gunicorn_access.log"
 | 
					# accesslog = "/usr/src/app/data/logs/gunicorn_access.log"
 | 
				
			||||||
# capture_output = True
 | 
					capture_output = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# debug settings which need to be commented out in prod
 | 
					# debug settings which need to be commented out in prod
 | 
				
			||||||
# reload=True
 | 
					# reload=True
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										31
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					## 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 ./supervisord.conf /etc/
 | 
				
			||||||
 | 
					ENTRYPOINT /usr/bin/supervisord -c /etc/supervisord.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# create some dirs
 | 
				
			||||||
 | 
					RUN mkdir /usr/src/app/logs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 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
 | 
				
			||||||
							
								
								
									
										4
									
								
								deployment/deploy.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								deployment/deploy.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					from os import environ
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,9 +1,9 @@
 | 
				
			|||||||
worker_processes 1;
 | 
					worker_processes 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# user nobody nogroup;
 | 
					# user nobody nogroup;
 | 
				
			||||||
user massiveatoms; 
 | 
					# user massiveatoms;  # 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  /home/massiveatoms/Desktop/logs/nginx.log warn;
 | 
					# error_log  /home/massiveatoms/Desktop/logs/nginx.log warn;
 | 
				
			||||||
# pid /var/run/nginx.pid;
 | 
					# pid /var/run/nginx.pid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
events {
 | 
					events {
 | 
				
			||||||
@@ -44,18 +44,18 @@ http {
 | 
				
			|||||||
    client_max_body_size 4G;
 | 
					    client_max_body_size 4G;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # set the correct host(s) for your site
 | 
					    # set the correct host(s) for your site
 | 
				
			||||||
    server_name localhost  192.168.1.4; # set this to the server url? or ip? we'll see MASSIVEATOMS
 | 
					    server_name localhost  0.0.0.0; # set this to the server url? or ip? we'll see MASSIVEATOMS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    keepalive_timeout 5;
 | 
					    keepalive_timeout 5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # MASSIVEATOMS
 | 
					    # # MASSIVEATOMS
 | 
				
			||||||
      location /download/ {
 | 
					    #   location /download/ {
 | 
				
			||||||
        alias "/run/media/massiveatoms/1AEEEA6EEEEA421D/Documents and Settings/MassiveAtoms/Documents/Calibre Library/";
 | 
					    #     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
 | 
					    #     # Never forget the fact that this little statement being root instead of alias caused us to lose more than a day troubleshooting
 | 
				
			||||||
    }
 | 
					    # }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          location /static/ {
 | 
					          location /static/ {
 | 
				
			||||||
        alias "/home/massiveatoms/Desktop/calibre-web-companion/CalibreWebCompanion/static/";
 | 
					        alias "/usr/src/app/CalibreWebCompanion/static/";
 | 
				
			||||||
        # Never forget the fact that this little statement being root instead of alias caused us to lose more than a day troubleshooting
 | 
					        # Never forget the fact that this little statement being root instead of alias caused us to lose more than a day troubleshooting
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,9 @@
 | 
				
			|||||||
django>=3.0.8
 | 
					django>=3.0.8
 | 
				
			||||||
inotify>=0.2.10
 | 
					inotify>=0.2.10
 | 
				
			||||||
 | 
					gunicorn>=20.0 
 | 
				
			||||||
# development
 | 
					# development
 | 
				
			||||||
django-debug-toolbar>=2.2
 | 
					# django-debug-toolbar>=2.2
 | 
				
			||||||
django-silk>=4.0
 | 
					# django-silk>=4.0
 | 
				
			||||||
locust>=1.1
 | 
					# locust>=1.1
 | 
				
			||||||
sqlalchemy>=1.3.15
 | 
					# sqlalchemy>=1.3.15
 | 
				
			||||||
rich>=3.0
 | 
					# rich>=3.0
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										26
									
								
								supervisord.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								supervisord.conf
									
									
									
									
									
										Normal 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
 | 
				
			||||||
		Reference in New Issue
	
	Block a user