Skip to content

Instantly share code, notes, and snippets.

@initcron
Last active September 23, 2024 08:22
Show Gist options
  • Save initcron/c0f864f36e0f5f1daaa6dc88b0108e65 to your computer and use it in GitHub Desktop.
Save initcron/c0f864f36e0f5f1daaa6dc88b0108e65 to your computer and use it in GitHub Desktop.
Install Script for Craftista Ctalogue - Python Flast App
#!/bin/bash
apt update
apt upgrade -y
apt install -y python3 python3-pip python3-venv
update-alternatives --install /usr/bin/python python /usr/bin/python3 1
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
cd /opt/
git clone https://github.com/xxxxx/craftista.git
cd craftista/catalogue/
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
chown -R www-data:www-data /opt/craftista/catalogue
cat <<EOF > /etc/systemd/system/catalogue.service
[Unit]
Description=Craftista Catalogue Application
After=network.target
[Service]
User=www-data
Group=www-data
WorkingDirectory=/opt/craftista/catalogue
ExecStart=/opt/craftista/catalogue/venv/bin/gunicorn app:app --bind 0.0.0.0:5000
Restart=always
Environment="PATH=/opt/craftista/catalogue/venv/bin"
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start catalogue.service
systemctl enable catalogue.service
systemctl status catalogue.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment