MikroWizard Initial commit | MikroMan Welcome to the world :)

This commit is contained in:
sepehr 2024-07-20 15:48:46 +03:30
commit 8c49b9a55d
96 changed files with 12274 additions and 0 deletions

BIN
conf/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

9
conf/loginscript.sh Normal file
View file

@ -0,0 +1,9 @@
# this is /etc/profile
# - a login script when running the interactive shell inside the container
export PYTHONPATH=/app/py
export PYSRV_CONFIG_PATH=/app/conf/real-server-config.json
export FLASK_ENV=development
alias l='ls'
alias ll='ls -l'

27
conf/pydaemon.service Normal file
View file

@ -0,0 +1,27 @@
# systemd service configuration - uwsgi daemon
#
# https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files
# https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04
# make start on boot: systemctl enable mydaemon
[Unit]
Description=pysrv uwsgi daemon
After=network.target
[Service]
User=root
#User=myapp # user privileges are set by uwsgi
#Group=mygroup
# note: create /tmp/pysrv_spooler on reboot
ExecStartPre=/bin/mkdir -p /tmp/pysrv_spooler;
ExecStart=/usr/local/bin/uwsgi --ini /app/conf/uwsgi.ini:uwsgi-production
RuntimeDirectory=mydaemon
Restart=always
RestartSec=3
KillSignal=SIGQUIT
[Install]
WantedBy=multi-user.target

3
conf/robots.txt Normal file
View file

@ -0,0 +1,3 @@
User-agent: *
Disallow: /

19
conf/server-config.json Normal file
View file

@ -0,0 +1,19 @@
{
"name": "python server config template - rename me",
"PYSRV_IS_PRODUCTION": "",
"PYSRV_DATABASE_HOST": "/app/data/mydb.sqlite",
"PYSRV_DATABASE_HOST_POSTGRESQL": "host.docker.internal",
"PYSRV_DATABASE_HOST_SQLITE": "/app/data/mydb.sqlite",
"PYSRV_DATABASE_PORT": "54320",
"PYSRV_DATABASE_NAME": "tmdb",
"PYSRV_DATABASE_USER": "tm",
"PYSRV_DATABASE_PASSWORD": "MY_PASSWORD",
"PYSRV_COOKIE_HTTPS_ONLY": false,
"PYSRV_REDIS_HOST": "host.docker.internal:6379",
"PYSRV_DOMAIN_NAME": "",
"PYSRV_CORS_ALLOW_ORIGIN": "*"
}

73
conf/uwsgi.ini Normal file
View file

@ -0,0 +1,73 @@
# uwsgi daemon config
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html
# old: local dev - plain python, no docker
[uwsgi-docker-dev]
env = FLASK_ENV=development
env = PYSRV_CONFIG_PATH=/conf/server-conf.json
http = host.docker.internal:8181
master = 1
wsgi-file = py/main.py
callable = app
# processes = 1, otherwise autoreload fails
processes = 4
chdir = /app/
pythonpath = /app/py/
stats = 127.0.0.1:9100
#virtualenv = $(SERVER_VIRTUALENV)
py-autoreload = 1
#harakiri=10 - disable locally, otherwise autoreload fails
disable-logging=1
spooler-quiet=1
spooler-processes=6
spooler-frequency=5
spooler-harakiri=600
spooler = /tmp/my_spooler
socket-timeout = 60
# few static files - serve the frontend from elsewhere
static-map = /robots.txt=conf/robots.txt
static-map = /favicon.ico=conf/favicon.ico
mule = py/mules/radius.py
mule = py/mules/data_grabber.py
mule = py/mules/syslog.py
mule = py/mules/updater.py
mule = py/mules/firmware.py
[uwsgi-production]
env = FLASK_ENV=production
env = PYSRV_CONFIG_PATH=/conf/server-conf.json
http = host.docker.internal:8181
master = 1
wsgi-file = py/main.py
callable = app
# processes = 1, otherwise autoreload fails
processes = 4
chdir = /app/
pythonpath = /app/py/
#stats = 127.0.0.1:9100
#virtualenv = $(SERVER_VIRTUALENV)
#py-autoreload = 1
#harakiri=10 - disable locally, otherwise autoreload fails
enable-threads = true
vacuum = true
disable-logging=1
spooler-quiet=1
spooler-processes=6
spooler-frequency=5
spooler-harakiri=600
spooler = /tmp/my_spooler
logger = stdio
logto = /app/uwsgi-@(exec://date +%%Y-%%m-%%d).log
log-maxsize = 104857600
socket-timeout = 60
# few static files - serve the frontend from elsewhere
static-map = /robots.txt=conf/robots.txt
static-map = /favicon.ico=conf/favicon.ico
mule = py/mules/radius.py
mule = py/mules/data_grabber.py
mule = py/mules/syslog.py
mule = py/mules/updater.py
mule = py/mules/firmware.py