Files
doczyai-pipelines/streamlit-server/user_data.sh
T

26 lines
698 B
Bash

#!/bin/bash
echo '${file("${path.module}/requirements.txt")}' > /tmp/requirements.txt
apt-get update
apt-get install -y python3 python3-pip
pip3 install $(cat /tmp/requirements.txt)
# Create a basic systemd service
cat <<EOT > /etc/systemd/system/streamlit-ui0.service
[Unit]
Description=Streamlit Server Service
[Service]
User=ubuntu
Type=simple
Restart=always
WorkingDirectory=/home/ubuntu/streamlit/doczy.ai/streamlit
ExecStart=/home/ubuntu/.local/bin/streamlit run /home/ubuntu/streamlit/doczy.ai/streamlit/interface_0.py --server.port 8500
[Install]
WantedBy=multi-user.target
EOT
# Enable and start the service
systemctl enable streamlit-ui0.service
systemctl start streamlit-ui0.service