diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index b5d2064..ae9865c 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -6,16 +6,37 @@ on: - main jobs: - deploy: - runs-on: self-hosted + deploy-to-host: + runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup Virtual Environment - run: | - python3 -m venv venv - ./venv/bin/pip install -r requirements.txt - - - name: Notification - run: echo "Code wurde erfolgreich auf $(hostname) aktualisiert. Systemd-Dienste müssen ggf. manuell neu gestartet werden." + - name: Deploy via SSH + uses: appleboy/ssh-action@v0.1.10 + with: + host: 172.17.0.1 # Standard-IP des Docker-Hosts aus Sicht des Containers + username: root # Dein Deployment-Nutzer + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + mkdir -p /root/docker-files/trading-daemon + cd /root/docker-files/trading-daemon + + # Repository klonen oder pullen + if [ ! -d ".git" ]; then + git clone https://git.bana.space/krumbelfix/trading-daemon.git . + else + git pull origin main + fi + + # Virtual Environment aktualisieren + python3 -m venv venv + ./venv/bin/pip install -r requirements.txt + + # Systemd Update + cp systemd/trading-daemon.service /etc/systemd/system/ + cp systemd/trading-daemon.timer /etc/systemd/system/ + systemctl daemon-reload + + # Neustart + systemctl restart trading-daemon.timer + systemctl start trading-daemon.service + + echo "Deployment auf dem Host-System erfolgreich." diff --git a/systemd/trading-daemon.service b/systemd/trading-daemon.service index 44b3e4d..3a9b375 100644 --- a/systemd/trading-daemon.service +++ b/systemd/trading-daemon.service @@ -5,8 +5,8 @@ After=network.target [Service] Type=oneshot User=melchiorreimers -WorkingDirectory=/Users/melchiorreimers/.gemini/antigravity/scratch/trading_daemon -ExecStart=/Users/melchiorreimers/.gemini/antigravity/scratch/trading_daemon/venv/bin/python /Users/melchiorreimers/.gemini/antigravity/scratch/trading_daemon/daemon.py +WorkingDirectory=/root/docker-files/trading-daemon +ExecStart=/root/docker-files/trading-daemon/venv/bin/python /root/docker-files/trading-daemon/daemon.py StandardOutput=journal StandardError=journal