Compare commits
4 Commits
fix/deploy
...
fix/deploy
| Author | SHA1 | Date | |
|---|---|---|---|
| 70fd1c01c9 | |||
| 9fe44ae560 | |||
| da9dbd7827 | |||
| a1a37c77f6 |
@@ -340,8 +340,6 @@ steps:
|
|||||||
|
|
||||||
# ─── Deploy to Docker Swarm (main only) ─────────────────────
|
# ─── Deploy to Docker Swarm (main only) ─────────────────────
|
||||||
|
|
||||||
# ─── Deploy to Docker Swarm via Portainer (main only) ─────────────────────
|
|
||||||
|
|
||||||
deploy-swarm:
|
deploy-swarm:
|
||||||
image: alpine:3
|
image: alpine:3
|
||||||
environment:
|
environment:
|
||||||
@@ -349,30 +347,23 @@ steps:
|
|||||||
from_secret: ssh_private_key
|
from_secret: ssh_private_key
|
||||||
SSH_KNOWN_HOSTS:
|
SSH_KNOWN_HOSTS:
|
||||||
from_secret: ssh_known_hosts
|
from_secret: ssh_known_hosts
|
||||||
PORTAINER_URL:
|
|
||||||
from_secret: portainer_url
|
|
||||||
PORTAINER_API_KEY:
|
|
||||||
from_secret: portainer_api_key
|
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache curl openssh-client
|
- apk add --no-cache openssh-client
|
||||||
- |
|
- |
|
||||||
set -e
|
set -e
|
||||||
echo "🚀 Deploying to Docker Swarm..."
|
# Setup SSH
|
||||||
|
|
||||||
# Setup SSH for fallback
|
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
||||||
chmod 600 ~/.ssh/known_hosts
|
chmod 600 ~/.ssh/known_hosts
|
||||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
|
||||||
# Force service updates (images are pulled from public registry)
|
# Deploy to swarm
|
||||||
|
echo "🚀 Deploying to Docker Swarm..."
|
||||||
ssh -o StrictHostKeyChecking=no localadmin@10.1.1.45 \
|
ssh -o StrictHostKeyChecking=no localadmin@10.1.1.45 \
|
||||||
"docker service update --with-registry-auth --force mosaic-stack-api && \
|
"cd /opt/mosaic-stack && \
|
||||||
docker service update --with-registry-auth --force mosaic-stack-web && \
|
docker login git.mosaicstack.dev -u \$(echo \$GITEA_USER) -p \$GITEA_TOKEN || true && \
|
||||||
docker service update --with-registry-auth --force mosaic-stack-orchestrator && \
|
docker stack deploy -c docker-compose.yml mosaic"
|
||||||
docker service update --with-registry-auth --force mosaic-stack-coordinator && \
|
|
||||||
echo '✅ All services updated'"
|
|
||||||
when:
|
when:
|
||||||
- branch: [main]
|
- branch: [main]
|
||||||
event: [push, manual, tag]
|
event: [push, manual, tag]
|
||||||
|
|||||||
Reference in New Issue
Block a user