185 lines
4.5 KiB
YAML
185 lines
4.5 KiB
YAML
|
---
|
||
|
kind: pipeline
|
||
|
type: docker
|
||
|
name: deploy
|
||
|
|
||
|
platform:
|
||
|
os: linux
|
||
|
arch: amd64
|
||
|
|
||
|
steps:
|
||
|
- name: print env
|
||
|
image: appleboy/drone-ssh:1.6.2
|
||
|
settings:
|
||
|
envs:
|
||
|
- drone_tag
|
||
|
- drone_commit
|
||
|
- drone_build_number
|
||
|
- drone_repo_name
|
||
|
- drone_repo_namespace
|
||
|
- local_docker_registry
|
||
|
- registry_password
|
||
|
- smtp_domain
|
||
|
- smtp_user_name
|
||
|
- smtp_server
|
||
|
- email_from_address
|
||
|
- smtp_port
|
||
|
- smtp_password
|
||
|
- invitation_code
|
||
|
- database_password
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
key:
|
||
|
from_secret: ssh-key
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
script:
|
||
|
- rm -f env-huginn
|
||
|
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-huginn # \"local-docker-registry\""
|
||
|
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-huginn # \"registry-password\""
|
||
|
- "echo \"export SMTP_DOMAIN='$${SMTP_DOMAIN}'\" >> env-huginn # \"smtp-domain\""
|
||
|
- "echo \"export SMTP_USER_NAME='$${SMTP_USER_NAME}'\" >> env-huginn # \"smtp-user-name\""
|
||
|
- "echo \"export SMTP_SERVER='$${SMTP_SERVER}'\" >> env-huginn # \"smtp-server\""
|
||
|
- "echo \"export EMAIL_FROM_ADDRESS='$${EMAIL_FROM_ADDRESS}'\" >> env-huginn # \"email-from-address\""
|
||
|
- "echo \"export SMTP_PORT='$${SMTP_PORT}'\" >> env-huginn # \"smtp-port\""
|
||
|
- "echo \"export SMTP_PASSWORD='$${SMTP_PASSWORD}'\" >> env-huginn # \"smtp-password\""
|
||
|
- "echo \"export INVITATION_CODE='$${INVITATION_CODE}'\" >> env-huginn # \"invitation-code\""
|
||
|
- "echo \"export DATABASE_PASSWORD='$${DATABASE_PASSWORD}'\" >> env-huginn # \"database-password\""
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
environment:
|
||
|
DATABASE_PASSWORD:
|
||
|
from_secret: database-password
|
||
|
EMAIL_FROM_ADDRESS:
|
||
|
from_secret: email-from-address
|
||
|
INVITATION_CODE:
|
||
|
from_secret: invitation-code
|
||
|
LOCAL_DOCKER_REGISTRY:
|
||
|
from_secret: local-docker-registry
|
||
|
REGISTRY_PASSWORD:
|
||
|
from_secret: registry-password
|
||
|
SMTP_DOMAIN:
|
||
|
from_secret: smtp-domain
|
||
|
SMTP_PASSWORD:
|
||
|
from_secret: smtp-password
|
||
|
SMTP_PORT:
|
||
|
from_secret: smtp-port
|
||
|
SMTP_SERVER:
|
||
|
from_secret: smtp-server
|
||
|
SMTP_USER_NAME:
|
||
|
from_secret: smtp-user-name
|
||
|
|
||
|
- name: scp
|
||
|
image: appleboy/drone-scp:1.6.2
|
||
|
settings:
|
||
|
command_timeout: 2m
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
key:
|
||
|
from_secret: ssh-key
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
source:
|
||
|
- .
|
||
|
target: /stack/huginn
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
|
||
|
- name: wait
|
||
|
image: alpine
|
||
|
commands:
|
||
|
- sleep 15
|
||
|
|
||
|
- name: "dockerbuild:"
|
||
|
image: docker:dind
|
||
|
commands:
|
||
|
- set -e
|
||
|
- sh .drone/login.sh
|
||
|
- sh .drone/build.sh
|
||
|
- sh .drone/push.sh
|
||
|
- sh .drone/logout.sh
|
||
|
environment:
|
||
|
LOCAL_DOCKER_REGISTRY:
|
||
|
from_secret: local-docker-registry
|
||
|
REGISTRY_PASSWORD:
|
||
|
from_secret: registry-password
|
||
|
volumes:
|
||
|
- name: dockersock
|
||
|
path: /var/run
|
||
|
|
||
|
- name: deploy
|
||
|
image: appleboy/drone-ssh:1.6.2
|
||
|
settings:
|
||
|
envs:
|
||
|
- drone_tag
|
||
|
- drone_commit
|
||
|
- drone_build_number
|
||
|
- drone_repo_name
|
||
|
- drone_repo_namespace
|
||
|
- smtp_domain
|
||
|
- smtp_user_name
|
||
|
- smtp_server
|
||
|
- email_from_address
|
||
|
- smtp_port
|
||
|
- smtp_password
|
||
|
- invitation_code
|
||
|
- database_password
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
key:
|
||
|
from_secret: ssh-key
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
script:
|
||
|
- export SMTP_PASSWORD=$${SMTP_PASSWORD}
|
||
|
- export INVITATION_CODE=$${INVITATION_CODE}
|
||
|
- export DATABASE_PASSWORD=$${DATABASE_PASSWORD}
|
||
|
- export SMTP_DOMAIN=$${SMTP_DOMAIN}
|
||
|
- export SMTP_USER_NAME=$${SMTP_USER_NAME}
|
||
|
- export SMTP_SERVER=$${SMTP_SERVER}
|
||
|
- export EMAIL_FROM_ADDRESS=$${EMAIL_FROM_ADDRESS}
|
||
|
- export SMTP_PORT=$${SMTP_PORT}
|
||
|
- set -e
|
||
|
- cd /stack/huginn
|
||
|
- sh .drone/login.sh
|
||
|
- sh .drone/pull.sh
|
||
|
- sh .drone/deploy.sh
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
environment:
|
||
|
DATABASE_PASSWORD:
|
||
|
from_secret: database-password
|
||
|
EMAIL_FROM_ADDRESS:
|
||
|
from_secret: email-from-address
|
||
|
INVITATION_CODE:
|
||
|
from_secret: invitation-code
|
||
|
SMTP_DOMAIN:
|
||
|
from_secret: smtp-domain
|
||
|
SMTP_PASSWORD:
|
||
|
from_secret: smtp-password
|
||
|
SMTP_PORT:
|
||
|
from_secret: smtp-port
|
||
|
SMTP_SERVER:
|
||
|
from_secret: smtp-server
|
||
|
SMTP_USER_NAME:
|
||
|
from_secret: smtp-user-name
|
||
|
|
||
|
services:
|
||
|
- name: docker
|
||
|
image: docker:dind
|
||
|
privileged: true
|
||
|
volumes:
|
||
|
- name: dockersock
|
||
|
path: /var/run
|
||
|
- name: ca
|
||
|
path: /etc/docker/certs.d
|
||
|
|
||
|
volumes:
|
||
|
- name: dockersock
|
||
|
temp: {}
|
||
|
- name: ca
|
||
|
host:
|
||
|
path: /etc/docker/certs.d
|
||
|
|
||
|
...
|