Creating new server, resuing same AMI from previous TF streamlit instance
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user