Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] #17 Deploy Script #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions broadway-on-demand.service
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will create and activate a virtualenv, but I'm pretty sure Gunicorn won't use it and will still need dependencies installed system-wide.


# 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