From 2f1914c3db2697e81e272e8e794c8a9eb05e7adb Mon Sep 17 00:00:00 2001 From: j Date: Tue, 19 Dec 2017 10:47:06 +0100 Subject: [PATCH] add gunicorn and deployment files --- etc/apache2/sites-available/studio.camp.conf | 42 ++++++++++++++++++++ etc/init/camp.conf | 12 ++++++ etc/systemd/system/camp.service | 14 +++++++ requirements.txt | 1 + 4 files changed, 69 insertions(+) create mode 100644 etc/apache2/sites-available/studio.camp.conf create mode 100644 etc/init/camp.conf create mode 100644 etc/systemd/system/camp.service diff --git a/etc/apache2/sites-available/studio.camp.conf b/etc/apache2/sites-available/studio.camp.conf new file mode 100644 index 0000000..4123a0c --- /dev/null +++ b/etc/apache2/sites-available/studio.camp.conf @@ -0,0 +1,42 @@ + + ServerName studio.camp + Redirect / https://studio.camp/ + + + + SSLCertificateFile /etc/letsencrypt/studio.camp/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/studio.camp/key.pem + Include /etc/letsencrypt/options-ssl-apache.conf + SSLCertificateChainFile /etc/letsencrypt/studio.camp/chain.pem + + ServerName studio.camp + + + Options -Indexes + + + Order deny,allow + Allow from all + + + Alias /static /srv/camp/static + Alias /images /srv/camp/data/images + + LogLevel warn + ErrorLog /var/log/apache2/studio.camp.error.log + CustomLog /var/log/apache2/studio.camp.log combined + ServerSignature Off + + ProxyRequests Off + + Order deny,allow + Allow from all + + ProxyPass /static ! + ProxyPass /images ! + + RequestHeader unset Proxy + + ProxyPass / http://127.0.0.1:8087/ + ProxyPassReverse / http://127.0.0.1:8087/ + diff --git a/etc/init/camp.conf b/etc/init/camp.conf new file mode 100644 index 0000000..1200f17 --- /dev/null +++ b/etc/init/camp.conf @@ -0,0 +1,12 @@ +start on (filesystem and net-device-up IFACE=lo) +stop on runlevel [!2345] + +# give time to send info to trackers +kill timeout 30 + +setuid campdjango +setgid campdjango + +respawn +chdir /srv/camp +exec /srv/camp/venv/bin/gunicorn -b 127.0.0.1:8087 camp.wsgi:application diff --git a/etc/systemd/system/camp.service b/etc/systemd/system/camp.service new file mode 100644 index 0000000..1e364ae --- /dev/null +++ b/etc/systemd/system/camp.service @@ -0,0 +1,14 @@ +[Unit] +Description=studio.camp +After=postgresql.service + +[Service] +Type=simple +Restart=always +User=campdjango +Group=campdjango +WorkingDirectory=/srv/camp +ExeccStart=/srv/camp/venv/bin/gunicorn -b 127.0.0.1:8087 camp.wsgi:application + +[Install] +WantedBy=multi-user.target diff --git a/requirements.txt b/requirements.txt index 2ad491e..918e32c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,4 @@ django-photologue django-braces django-app-namespace-template-loader ox +gunicorn