feat: setup host deployment via ssh
All checks were successful
Deployment / deploy-to-host (push) Successful in 7s
All checks were successful
Deployment / deploy-to-host (push) Successful in 7s
This commit is contained in:
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user