From edc9366a5bac769fb15491b23d5fb970c93685b1 Mon Sep 17 00:00:00 2001 From: TinyAtoms Date: Sun, 16 Aug 2020 02:06:22 -0300 Subject: [PATCH] changed instructions --- CalibreWebCompanion/settings.json.bak | 11 +++-- deployment/instructions.md | 67 +++++++++++++++------------ 2 files changed, 45 insertions(+), 33 deletions(-) diff --git a/CalibreWebCompanion/settings.json.bak b/CalibreWebCompanion/settings.json.bak index 1cf67af..befb87d 100644 --- a/CalibreWebCompanion/settings.json.bak +++ b/CalibreWebCompanion/settings.json.bak @@ -1,12 +1,15 @@ { - "CALIBRE_DIR": "PATH\\TO\\your\\calibre\library", + "CALIBRE_DIR": "/usr/src/app/calibredir", "SECRET_KEY": "u(8^+rb%rz5hsx4v^^y(ul7g(4n7a8!db@s*9(m5cs*2_ppy8+", - "ALLOWED_HOSTS": [ + "ALLOWED_HOSTS": [ "127.0.0.1" ], "INTERNAL_IPS": [ "127.0.0.1" ], - "DEBUG" : false, - "LOGFILE" : "/home/massiveatoms/Desktop/logs/django.log" + "DEBUG" : true, + "LOGFOLDER" : "/usr/src/app/data/logs/", + "ISDOCKER" : true + + } \ No newline at end of file diff --git a/deployment/instructions.md b/deployment/instructions.md index 58c7a48..0bf2279 100644 --- a/deployment/instructions.md +++ b/deployment/instructions.md @@ -1,36 +1,45 @@ -# non docker stuff -1. clone repo -2. pip install -r requirements.txt -3. install gunicorn and nginx -4. move this nginx.conf to /etc/nginx -5. make whatever user nginx runs as (in this case, massiveatoms) the owner of calibredir -6. give execute permissions to parent of calibredir -7. cd to repo, run `gunicorn CalibreWebCompanion.wsgi` -8. start nginx `sudo systemctl restart nginx` -Slight issues with this atm: -1. server_name in nginx.conf needs to be changed -2. User needs to be edited in nginx.conf, now it's just my user acc. This affectd step 4-6 -3. where to do ssl? - - -Suggestions: -1. We might want to use sockets instead of ip/port? -2. logging -3. autostart gunicorn/nginx -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 setup (no provided docker image atm) +1. clone the repo +2. rename ./calireWebCompanion/settings.json.bak to settings.json +3. change the secret key +4. run `build --tag calibreweb:1.0 . -f ./deployment/Dockerfile` to build the image +5. run your container with your bind/mount your volumes/paths/things +Here's an example of step 5 ``` -docker run --publish 8000:80\ +docker run --publish 80: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 \ No newline at end of file +your Calibre path/volume/whatever needs to be mounted at `/usr/src/app/calibredir`, and you need to mount a volume for the db and logs at `/usr/src/app/data` + +Issues with it at the moment: +1. we still need to do something to create a random secret key. Atm, this would still + +# Docker (provided image) +not done yet + +# non docker setup +this might need to be modified, since some things have changed to adapt it for docker setup +1. clone repo +2. pip install -r requirements.txt +3. rename the settings.json.bak to settings.json, change logging folder, change secret key, set isdocker to false +4. install gunicorn and nginx +5. move this nginx.conf to /etc/nginx +6. create a user and group `www` +7. make whatever user nginx runs as (for now, www) the owner of calibredir +8. give execute permissions to parent of calibredir +9. cd to repo, run `gunicorn CalibreWebCompanion.wsgi` +10. start nginx `sudo systemctl restart nginx` +11. make steps 9 and 10 happen on startup? + +Slight issues with this atm: +1. where to do ssl? + + +Suggestions: +1. We might want to use sockets instead of ip/port? +2. autostart gunicorn/nginx +3. some extra instrumentation for gunicorn https://docs.gunicorn.org/en/latest/deploy.html