diff --git a/.gitignore b/.gitignore index 7d5c28b..bc1824a 100755 --- a/.gitignore +++ b/.gitignore @@ -125,7 +125,6 @@ dmypy.json # End of https://www.gitignore.io/api/python 0 config.backup.json -create_db.sql uwsgi.ini installer.log pyshelf_nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9f4f459 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM archlinux:latest +RUN pacman -Syy +RUN pacman -Syu --noconfirm +RUN pacman -S --noconfirm python python-pip git postgresql sudo gcc +RUN sudo -u postgres initdb --locale=en_US.UTF-8 -E UTF8 -D /var/lib/postgres/data +RUN useradd pyshelf && chpasswd pyshelf:pyshelf +#RUN mkdir -p /srv/Books && mkdir -p /srv/http && mkdir -p /srv/logs/ && mkdir -p /run/postgresql && \ +# touch /srv/logs/pgsql.log && chown postgres.postgres /run/postgresql && \ +# chown http.pyshelf /srv/Books && chown http.pyshelf /srv/http && chown postgres.postgres /srv/logs/pgsql.log +VOLUME /srv/Books ./Books +VOLUME /srv/http . +VOLUME /srv/logs ./logs +VOLUME /var/lib/postgres/data ./pgdata +RUN sudo -u postgres pg_ctl -D /var/lib/postgres/data -l /srv/logs/pgsql.log start +RUN sudo -u postgres psql -f create_db.sql +ENV PYTHONUNBUFFERED=1 +WORKDIR /srv/http +RUN pip install -r requirements.txt +EXPOSE 80 8000 +CMD ["sh", "-c","/srv/http/entry.sh"] diff --git a/README.md b/README.md index 7db5bb0..00cd8f1 100755 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # pyShelf 0.5.0

Terminal based ebook server. Open source & Lightweight.

-![alt text](./preview_1_050.png) -![alt text](./preview_050.png) +

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

-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. +![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) -### Join the discussion: Discord [https://discord.gg/H9TbNJS](https://discord.gg/H9TbNJS) | IRC freenode.net @ #pyshelf +

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

## Current Features -* Custom Installer -- For Arch Based Distros Only +* Custom Installer -- pre-req installs work on Arch Based Distros Only * Recursive Scanning * Fast database access * Django based frontend @@ -28,13 +29,12 @@ Having used Calibre for hosting my eBook collection in the past, I found myself ## 0.5.0 Patch Notes. -### Additional Dependencies -* gcc -- This will be installed by the new pre-installer script if its binary -is not detected at the arch distro default of /usr/bin/gcc - -All other distros should install via their systems package manager prior to +### Pre-req Dependencies +* gcc -- This will be installed by the new pre-installer script if its binary is not detected at /usr/bin/gcc +Users on distros other then Arch should install gcc via their systems package manager prior to running the installer. - +* Python3 +* pip ### New Features * Collections We are now categorizing your ebooks into collections based on the folder diff --git a/config.json b/config.json index 28132cf..44629f1 100755 --- a/config.json +++ b/config.json @@ -1 +1 @@ -{"TITLE": "pyShelf E-Book Server", "VERSION": "0.5.0", "BOOKPATH": "/home/raelon/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/create_db.sql b/create_db.sql new file mode 100755 index 0000000..b6c6d55 --- /dev/null +++ b/create_db.sql @@ -0,0 +1,3 @@ +CREATE USER pyshelf WITH PASSWORD 'pyshelf'; +CREATE DATABASE pyshelf; +GRANT ALL PRIVILEGES ON DATABASE pyshelf TO pyshelf; diff --git a/database.sh b/database.sh new file mode 100755 index 0000000..2cc4536 --- /dev/null +++ b/database.sh @@ -0,0 +1,13 @@ +#!/bin/bash +sudo -u postgres pg_ctl -D /var/lib/postgres/data -l /srv/logs/pgsql.log start && +sudo -u postgres psql -f create_db.sql && +rm /srv/http/database.sh && +echo "sudo -u postgres pg_ctl -D /var/lib/postgres/data -l /srv/logs/lgsql.log start" > /srv/http/database.sh && +chmod +x /srv/http/database.sh && +cd src && \ + python manage.py makemigrations && \ + python manage.py makemigrations interface && \ + python manage.py migrate && \ + python manage.py migrate interface && \ +cd .. +echo "pyShelf Env Started" diff --git a/entry.sh b/entry.sh new file mode 100755 index 0000000..25497f9 --- /dev/null +++ b/entry.sh @@ -0,0 +1,4 @@ +#!/bin/bash +#sh /srv/http/database.sh +sudo -u postgres pg_ctl -D /var/lib/postgres/data -l /srv/logs/pgsql.log start && +#gunicorn pyShelf.wsgi 8000:8000 diff --git a/requirements.txt b/requirements.txt index 89974a9..04cd48e 100755 --- a/requirements.txt +++ b/requirements.txt @@ -17,4 +17,4 @@ psycopg2-binary prompt_toolkit psutil pyfiglet -mobi-python +mobi-python \ No newline at end of file