Script zum direkten deployen von docker-compose

Footer-Zeilen hinzugefügt
watchtower dazu
This commit is contained in:
2026-02-10 21:02:20 +00:00
parent b71d92646b
commit 9d47e3095c
4 changed files with 104 additions and 0 deletions

31
deploy-compose.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/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