borrow my premade easy-deploy stuff

main
Matt C 2 years ago
parent 21b8deb5a0
commit f08701a168

@ -0,0 +1,20 @@
test:
python3 app.py
pip:
sudo pip3 install -r requirements.txt
deploy: pip
cp sample.service new.service
# yes, this exists because I'm too lazy to escape regex + inline 'sed'
python3 sed.py
sudo mv new.service /etc/systemd/system/simplefeedback.service
sudo systemctl daemon-reload
sudo systemctl enable --now simplefeedback.service
undeploy:
sudo systemctl stop simplefeedback.service
sudo systemctl disable simplefeedback.service
sudo rm /etc/systemd/system/simplefeedback.service
sudo systemctl daemon-reload
update:
make undeploy
git pull
make deploy

@ -0,0 +1,13 @@
[Unit]
Description=SimpleFeedback gunicorn service
[Service]
# WHO is edited by sed.py to become the current user
User=WHO
Type=simple
# GCPATH is edited by sed.py to point to the user's installation of gunicorn
# PATH becomes the output of `pwd`
ExecStart=GCPATH --chdir PATH --workers=8 --bind=0.0.0.0:6969 app:app
[Install]
WantedBy=multi-user.target

@ -0,0 +1,18 @@
import os, subprocess, getpass
# Feel free to edit this file, but note that `make deploy` expects the service file to be output as `new.service`
# It, of course, is renamed to `localizer.service` as it's moved to `/etc/systemd/system/`
text = open("new.service").read()
text = text.replace(
"GCPATH",
subprocess.check_output(["/usr/bin/bash", "-c", "which gunicorn"])
.decode("utf-8")
.strip(),
)
text = text.replace("PATH", os.getcwd())
text = text.replace("WHO", getpass.getuser())
os.remove("new.service")
with open("new.service", "w") as f:
f.write(text)

@ -1,5 +1,5 @@
app_dist: "Crystal Linux"
camp_extra: "Please note that this particular event is only able to ship to the US and Canada."
host: "0.0.0.0"
port: 9090
port: 6969
debug: true
Loading…
Cancel
Save