Files
iptv-manager-service/infrastructure/userdata.sh
Stefano a384d6c911
All checks were successful
AWS Deploy on Push / build (push) Successful in 2m20s
create venv on ec2 instance and then run the app
2025-05-14 21:30:26 -05:00

43 lines
1.0 KiB
Bash

#!/bin/sh
yum update -y
yum install -y python3-pip git
amazon-linux-extras install nginx1
pip3 install --upgrade pip
pip3 install certbot certbot-nginx
cd /home/ec2-user
git clone https://git.fiorinis.com/Home/iptv-updater-aws.git
cd iptv-updater-aws
# Install Python 3.12
yum install -y gcc openssl-devel bzip2-devel libffi-devel
wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
tar xzf Python-3.12.0.tgz
cd Python-3.12.0
./configure --enable-optimizations
make altinstall
cd ..
rm -rf Python-3.12.0 Python-3.12.0.tgz
# Create and activate virtual environment
python3.12 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
# Create nginx config
# echo 'server {
# listen 80;
# server_name $HOSTNAME;
# location / {
# proxy_pass http://127.0.0.1:8000;
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# }
# }' > /etc/nginx/conf.d/iptvUpdater.conf
# Start IptvUpdater on port 8000
nohup uvicorn app.main:app --host 127.0.0.1 --port 8000 </dev/null &>/dev/null &