Changed project name to be IPTV Manager Service
All checks were successful
AWS Deploy on Push / build (push) Successful in 8m29s

This commit is contained in:
2025-05-29 16:09:52 -05:00
parent e25f8c1ecd
commit eaab1ef998
22 changed files with 202 additions and 138 deletions

View File

@@ -25,7 +25,7 @@ cdk deploy --app="python3 ${PWD}/app.py"
# Update application on running instances
INSTANCE_IDS=$(aws ec2 describe-instances \
--region us-east-2 \
--filters "Name=tag:Name,Values=IptvUpdaterStack/IptvUpdaterInstance" \
--filters "Name=tag:Name,Values=IptvManagerStack/IptvManagerInstance" \
"Name=instance-state-name,Values=running" \
--query "Reservations[].Instances[].InstanceId" \
--output text)
@@ -35,7 +35,7 @@ for INSTANCE_ID in $INSTANCE_IDS; do
aws ssm send-command \
--instance-ids "$INSTANCE_ID" \
--document-name "AWS-RunShellScript" \
--parameters '{"commands":["cd /home/ec2-user/iptv-updater-aws && git pull && pip3 install -r requirements.txt && alembic upgrade head && sudo systemctl restart iptv-updater"]}' \
--parameters '{"commands":["cd /home/ec2-user/iptv-manager-service && git pull && pip3 install -r requirements.txt && alembic upgrade head && sudo systemctl restart iptv-manager"]}' \
--no-cli-pager \
--no-paginate
done

View File

@@ -10,10 +10,4 @@ pre-commit install-hooks
pre-commit autoupdate
# Verify pytest setup
python3 -m pytest
# Initialize and run database migrations
alembic upgrade head
# Seed initial data
python3 -c "from app.utils.database import SessionLocal; from app.models.db import Priority; db = SessionLocal(); db.add_all([Priority(id=100, description='High'), Priority(id=200, description='Medium'), Priority(id=300, description='Low')]); db.commit()"
python3 -m pytest

View File

@@ -1,21 +1,26 @@
#!/bin/bash
set -e
# Start PostgreSQL
docker-compose -f docker/docker-compose-db.yml up -d
# Set mock auth and database environment variables
# Set environment variables
export MOCK_AUTH=true
export DB_HOST=localhost
export DB_USER=postgres
export DB_PASSWORD=postgres
export DB_HOST=localhost
export DB_NAME=iptv_updater
export DB_NAME=iptv_manager
echo "Ensuring database $DB_NAME exists using conditional DDL..."
PGPASSWORD=$DB_PASSWORD docker exec -i postgres psql -U $DB_USER <<< "SELECT 'CREATE DATABASE $DB_NAME' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '$DB_NAME')\gexec"
echo "Database $DB_NAME check complete."
# Run database migrations
alembic upgrade head
# Start FastAPI
nohup uvicorn app.main:app --host 127.0.0.1 --port 8000 > app.log 2>&1 &
echo $! > iptv-updater.pid
echo $! > iptv-manager.pid
echo "Services started:"
echo "- PostgreSQL running on localhost:5432"

View File

@@ -1,9 +1,9 @@
#!/bin/bash
# Stop FastAPI
if [ -f iptv-updater.pid ]; then
kill $(cat iptv-updater.pid)
rm iptv-updater.pid
if [ -f iptv-manager.pid ]; then
kill $(cat iptv-manager.pid)
rm iptv-manager.pid
echo "Stopped FastAPI"
fi