Files
wetterstation/deploy-compose.sh
Reinhard X. Fürst 9d47e3095c Script zum direkten deployen von docker-compose
Footer-Zeilen hinzugefügt
watchtower dazu
2026-02-10 21:02:20 +00:00

32 lines
851 B
Bash
Executable File

#!/bin/bash
# Deploy docker-compose.prod.yml to strato_1 server
TARGET_HOST="strato_1"
TARGET_DIR="/opt/stacks/wetter"
TARGET_FILE="compose.yml"
SOURCE_FILE="docker-compose.prod.yml"
echo "Deploying ${SOURCE_FILE} to ${TARGET_HOST}:${TARGET_DIR}/${TARGET_FILE}..."
# Check if source file exists
if [ ! -f "${SOURCE_FILE}" ]; then
echo "Error: ${SOURCE_FILE} not found!"
exit 1
fi
# Remove old compose.yml on target if it exists
echo "Removing old ${TARGET_FILE} on ${TARGET_HOST}..."
ssh "${TARGET_HOST}" "rm -f ${TARGET_DIR}/${TARGET_FILE}"
# Copy the file
echo "Copying ${SOURCE_FILE} to ${TARGET_HOST}..."
scp "${SOURCE_FILE}" "${TARGET_HOST}:${TARGET_DIR}/${TARGET_FILE}"
if [ $? -eq 0 ]; then
echo "✓ Successfully deployed ${TARGET_FILE} to ${TARGET_HOST}:${TARGET_DIR}/"
else
echo "✗ Deployment failed!"
exit 1
fi