Merge pull request #40 from hat/master

Should we run a separate docker branch permanently without the installer script or with a modified version?
This commit is contained in:
th3r00t
2020-05-15 22:34:59 -04:00
committed by GitHub
6 changed files with 80 additions and 3 deletions

30
README.md vendored
View File

@@ -4,8 +4,8 @@
<p align="center">Having used Calibre for hosting my eBook collection in the past, I found myself frustrated having to install X on my server, or manage my library externally, Thus I have decided to spin up my own.</p>
<p align="center"><a href="https://pyshelf.com">https://pyshelf.com</a></p>
![pyShelf 0.5.0 Collection 1](https://github.com/th3r00t/pyShelf/raw/development/preview_050.png)
![pyShelf 0.5.0 Collection 2](https://github.com/th3r00t/pyShelf/raw/development/preview_1_050.png)
![pyShelf 0.5.0 Collection 1](https://github.com/th3r00t/pyShelf/raw/master/preview_050.png)
![pyShelf 0.5.0 Collection 2](https://github.com/th3r00t/pyShelf/raw/master/preview_1_050.png)
<p align="center"><b>Discord [https://discord.gg/H9TbNJS](https://discord.gg/H9TbNJS) | IRC freenode.net @ #pyshelf</b></p>
@@ -78,6 +78,32 @@ All configuration is now handled by the installer.
Running via the Django test server might be possible, albeit not recomended.
## Docker
Installation for Docker is handled by docker-compose
It will spin up two containers: one postgres, one for the Django application
Edit [docker/.env](docker/.env)
`docker-compose -f docker/docker-compose.yml --env-file=docker/.env up -d`
`docker exec -it -d docker_pyshelf_1 python3 manage.py migrate`
IMPORT BOOKS
Once the .epub files are in the directory specified in [docker/.env](docker/.env)
`docker exec -it docker_pyshelf_1 /bin/bash`
`cd /usr/src/app/ && python3 importBooks`
### Docker Future Enhancements
- [ ] Change method of importing books ssibly cron or using the Django code
- [ ] Look into having the migration work without having to manually execute
### In Progress
#### Organizational tools.

2
config.json vendored
View File

@@ -1 +1 @@
{"TITLE": "pyShelf E-Book Server", "VERSION": "0.5.0", "BOOKPATH": "/srv/Books", "DB_HOST": "localhost", "DB_PORT": "5432", "DATABASE": "pyshelf", "USER": "pyshelf", "PASSWORD": "pyshelf", "BOOKSHELF": "data/shelf.json", "ALLOWED_HOSTS": "*", "hostname": "localhost", "webport": "8000", "wsgiport": "8001"}
{"TITLE": "pyShelf E-Book Server", "VERSION": "0.5.0", "BOOKPATH": "/srv/Books", "DB_HOST": "localhost", "DB_PORT": "5432", "DATABASE": "pyshelf", "USER": "pyshelf", "PASSWORD": "pyshelf", "BOOKSHELF": "data/shelf.json", "ALLOWED_HOSTS": "*", "hostname": "localhost", "webport": "8000", "wsgiport": "8001"}

6
docker/.env vendored Normal file
View File

@@ -0,0 +1,6 @@
LOCAL_BOOK_DIR=/home/user/pyShelf/Books
PORT=8088
POSTGRES_VER=12.2
POSTGRES_USER=pyshelf
POSTGRES_PASSWORD=pyshelf
POSTGRES_DB=pyshelf

20
docker/Dockerfile vendored Normal file
View File

@@ -0,0 +1,20 @@
# docker build -t ubuntu1604py36
FROM ubuntu:18.04
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update -y
RUN apt-get install -y build-essential python3.8 python3.8-dev python3-pip python3.8-venv && apt-get install -y git
# update pip
RUN python3 -m pip install wheel
RUN git clone https://github.com/hat/pyShelf.git /usr/src/app/
RUN python3 -m pip install -r /usr/src/app/requirements.txt
EXPOSE 8000
WORKDIR /usr/src/app/src/
#RUN ../docker/scripts/wait-for-it.sh db:5432
#RUN python3 manage.py migrate
#RUN python3 manage.py migrate interface
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]

23
docker/docker-compose.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
version: "3.7"
services:
db:
image: "postgres:${POSTGRES_VER}"
environment:
- "POSTGRES_PASSWORD=${POSTGRES_PASSWORD}"
- "POSTGRES_USER=${POSTGRES_USER}"
- "POSTGRES_DB=${POSTGRES_DB}"
volumes:
- ./postgres_data/:/var/lib/postgresql/data/
pyshelf:
build:
context: ./
dockerfile: Dockerfile
volumes:
- "${LOCAL_BOOK_DIR}:/usr/src/app/Books"
# - "./cron/root:/etc/crontabs/root"
# - "./scripts/wait-for-it.sh:/usr/src/app/src/"
ports:
- "${PORT}:8000"
depends_on:
- db

View File

@@ -99,6 +99,8 @@ DATABASES = {
"NAME": CONFIG.catalogue_db,
"USER": "pyshelf",
"PASSWORD": CONFIG.password,
"HOST": CONFIG.db_host,
"PORT": CONFIG.db_port,
}
}