Initial commit of BEMANI Utilities to GitHub.

This commit is contained in:
Jennifer Taylor
2019-12-08 21:43:49 +00:00
commit 74c0407173
490 changed files with 131920 additions and 0 deletions

5
examples/crontab Normal file
View File

@@ -0,0 +1,5 @@
www-data
*/5 * * * * /path/to/your/root/scheduler --config /path/to/your/root/server.yaml
root
5 0 * * * mysqldump -h localhost <database> --extended-insert=FALSE --result-file /path/to/backup/backup_$(date +"\%Y_\%m_\%d").sql

17
examples/install Executable file
View File

@@ -0,0 +1,17 @@
#! /bin/bash
# A utility that will install the latest version of the code in the repo
# to your virtualenv, run any upgrade scripts to update your production
# MySQL instance and then preload the JSX cache. Effectively, a one-liner
# to deploying a new version.
set -e
pushd /path/to/git/checkout
source /path/to/your/virtualenv/bin/activate
pip install --upgrade pip
pip install . -U --force-reinstall
./dbutils --config /path/to/your/root/server.yaml upgrade
deactivate
popd
sudo service uwsgi restart && ./preload

17
examples/nginx/api Normal file
View File

@@ -0,0 +1,17 @@
server {
server_name your-domain.com;
listen 9573 ssl;
server_tokens off;
gzip on;
gzip_types application/json;
gzip_min_length 1000;
ssl_certificate /path/to/certboot/your-domain.com/fullchain.pem;
ssl_certificate_key /path/to/certboot/your-domain.com/privkey.pem;
location / {
include uwsgi_params;
uwsgi_pass unix:/path/to/your/root/api.sock;
}
}

View File

@@ -0,0 +1,22 @@
server {
server_name your-domain.com;
listen 8573 ssl;
server_tokens off;
gzip on;
gzip_types text/html text/css text/plain application/javascript application/xml application/json;
gzip_min_length 1000;
ssl_certificate /path/to/certboot/your-domain.com/fullchain.pem;
ssl_certificate_key /path/to/certboot/your-domain.com/privkey.pem;
location / {
include uwsgi_params;
uwsgi_pass unix:/path/to/your/root/frontend.sock;
}
location ^~ /static/ {
include /etc/nginx/mime.types;
root /path/to/your/virtualenv/lib/python3.6/site-packages/bemani/frontend/;
}
}

9
examples/nginx/proxy Normal file
View File

@@ -0,0 +1,9 @@
server {
listen 80;
server_tokens off;
location / {
include uwsgi_params;
uwsgi_pass unix:/path/to/your/root/proxy.sock;
}
}

View File

@@ -0,0 +1,9 @@
server {
listen 573;
server_tokens off;
location / {
include uwsgi_params;
uwsgi_pass unix:/path/to/your/root/services.sock;
}
}

13
examples/preload Executable file
View File

@@ -0,0 +1,13 @@
#! /bin/bash
# A utility that hits your web frontend, causing the cache for JSX
# translations to be rendered. Call this after/during your installation
# so that the first web request after an installation doesn't need to
# warm the cache.
cd /path/to/your/virtualenv/lib/python3.6/site-packages/bemani/frontend/static
for url in $(find -name "*.react.js" | sed 's,^\.,https://your-domain.com/jsx,'); do
echo "Priming $url..."
curl $url --silent -H 'Cache-Control: no-cache' > /dev/null
done
echo "Done!"

6
examples/scheduler Executable file
View File

@@ -0,0 +1,6 @@
#! /bin/bash
# Version of the scheduler utility that can be called from a crontab.
# Place this in the root of your installation to run scheduled events.
source /path/to/your/virtualenv/bin/activate
python3 -m bemani.utils.scheduler "$@"

10
examples/uwsgi/api.ini Normal file
View File

@@ -0,0 +1,10 @@
[uwsgi]
plugins = python3
socket = /path/to/your/root/api.sock
processes = 4
threads = 2
virtualenv = /path/to/your/virtualenv
chdir = /path/to/your/root
wsgi-file = api.wsgi
callable = app

View File

@@ -0,0 +1,10 @@
[uwsgi]
plugins = python3
socket = /path/to/your/root/frontend.sock
processes = 4
threads = 2
virtualenv = /path/to/your/virtualenv
chdir = /path/to/your/root
wsgi-file = frontend.wsgi
callable = app

10
examples/uwsgi/proxy.ini Normal file
View File

@@ -0,0 +1,10 @@
[uwsgi]
plugins = python3
socket = /path/to/your/root/proxy.sock
processes = 4
threads = 2
virtualenv = /path/to/your/virtualenv
chdir = /path/to/your/root
wsgi-file = proxy.wsgi
callable = app

View File

@@ -0,0 +1,10 @@
[uwsgi]
plugins = python3
socket = /path/to/your/root/services.sock
processes = 4
threads = 2
virtualenv = /path/to/your/virtualenv
chdir = /path/to/your/root
wsgi-file = services.wsgi
callable = app