Add shell scripts and systemd service for deployment
This commit is contained in:
parent
b9bb2006ed
commit
c85bd56489
4 changed files with 35 additions and 0 deletions
14
reddit-collector-web.service
Normal file
14
reddit-collector-web.service
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Reddit Media Collector Web Interface
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=richard
|
||||
WorkingDirectory=/home/richard/reddit-media-collector
|
||||
ExecStart=/home/richard/reddit-media-collector/venv/bin/uvicorn src.web.app:app --host 0.0.0.0 --port 8000
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
4
run.sh
Executable file
4
run.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
cd /home/richard/reddit-media-collector
|
||||
source venv/bin/activate
|
||||
python -m src.main -c config.yaml
|
||||
13
run_collector.sh
Executable file
13
run_collector.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
# Reddit Media Collector - Daily Cron Script
|
||||
|
||||
cd /home/richard/reddit-media-collector
|
||||
|
||||
# Add local bin to PATH for yt-dlp
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
# Run collector with timeout (4 hours max)
|
||||
timeout 4h python3 -m src.main >> /home/richard/reddit-media-collector/cron.log 2>&1
|
||||
|
||||
# Log completion
|
||||
echo "$(date): Collector finished with exit code $?" >> /home/richard/reddit-media-collector/cron.log
|
||||
4
run_web.sh
Executable file
4
run_web.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
cd /home/richard/reddit-media-collector
|
||||
source venv/bin/activate 2>/dev/null || true
|
||||
uvicorn src.web.app:app --host 0.0.0.0 --port 8000 --reload
|
||||
Loading…
Add table
Add a link
Reference in a new issue