Improve the readme with update and deployment tips
This commit is contained in:
parent
8e253993e7
commit
1f7c9d511f
1 changed files with 104 additions and 1 deletions
105
README.md
105
README.md
|
@ -14,7 +14,7 @@
|
||||||
git clone https://git.khaganat.net/Tycho/khaganat-web.git khaganat-web
|
git clone https://git.khaganat.net/Tycho/khaganat-web.git khaganat-web
|
||||||
cd khaganat-web
|
cd khaganat-web
|
||||||
vim .env
|
vim .env
|
||||||
pipenv --three --update
|
PIPENV_VENV_IN_PROJECT=1 pipenv --three update
|
||||||
pipenv run ./manage.py migrate
|
pipenv run ./manage.py migrate
|
||||||
pipenv run ./manage.py collectstatic
|
pipenv run ./manage.py collectstatic
|
||||||
pipenv run ./manage.py compilemessages
|
pipenv run ./manage.py compilemessages
|
||||||
|
@ -57,3 +57,106 @@ You can set the following variables in the `.env` file:
|
||||||
* `KHAGANAT_HTTPS_HEADER_VALUE`: Header value for `SECURE_PROXY_SSL_HEADER`, default is `https`.
|
* `KHAGANAT_HTTPS_HEADER_VALUE`: Header value for `SECURE_PROXY_SSL_HEADER`, default is `https`.
|
||||||
* `KHAGANAT_NSFW_TAGS`: Coma-separated list of words that triggers the content warning in logs, default is `\#nsfw`.
|
* `KHAGANAT_NSFW_TAGS`: Coma-separated list of words that triggers the content warning in logs, default is `\#nsfw`.
|
||||||
* `KHAGANAT_NSFW_NAME`: Name of the cookie holding the NSFW allowance, default is `nsfw_allowed`.
|
* `KHAGANAT_NSFW_NAME`: Name of the cookie holding the NSFW allowance, default is `nsfw_allowed`.
|
||||||
|
|
||||||
|
|
||||||
|
## Quick update
|
||||||
|
|
||||||
|
```
|
||||||
|
cd khaganat-web
|
||||||
|
git pull
|
||||||
|
pipenv --three update
|
||||||
|
pipenv run ./manage.py migrate
|
||||||
|
pipenv run ./manage.py collectstatic
|
||||||
|
pipenv run ./manage.py compilemessages
|
||||||
|
```
|
||||||
|
|
||||||
|
Then restart the WSGI server.
|
||||||
|
|
||||||
|
|
||||||
|
## Nginx + uWSGI on ArchLinux
|
||||||
|
|
||||||
|
Install `nginx-mainline`, `uwsgi` and `uwsgi-plugin-python`.
|
||||||
|
|
||||||
|
```
|
||||||
|
# mkdir -p /srv/http/khaganat/static
|
||||||
|
# cd /srv/http/khaganat
|
||||||
|
# git clone https://git.khaganat.net/Tycho/khaganat-web.git app
|
||||||
|
# cd app
|
||||||
|
# PIPENV_VENV_IN_PROJECT=1 pipenv --three update
|
||||||
|
```
|
||||||
|
|
||||||
|
Create `/etc/uwsgi/khaganat.ini` with the appropriate environment variables:
|
||||||
|
|
||||||
|
```
|
||||||
|
[uwsgi]
|
||||||
|
chdir = /srv/http/khaganat/app
|
||||||
|
home = /srv/http/khaganat/app/.venv
|
||||||
|
module = khaganat.wsgi:application
|
||||||
|
plugins = python
|
||||||
|
socket = /srv/http/khaganat/uwsgi.sock
|
||||||
|
uid = http
|
||||||
|
gid = http
|
||||||
|
threads = 2
|
||||||
|
vacuum = True
|
||||||
|
env = KHAGANAT_SECRET_KEY="generate a new one"
|
||||||
|
env = KHAGANAT_DEBUG=False
|
||||||
|
env = KHAGANAT_STATIC_ROOT=/srv/http/khaganat/static
|
||||||
|
env = KHAGANAT_HOSTNAMES=khaganat.local
|
||||||
|
```
|
||||||
|
|
||||||
|
Create `/etc/systemd/system/multi-user.target.wants/uwsgi@khaganat.service` :
|
||||||
|
|
||||||
|
```
|
||||||
|
[Unit]
|
||||||
|
Description=uWSGI service unit
|
||||||
|
After=syslog.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/uwsgi --ini /etc/uwsgi/%I.ini
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
ExecStop=/bin/kill -INT $MAINPID
|
||||||
|
Restart=always
|
||||||
|
Type=notify
|
||||||
|
StandardError=syslog
|
||||||
|
NotifyAccess=all
|
||||||
|
KillSignal=SIGQUIT
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
Configure nginx :
|
||||||
|
|
||||||
|
```
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name "khaganat.local";
|
||||||
|
|
||||||
|
include custom/headers.conf;
|
||||||
|
|
||||||
|
location /static {
|
||||||
|
root /srv/http/khaganat/;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
uwsgi_pass unix:///srv/http/khaganat/uwsgi.sock;
|
||||||
|
include uwsgi_params;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Finish the installation:
|
||||||
|
|
||||||
|
```
|
||||||
|
# cd /srv/http/khaganat/app
|
||||||
|
# pipenv run ./manage.py migrate
|
||||||
|
# pipenv run ./manage.py collectstatic
|
||||||
|
# pipenv run ./manage.py compilemessages
|
||||||
|
# pipenv run ./manage.py createsuperuser
|
||||||
|
# chown -R http:http /srv/http/khaganat/
|
||||||
|
# systemctl enable uwsgi@khaganat.service
|
||||||
|
# systemctl start uwsgi@khaganat.service
|
||||||
|
# systemctl enable nginx.service
|
||||||
|
# systemctl start nginx.service
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue