62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
# Woodpecker CI - Deploy Pipeline
|
|
|
|
steps:
|
|
deploy-to-staging:
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: deploy_host
|
|
username:
|
|
from_secret: deploy_user
|
|
key:
|
|
from_secret: deploy_key
|
|
port: 22
|
|
script:
|
|
- echo "=== Deploying to staging ==="
|
|
- cd /home/ec2-user/sysmonstm
|
|
- git fetch origin main
|
|
- git reset --hard origin/main
|
|
- echo "=== Pulling new images ==="
|
|
- docker-compose pull
|
|
- echo "=== Restarting services ==="
|
|
- docker-compose up -d --remove-orphans
|
|
- echo "=== Cleaning up ==="
|
|
- docker system prune -f
|
|
- echo "=== Deployment complete ==="
|
|
- docker-compose ps
|
|
|
|
health-check:
|
|
image: curlimages/curl
|
|
commands:
|
|
- echo "=== Waiting for services to start ==="
|
|
- sleep 10
|
|
- echo "=== Checking gateway health ==="
|
|
- curl -f http://$DEPLOY_HOST:8000/health || exit 1
|
|
- echo "=== Health check passed ==="
|
|
secrets: [deploy_host]
|
|
|
|
notify:
|
|
image: plugins/webhook
|
|
settings:
|
|
urls:
|
|
from_secret: webhook_url
|
|
content_type: application/json
|
|
template: |
|
|
{
|
|
"text": "🚀 Deployed to staging",
|
|
"repo": "${CI_REPO_NAME}",
|
|
"commit": "${CI_COMMIT_SHA:0:7}",
|
|
"message": "${CI_COMMIT_MESSAGE}",
|
|
"author": "${CI_COMMIT_AUTHOR}",
|
|
"url": "https://sysmonstm.mcrn.ar"
|
|
}
|
|
when:
|
|
status: success
|
|
|
|
depends_on:
|
|
- build
|
|
|
|
when:
|
|
event: push
|
|
branch: main
|