update system integration and readme
This commit is contained in:
parent
e0568e4b64
commit
91dee6d2b4
5 changed files with 44 additions and 47 deletions
|
@ -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
|
git clone https://git.0x2620.org/oxdata.git
|
||||||
cd oxdata
|
cd oxdata
|
||||||
virtualenv --system-site-packages .
|
virtualenv -p /usr/bin/python3 --system-site-packages .
|
||||||
./bin/pip install -r requirements.txt
|
./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:
|
Install rabbitmq and carrot:
|
||||||
sudo apt-get install rabbitmq-server
|
sudo apt-get install rabbitmq-server
|
|
@ -5,28 +5,29 @@ server {
|
||||||
access_log /var/log/nginx/oxdata.access.log;
|
access_log /var/log/nginx/oxdata.access.log;
|
||||||
|
|
||||||
location /admin/media {
|
location /admin/media {
|
||||||
root __PREFIX__/src/django/django/contrib;
|
root /srv/oxdata/lib/python3.5/site-packages/django/contrib;
|
||||||
autoindex on;
|
autoindex on;
|
||||||
}
|
}
|
||||||
location /favicon.ico {
|
location /favicon.ico {
|
||||||
root __PREFIX__/oxdata/static;
|
root /srv/oxdata/oxdata/static;
|
||||||
}
|
}
|
||||||
location /robots.txt {
|
location /robots.txt {
|
||||||
root __PREFIX__/oxdata/static;
|
root /srv/oxdata/oxdata/static;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /static {
|
location /static {
|
||||||
root __PREFIX__/oxdata;
|
root /srv/oxdata/oxdata;
|
||||||
autoindex on;
|
autoindex on;
|
||||||
}
|
}
|
||||||
location /media/ {
|
location /media/ {
|
||||||
internal;
|
internal;
|
||||||
root __PREFIX__/oxdata/;
|
root /srv/oxdata/oxdata/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Forwarded-Proto http;
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
|
|
||||||
if (!-f $request_filename) {
|
if (!-f $request_filename) {
|
||||||
|
@ -35,8 +36,9 @@ server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error_page 404 /404.html;
|
error_page 404 /404.html;
|
||||||
|
error_page 403 /404.html;
|
||||||
location /404.html {
|
location /404.html {
|
||||||
root __PREFIX__/oxdata/static;
|
root /srv/oxdata/oxdata/static;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
23
etc/systemd/system/oxdata.service
Normal file
23
etc/systemd/system/oxdata.service
Normal 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
|
2
etc/tmpfiles.d/oxdata.conf
Normal file
2
etc/tmpfiles.d/oxdata.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
d /run/oxdata 0755 oxdata oxdata -
|
||||||
|
d /var/log/oxdata 0755 oxdata oxdata -
|
|
@ -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
|
|
Loading…
Reference in a new issue