summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne@peacefrogs.net>2019-08-26 20:11:52 +0200
committerÉtienne Loks <etienne@peacefrogs.net>2019-08-26 20:13:37 +0200
commit6922d81fa5efe02a620e9e779a9c3ffbfc6c4eb8 (patch)
tree5c3eedf34e31511a20edd3a39b5275c59a0394e2
parent878ba9348c15860260462248446fda2cbbd7065c (diff)
downloadishtar-pergamon-6922d81fa5efe02a620e9e779a9c3ffbfc6c4eb8.tar.bz2
ishtar-pergamon-6922d81fa5efe02a620e9e779a9c3ffbfc6c4eb8.zip
Install instruction
-rw-r--r--.gitignore1
-rw-r--r--INSTALL.md38
-rw-r--r--Makefile.example3
-rw-r--r--collected_static/.collected_files0
-rw-r--r--conf/nginx.conf.template33
-rw-r--r--conf/uwsgi.ini.template17
-rw-r--r--pergamon/settings/base.py2
7 files changed, 93 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 1bf5b3c..56a5cd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,4 @@ package-lock.json
scss/custom.scss
scss/custom_post.scss
drassm_showcase/
+collected_static/
diff --git a/INSTALL.md b/INSTALL.md
new file mode 100644
index 0000000..886e45d
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,38 @@
+Installation
+============
+
+On a Debian Stretch installation:
+
+```bash
+SRV_PATH="/srv"
+VENV_PATH="/srv/venv"
+
+# main dependencies
+apt install python3 nginx git uwsgi uwsgi-plugin-python3 python3-virtualenv python3-pip
+
+# source code
+cd $SRV_PATH
+git clone https://gitlab.com/iggdrasil/ishtar-pergamon.git
+
+# virtualenv
+mkdir $VENV_PATH
+virtualenv --system-site-packages $VENV_PATH/pergamon
+. $VENV_PATH/pergamon/bin/activate
+pip install -r $SRV_PATH/ishtar-pergamon/requirements.txt
+
+cd $SRV_PATH/ishtar-pergamon
+# initialize the DB and the static files
+cp Makefile.example Makefile
+make collectstatic
+make migrate
+chown -R www-data:www-data media
+
+cp conf/nginx.conf.template /etc/nginx/sites-available/pergamon.conf
+vim /etc/nginx/sites-available/pergamon.conf
+ln -s /etc/nginx/sites-available/pergamon.conf /etc/nginx/sites-enabled/pergamon.conf
+
+cp conf/uwsgi.ini.template /etc/uwsgi/apps-available/pergamon.ini
+vim /etc/uwsgi/apps-available/pergamon.ini
+ln -s /etc/uwsgi/apps-available/pergamon.ini /etc/uwsgi/apps-enabled/pergamon.ini
+```
+
diff --git a/Makefile.example b/Makefile.example
index a8930ba..01b9363 100644
--- a/Makefile.example
+++ b/Makefile.example
@@ -43,3 +43,6 @@ makemessages: ## create messages to be translated
compilemessages: ## compile messages to be translated
$(PYTHON) manage.py compilemessages
+
+collectstatic: ## collect static files in the Django project to be served
+ $(PYTHON) manage.py collectstatic
diff --git a/collected_static/.collected_files b/collected_static/.collected_files
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/collected_static/.collected_files
diff --git a/conf/nginx.conf.template b/conf/nginx.conf.template
new file mode 100644
index 0000000..785bc57
--- /dev/null
+++ b/conf/nginx.conf.template
@@ -0,0 +1,33 @@
+server {
+ listen 80;
+ server_name #URL#;
+ root /srv/ishtar-pergamon/;
+ access_log /var/log/django/pergamon-access.log;
+ error_log /var/log/django/pergamon-error.log;
+
+ gzip on;
+ gzip_disable "msie6";
+ gzip_comp_level 6;
+ gzip_min_length 1100;
+ gzip_buffers 16 8k;
+ gzip_proxied any;
+ gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/rss+xml image/svg+xml;
+
+ location /static/ { # STATIC_URL
+ alias /srv/ishtar-pergamon/static/; # STATIC_ROOT
+ expires 30d;
+ }
+
+ location /media/ { # MEDIA_URL
+ alias /srv/ishtar-pergamon/media/; # MEDIA_ROOT
+ expires 30d;
+ }
+
+ location / {
+ include uwsgi_params;
+ uwsgi_pass unix:/var/lib/uwsgi/run/ishtar_pergamon.sock;
+ uwsgi_read_timeout 1800;
+ uwsgi_send_timeout 600;
+ }
+}
+
diff --git a/conf/uwsgi.ini.template b/conf/uwsgi.ini.template
new file mode 100644
index 0000000..2c06fad
--- /dev/null
+++ b/conf/uwsgi.ini.template
@@ -0,0 +1,17 @@
+[uwsgi]
+# variables
+projectname = pergamon
+projectdomain = #URL#
+base = /srv/ishtar-pergamon
+
+# config
+plugins = python
+master = true
+protocol = uwsgi
+env = DJANGO_SETTINGS_MODULE=%(projectname).settings
+pythonpath = %(base)
+module = %(projectname).wsgi
+socket = /var/lib/uwsgi/run/%(projectname).sock
+logto = /var/log/uwsgi/%(projectname).log
+daemonize = /var/log/uwsgi/daemon-%(projectname).log
+buffer-size=65535
diff --git a/pergamon/settings/base.py b/pergamon/settings/base.py
index 6af0b03..488a9d3 100644
--- a/pergamon/settings/base.py
+++ b/pergamon/settings/base.py
@@ -149,7 +149,7 @@ STATICFILES_DIRS = [
# See https://docs.djangoproject.com/en/2.2/ref/contrib/staticfiles/#manifeststaticfilesstorage
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
-STATIC_ROOT = os.path.join(BASE_DIR, 'static')
+STATIC_ROOT = os.path.join(BASE_DIR, 'collected_static')
STATIC_URL = '/static/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')