Creating new server, resuing same AMI from previous TF streamlit instance

This commit is contained in:
Umang Mistry
2024-05-17 13:32:34 -05:00
parent 851b6f6a47
commit 98cb644c2d
7 changed files with 350 additions and 10 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/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