Skip to content

Commit

Permalink
Merge pull request #4 from kingcobra2468/fix/docker-book-binding
Browse files Browse the repository at this point in the history
Fix/docker book binding
  • Loading branch information
kingcobra2468 authored Jan 16, 2022
2 parents 7bca384 + 6a3e9d3 commit 8432583
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BOOKS_DIR=
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ app/static/covers/*

#Hide contents of /static/books
app/static/books/*
env/
env/

.env
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ As an optimization over having book cover generation done during a user request
1. Run `apt-get install poppler-utils gunicorn python3` .
2. Install python packages with `pip3 install -r requirements.txt`.
3. Install and setup MongoDB. Set the host and port info for this server in `config.py`.
4. From the root directory of the project, run `python3 -m pdfshare.pdfbsd.pdfbsd` to launch pdfbsd. Then, to launch the website/PDFShare run `python3 -m pdfshare.app.main`. *Note: running* `run_pdfbsd_pdfshare.sh` *script is equivalent to running the two previous commands*.
4. From the root directory of the project, run `python3 -m pdfshare.pdfbsd.pdfbsd` to launch pdfbsd. Then, to launch the
website/PDFShare run `python3 -m pdfshare.app.main`. *Note: running* `run_pdfbsd_pdfshare.sh` *script is equivalent to running the two previous
commands*.
5. Place all PDFs in the directory that was specified in `config.py`.
6. (Optional). Run PDFShare over a WSGI via gunicorn with `gunicorn -c gunicorn_config.py wsgi:app`.

### **With Docker**
1. Create directory called `~/Books/` which is where the PDFs will live. Alternate dirs require changing `docker-compose.yml`.
1. Create directory which is where the PDFs will live. Then, copy the template file `.env.template` and save it as `.env`. Set the `BOOKS_DIR`
environment variable to the directory where the books live.
2. Build containers `docker-compose build`
3. Start PDFShare with `docker-compose up -d`.

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ services:
container_name: pdfshare_nginx
volumes:
- static_data:/var/www/static:rw
- ~/Books:/var/www/static/books:rw
- ${BOOKS_DIR}:/var/www/static/books:rw
- ./nginx.conf:/etc/nginx/nginx.conf
ports:
- 80:80
Expand All @@ -28,7 +28,7 @@ services:
image: pdfshare:latest
container_name: pdfshare
volumes:
- ~/Books:/home/server/pdfshare/app/static/books:rw
- ${BOOKS_DIR}:/home/server/pdfshare/app/static/books:rw
- static_data:/home/server/pdfshare/app/static:rw
expose:
- "9000"
Expand Down

0 comments on commit 8432583

Please sign in to comment.