From b27ef2b0c1f230beac096f2168ba11ca9ea5f982 Mon Sep 17 00:00:00 2001 From: Raelon Masters Date: Tue, 7 Apr 2020 10:00:25 -0400 Subject: [PATCH] Reinclude create_db.sql --- .gitignore | 1 - Dockerfile | 7 +++++-- create_db.sql | 1 + installer | 3 --- 4 files changed, 6 insertions(+), 6 deletions(-) create mode 100755 create_db.sql 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 index 482b124..ad2c704 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,19 @@ FROM archlinux:latest RUN pacman -Syy RUN pacman -Syu --noconfirm -RUN pacman -S --noconfirm python python-pip git openssh +RUN pacman -S --noconfirm python python-pip git openssh postgresql +RUN sudo -u postgres initdb --locale=en_US.UTF-8 -E UTF8 -D /var/lib/postgres/data +RUN systemctl enable postgresql && systemctl start postgresql RUN useradd pyshelf && chpasswd pyshelf:pyshelf RUN mkdir -p /srv/Books && mkdir -p /srv/http && \ chown -R http.pyshelf /srv/Books && chown -R http.pyshelf /srv/http -RUN systemctl enable sshd +RUN systemctl enable sshd && systemctl start sshd VOLUME ['/srv/Books','/srv/http'] ENV nginx_conf /etc/nginx/nginx.conf ENV PYTHONUNBUFFERED 1 WORKDIR /srv/http RUN git clone https://github.com/th3r00t/pyShelf.git /srv/http && \ git checkout 0.5.0--docker && pip install -r requirements.txt +RUN sudo -u postgres psql -f create_db.sql EXPOSE 80 22 8000 RUN gunicorn pyShelf.wsgi 8000:8000 diff --git a/create_db.sql b/create_db.sql new file mode 100755 index 0000000..9308ad0 --- /dev/null +++ b/create_db.sql @@ -0,0 +1 @@ +CREATE DATABASE 'pyshelf'; CREATE USER 'pyshelf' WITH PASSWORD 'pyshelf'; GRANT ALL PRIVILEGES ON DATABASE 'pyshelf' TO 'pyshelf'; diff --git a/installer b/installer index 6a8a36a..0aeea91 100755 --- a/installer +++ b/installer @@ -307,9 +307,6 @@ if RequiredServices().db_server_found(req) is False: # sql_user = config["USER"] sql_user = "pyshelf" db_name = "pyshelf" - import pudb - - pudb.set_trace() psql_cmd = ( "CREATE DATABASE %s; CREATE USER %s WITH PASSWORD '%s'; GRANT ALL PRIVILEGES ON DATABASE %s TO %s;" % (db_name, sql_user, sql_pass, db_name, sql_user)