Compare commits

...

4 Commits

7 changed files with 58 additions and 8 deletions

1
description Normal file
View File

@ -0,0 +1 @@
Track fear and phase in multiplayer games of the board game Spirit Island.

View File

@ -0,0 +1,16 @@
# Based on https://docs.gunicorn.org/en/stable/deploy.html#systemd
[Service]
ExecStart=/usr/bin/gunicorn3 fear_tracker_site.asgi:application --config=/home/anyoneeb/sites/apps/fear-tracker/gnuicorn.conf.py
ExecReload=/bin/kill -s HUP $MAINPID
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=fear-tracker
User=fear-tracker
Group=fear-tracker
KillMode=mixed
PrivateTmp=true
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,11 @@
[Service]
ExecStart=/usr/bin/uwsgi --ini /home/anyoneeb/sites/apps/fear-tracker/uwsgi.ini
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=fear-tracker
User=fear-tracker
Group=fear-tracker
[Install]
WantedBy=multi-user.target

View File

@ -10,13 +10,12 @@ from asgiref.sync import async_to_sync
from channels.generic.http import AsyncHttpConsumer from channels.generic.http import AsyncHttpConsumer
from channels.layers import get_channel_layer from channels.layers import get_channel_layer
from django.conf import settings
from django.db import transaction from django.db import transaction
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
from django.views.decorators.http import require_safe, require_http_methods,\ from django.views.decorators.http import require_safe, require_http_methods,\
require_POST require_POST
from django.urls import reverse, set_script_prefix from django.urls import reverse
from .forms import NewGameForm, JoinGameForm, PlayerFormSet from .forms import NewGameForm, JoinGameForm, PlayerFormSet
from .models import Game, Player, Fear from .models import Game, Player, Fear
@ -388,12 +387,6 @@ class StatusLongPollConsumer(AsyncHttpConsumer):
}) })
async def fear_tracker_invalidate_status(self, event): async def fear_tracker_invalidate_status(self, event):
# get script_prefix for reverse()
script_prefix = self.scope.get("root_path", "") or ""
if settings.FORCE_SCRIPT_NAME:
script_prefix = settings.FORCE_SCRIPT_NAME
set_script_prefix(script_prefix)
no_hash_status = reverse('status', no_hash_status = reverse('status',
kwargs={'access_code': self.access_code}) kwargs={'access_code': self.access_code})
await self.send_response(302, b'', headers=[ await self.send_response(302, b'', headers=[

14
gnuicorn.conf.py Normal file
View File

@ -0,0 +1,14 @@
import multiprocessing
bind = "127.0.0.1:8043"
worker_class = "uvicorn.workers.UvicornWorker"
workers = multiprocessing.cpu_count() * 2 + 1
chdir = "/home/anyoneeb/sites/apps/fear-tracker"
raw_env = "DJANGO_SETTINGS_MODULE=fear_tracker_site.local_settings"
proc_name = "gnuicorn-fear-tracker"
pidfile = "/tmp/gnuicorn-fear-tracker.pid"
user = "fear-tracker"
group = "fear-tracker"
max_requests=5000
max_requests_jitter=100
preload_app=True

1
source Normal file
View File

@ -0,0 +1 @@
https://git.aweirdimagination.net/perelman/fear_tracker

14
uwsgi.ini Normal file
View File

@ -0,0 +1,14 @@
[uwsgi]
socket=127.0.0.1:8043
mount = /fear-tracker=fear_tracker_site.wsgi:application
manage-script-name = true
chdir=/home/anyoneeb/sites/apps/fear-tracker
plugin=python3
module=fear_tracker_site.wsgi:application
env=DJANGO_SETTINGS_MODULE=fear_tracker_site.local_settings
master=True
pidfile=/tmp/fear-tracker-master.pid
vacuum=True
max-requests=5000
uid=fear-tracker
gid=fear-tracker