diff --git a/README.md b/README.md index 00cd8f1..f7dc63a 100755 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@

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.

https://pyshelf.com

-![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)

Discord [https://discord.gg/H9TbNJS](https://discord.gg/H9TbNJS) | IRC freenode.net @ #pyshelf

@@ -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. diff --git a/config.json b/config.json index 6765835..44629f1 100755 --- a/config.json +++ b/config.json @@ -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"} \ No newline at end of file diff --git a/docker/.env b/docker/.env new file mode 100644 index 0000000..8c02342 --- /dev/null +++ b/docker/.env @@ -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 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..32f85bc --- /dev/null +++ b/docker/Dockerfile @@ -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"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..399262f --- /dev/null +++ b/docker/docker-compose.yml @@ -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 diff --git a/src/frontend/settings.py b/src/frontend/settings.py index 6fe29bb..470ce96 100755 --- a/src/frontend/settings.py +++ b/src/frontend/settings.py @@ -99,6 +99,8 @@ DATABASES = { "NAME": CONFIG.catalogue_db, "USER": "pyshelf", "PASSWORD": CONFIG.password, + "HOST": CONFIG.db_host, + "PORT": CONFIG.db_port, } }