add configuration for nginx/supervisor, add run.sh

This commit is contained in:
makefu 2013-11-19 10:10:04 +01:00
parent cb81b44a27
commit 3f1714ab7d
5 changed files with 30 additions and 9 deletions

View file

@ -12,6 +12,5 @@ It is written as a replacement for the gorgeous sprunge.us
## Startup
. bin/activate
cd bump
gunicorn -b 127.0.0.1:4000 init:app
./run.sh

View file

@ -6,6 +6,9 @@ import os
app = Flask(__name__)
storedir = os.path.join(app.root_path, 'store')
app.config['storedir'] = storedir
print("Storedir is %s" % storedir)
if not os.path.isdir(storedir):
os.mkdir(storedir)
def returns_plain(f):
@ -84,9 +87,4 @@ def generate_key():
if __name__ == "__main__":
app.debug = True
print("Storedir is %s" % storedir)
try:
os.mkdir(storedir)
except:
pass
app.run(host='0.0.0.0')

14
etc/bump.nginx.conf Normal file
View file

@ -0,0 +1,14 @@
server {
listen [::]:80;
server_name _;
access_log /var/log/nginx/log/note.log main;
error_log /var/log/nginx/log/note_error.log;
default_type text/plain;
location / {
proxy_pass http://127.0.0.1:4000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

5
etc/bump.supervisor.conf Normal file
View file

@ -0,0 +1,5 @@
[program:bump]
command=sh run.sh
user=note
directory=/opt/bump
autorestart=true

5
run.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
set -ef
. bin/activate
cd bump
gunicorn -b 127.0.0.1:4000 init:app