diff --git a/broadway-on-demand.service b/broadway-on-demand.service new file mode 100644 index 0000000..629c1ee --- /dev/null +++ b/broadway-on-demand.service @@ -0,0 +1,13 @@ +[Unit] +Description=Gunicorn for Broadway on Demand +After=network.target + +[Service] +User=root +Group=root +WorkingDirectory=/srv/broadway-on-demand +Environment=/srv/broadway-on-demand/src/venv/bin +ExecStart=/srv/broadway-on-demand/src/venv/bin/gunicorn --workers 4 --bind 127.0.0.1:4000 src:app + +[Install] +WantedBy=multi-user.target diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..97081cd --- /dev/null +++ b/install.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# NEED TO RUN AS ROOT + +INSTALL_DIR="/srv" +VENV_NAME="venv" + +# Install python and related packages +apt-get install python3 python3-venv + +# Default location for broadway-on-demand is /srv +cp -r . $INSTALL_DIR/broadway-on-demand/ +cd $INSTALL_DIR/broadway-on-demand/ + +# Setup venv +cd src/ +python3 -m venv ./$VENV_NAME +source ./$VENV_NAME/bin/activate + +# Install python dependencies +python3 -m pip install -r requirements.txt +python3 -m pip install gunicorn + +# Setup config file +# CHANGE THIS +# cp sample_config.py config.py + +# Setup systemd service +cd .. +cp broadway-on-demand.service /etc/systemd/system/ +systemctl enable broadway-on-demand +systemctl start broadway-on-demand