update system integration and readme

This commit is contained in:
j 2016-09-07 17:20:13 +02:00
parent e0568e4b64
commit 91dee6d2b4
5 changed files with 44 additions and 47 deletions

View file

@ -1,19 +1,19 @@
To setup a local instance of oxdata:
# oxdata
django based api server
## setup
apt-get install virtualenv git ipython3
apt-get install python3-pil python3-psycopg2 \
python3-lxml python3-requests python3-six
git clone https://git.0x2620.org/oxdata.git
cd oxdata
virtualenv --system-site-packages .
virtualenv -p /usr/bin/python3 --system-site-packages .
./bin/pip install -r requirements.txt
you need python, git, pip and virtualenv:
apt-get install python-setuptools git
east_install pip
pip install virtualenv
oxdata uses system python modules, so make sure you have
ipython and psycopg2 installed via apt-get/pip/easy_install
in your system path.
Install rabbitmq and carrot:
sudo apt-get install rabbitmq-server

View file

@ -5,28 +5,29 @@ server {
access_log /var/log/nginx/oxdata.access.log;
location /admin/media {
root __PREFIX__/src/django/django/contrib;
root /srv/oxdata/lib/python3.5/site-packages/django/contrib;
autoindex on;
}
location /favicon.ico {
root __PREFIX__/oxdata/static;
root /srv/oxdata/oxdata/static;
}
location /robots.txt {
root __PREFIX__/oxdata/static;
root /srv/oxdata/oxdata/static;
}
location /static {
root __PREFIX__/oxdata;
root /srv/oxdata/oxdata;
autoindex on;
}
location /media/ {
internal;
root __PREFIX__/oxdata/;
root /srv/oxdata/oxdata/;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto http;
proxy_redirect off;
if (!-f $request_filename) {
@ -35,8 +36,9 @@ server {
}
}
error_page 404 /404.html;
error_page 403 /404.html;
location /404.html {
root __PREFIX__/oxdata/static;
root /srv/oxdata/oxdata/static;
}
}

View file

@ -0,0 +1,23 @@
[Unit]
Description=oxdata daemon
[Service]
Type=simple
Restart=always
User=oxdata
Group=oxdata
PIDFile=/run/oxdata/oxdata.pid
WorkingDirectory=/srv/oxdata/oxdata
StandardOutput=syslog
StandardError=syslog
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/srv/oxdata/bin/gunicorn \
wsgi:application \
-p /run/oxdata/oxdata.pid \
--bind 0.0.0.0:8087 \
--workers 5 \
--max-requests 1000 \
--log-level info
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,2 @@
d /run/oxdata 0755 oxdata oxdata -
d /var/log/oxdata 0755 oxdata oxdata -

View file

@ -1,30 +0,0 @@
# oxdata gunicorn daemon
#
description "oxdata daemon"
start on runlevel [2345]
stop on runlevel [!2345]
kill timeout 5
respawn
env VENV=/srv/oxdata
env USER=oxdata
env HOME=/home/oxdata
pre-start script
test -e /var/log/oxdata || (mkdir -p /var/log/oxdata && chown $USER:$USER /var/log/oxdata)
test -e /var/run/oxdata || (mkdir -p /var/run/oxdata && chown $USER:$USER /var/run/oxdata)
end script
exec start-stop-daemon \
--pidfile /var/run/oxdata/oxdata.pid \
--start -c $USER -d $VENV/oxdata \
--exec $VENV/bin/gunicorn -- \
wsgi:application \
--bind 127.0.0.1:8087 \
--workers 5 \
--max-requests 1000 \
--log-file /var/log/oxdata/oxdata.log \
--pidfile /var/run/oxdata/oxdata.pid \
--log-level info