-
Create a new user on the system:
adduser --system --group --shell /bin/sh --home /opt/localshop localshop
-
Clone localshop into /opt/localshop. (as of writing this README, localshop is outdated on pypi)
-
Create the virualenv and install the required packages:
cd /opt/localshop virtualenv .venv source .venv/bin/activate pip install --pre -r requirements.txt
-
Place the upstart configs in /etc/init.
-
Initialize localshop:
cd /opt/localshop source .venv/bin/activate export LOCALSHOP_HOME=/opt/localshop python manage.py init
Last active
December 23, 2015 19:39
-
-
Save jalaziz/6684180 to your computer and use it in GitHub Desktop.
Localshop upstart and nginx configs -- WIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Localshop Celery" | |
start on started localshop | |
stop on stopping localshop | |
respawn limit 10 5 | |
chdir /opt/localshop | |
setuid localshop | |
env VIRTUAL_ENV=/opt/localshop/.venv | |
env PYTHONUNBUFFERED=True | |
env LOCALSHOP_HOME=/opt/localshop | |
exec $VIRTUAL_ENV/bin/localshop celery worker --no-execv -B -E --loglevel=info >> /var/log/localshop/celery.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Localshop Web" | |
start on started localshop | |
stop on stopping localshop | |
respawn limit 10 5 | |
chdir /opt/localshop | |
setuid localshop | |
env VIRTUAL_ENV=/opt/localshop/.venv | |
env PYTHONUNBUFFERED=True | |
env LOCALSHOP_HOME=/opt/localshop | |
exec $VIRTUAL_ENV/bin/gunicorn localshop.wsgi:application -R -b localhost:8000 -w 2 -k gevent --error-logfile ->> /var/log/localshop/web.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Localshop" | |
pre-start script | |
mkdir -p /var/log/localshop | |
chown -R localshop /var/log/localshop | |
end script | |
start on runlevel [2345] | |
stop on runlevel [016] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name pypi.jalaziz.io; | |
location / { | |
rewrite ^ https://$server_name$request_uri permanent; | |
} | |
} | |
server { | |
listen 443 ssl; | |
server_name pypi.jalaziz.io; | |
charset utf-8; | |
access_log /var/log/nginx/localshop.access.log; | |
error_log /var/log/nginx/localshop.error.log; | |
location /assets/ { | |
alias /opt/localshop/assets/; | |
} | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://localhost:8000; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment