AI - Building APP in lightSAIL AWS instance : Automatic background app start
Run these on the Lightsail server. 1. Go to app folder cd /var/www/tradingapp ls -la 2. Recreate venv python3 -m venv venv source venv/bin/activate 3. Install packages If you have requirements.txt : pip install --upgrade pip pip install -r requirements.txt If no requirements.txt , install basics: pip install --upgrade pip pip install fastapi uvicorn flask openai python-dotenv pandas requests 4. Recreate start.sh nano start.sh Paste this: #!/bin/bash cd /var/www/tradingapp source venv/bin/activate python3 webapp/app.py Save in nano: Ctrl + O Enter Ctrl + X Make executable: chmod +x start.sh 5. Test manually ./start.sh If app starts, stop with: Ctrl + C 6. Start in background nohup ./start.sh > /tmp/tradingapp.log 2>&1 & Check: ps -ef | grep app.py tail -50 /tmp/tradingapp.log 7. Important: prevent Git deleting these again Add to .gitignore : nano .gitignore Add: venv/ start.sh .env *.log __pycache__/ Then: git status venv should never be committed. start.sh can be c...