#!/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 pip3 install -r requirements.txt # Create systemd service file cat << 'EOF' > /etc/systemd/system/iptv-updater.service [Unit] Description=IPTV Updater Service After=network.target [Service] Type=simple User=ec2-user WorkingDirectory=/home/ec2-user/iptv-updater-aws ExecStart=/usr/local/bin/uvicorn app.main:app --host 127.0.0.1 --port 8000 Restart=always [Install] WantedBy=multi-user.target EOF # Create nginx config cat << 'EOF' > /etc/nginx/conf.d/iptvUpdater.conf 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; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } EOF # Start nginx service systemctl enable nginx systemctl start nginx systemctl enable iptv-updater systemctl start iptv-updater