2020-04-02 15:38:35 +00:00
|
|
|
---
|
2020-04-20 07:44:49 +00:00
|
|
|
# this builds and deploys the system on static ip servers
|
2020-04-02 15:38:35 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
clone:
|
|
|
|
# skip_verify: true
|
|
|
|
|
|
|
|
steps:
|
2020-04-19 08:42:59 +00:00
|
|
|
- name: printenv
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- do
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
environment:
|
|
|
|
LOCAL_DOCKER_REGISTRY:
|
|
|
|
from_secret: local-docker-registry
|
|
|
|
SSH_HOST:
|
|
|
|
from_secret: ssh-host
|
|
|
|
SSH_USER:
|
|
|
|
from_secret: ssh-user
|
|
|
|
SSH_PORT:
|
|
|
|
from_secret: ssh-port
|
|
|
|
CERTBOT_EMAIL:
|
|
|
|
from_secret: certbot-email
|
|
|
|
GIT_DOMAIN:
|
|
|
|
from_secret: git-domain
|
|
|
|
settings:
|
|
|
|
envs:
|
|
|
|
- local_docker_registry
|
|
|
|
- ssh_host
|
|
|
|
- ssh_user
|
|
|
|
- ssh_port
|
|
|
|
- certbot_email
|
|
|
|
- git_domain
|
|
|
|
host:
|
|
|
|
from_secret: ssh-host
|
|
|
|
port:
|
|
|
|
from_secret: ssh-port
|
|
|
|
username:
|
|
|
|
from_secret: ssh-user
|
|
|
|
password:
|
|
|
|
from_secret: ssh-password
|
|
|
|
script:
|
|
|
|
- echo SSH_HOST=$SSH_HOST > env
|
|
|
|
- echo SSH_USER=$SSH_USER >> env
|
|
|
|
- echo SSH_PORT=$SSH_PORT >> env
|
|
|
|
- echo LOCAL_DOCKER_REGISTRY=$LOCAL_DOCKER_REGISTRY >> env
|
|
|
|
- echo CERTBOT_EMAIL=$CERTBOT_EMAIL >> env
|
|
|
|
- echo GIT_DOMAIN=$GIT_DOMAIN >> env
|
2020-04-02 15:38:35 +00:00
|
|
|
- name: wait
|
|
|
|
when:
|
|
|
|
branch:
|
2020-04-03 07:15:41 +00:00
|
|
|
- do
|
2020-04-02 15:38:35 +00:00
|
|
|
image: docker:dind
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
|
|
|
|
commands:
|
2020-04-03 11:09:56 +00:00
|
|
|
- sleep 20
|
2020-04-02 15:38:35 +00:00
|
|
|
- name: build-letsencrypt-nginx
|
|
|
|
when:
|
|
|
|
branch:
|
2020-04-03 07:15:41 +00:00
|
|
|
- do
|
2020-04-02 15:38:35 +00:00
|
|
|
image: docker:dind
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
environment:
|
|
|
|
LOCAL_DOCKER_REGISTRY:
|
|
|
|
from_secret: local-docker-registry
|
|
|
|
commands:
|
|
|
|
- cd letsencrypt-nginx
|
2020-04-02 15:45:59 +00:00
|
|
|
- docker build . -t $${LOCAL_DOCKER_REGISTRY}letsencrypt-nginx
|
|
|
|
- docker push $${LOCAL_DOCKER_REGISTRY}letsencrypt-nginx
|
2020-04-03 08:17:34 +00:00
|
|
|
- name: build-letsencrypt-do
|
2020-04-02 15:38:35 +00:00
|
|
|
when:
|
|
|
|
branch:
|
2020-04-03 07:15:41 +00:00
|
|
|
- do
|
2020-04-02 15:38:35 +00:00
|
|
|
image: docker:dind
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
environment:
|
|
|
|
LOCAL_DOCKER_REGISTRY:
|
|
|
|
from_secret: local-docker-registry
|
|
|
|
commands:
|
|
|
|
- cd letsencrypt-nginx
|
2020-04-03 08:17:34 +00:00
|
|
|
- sh build.sh do $${LOCAL_DOCKER_REGISTRY}
|
2020-04-19 08:42:59 +00:00
|
|
|
- name: build-postgres
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- do
|
|
|
|
image: docker:dind
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
environment:
|
|
|
|
LOCAL_DOCKER_REGISTRY:
|
|
|
|
from_secret: local-docker-registry
|
|
|
|
commands:
|
|
|
|
- cd guacamole-postgresql
|
|
|
|
- docker build . -t $${LOCAL_DOCKER_REGISTRY}guacamole-postgresql
|
|
|
|
- docker push $${LOCAL_DOCKER_REGISTRY}guacamole-postgresql
|
|
|
|
|
2020-04-03 09:08:21 +00:00
|
|
|
- name: clear
|
2020-04-03 09:07:02 +00:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- do
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: ssh-host
|
|
|
|
username:
|
|
|
|
from_secret: ssh-user
|
|
|
|
key:
|
|
|
|
from_secret: ssh-key
|
|
|
|
passphrase:
|
|
|
|
from_secret: ssh-passphrase
|
|
|
|
port:
|
|
|
|
from_secret: ssh-port
|
|
|
|
script:
|
2020-04-03 09:12:19 +00:00
|
|
|
- rm -r -f ~/stack-deploy
|
2020-04-02 15:38:35 +00:00
|
|
|
- name: scp files
|
|
|
|
when:
|
|
|
|
branch:
|
2020-04-03 07:15:41 +00:00
|
|
|
- do
|
2020-04-02 15:38:35 +00:00
|
|
|
image: appleboy/drone-scp
|
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: ssh-host
|
|
|
|
username:
|
|
|
|
from_secret: ssh-user
|
2020-04-03 07:28:18 +00:00
|
|
|
key:
|
|
|
|
from_secret: ssh-key
|
2020-04-03 07:53:24 +00:00
|
|
|
passphrase:
|
|
|
|
from_secret: ssh-passphrase
|
2020-04-02 15:38:35 +00:00
|
|
|
port:
|
|
|
|
from_secret: ssh-port
|
|
|
|
command_timeout: 2m
|
2020-04-03 09:07:02 +00:00
|
|
|
target: ~/stack-deploy
|
2020-04-02 15:38:35 +00:00
|
|
|
source:
|
|
|
|
- .
|
|
|
|
- name: deploy
|
|
|
|
when:
|
|
|
|
branch:
|
2020-04-03 07:15:41 +00:00
|
|
|
- do
|
2020-04-02 15:38:35 +00:00
|
|
|
image: appleboy/drone-ssh
|
|
|
|
environment:
|
|
|
|
DRONE_RPC_SECRET:
|
|
|
|
from_secret: drone-rpc-secret
|
|
|
|
DRONE_GITEA_CLIENT_ID:
|
|
|
|
from_secret: drone-gitea-client-id
|
|
|
|
DRONE_GITEA_CLIENT_SECRET:
|
|
|
|
from_secret: drone-gitea-client-secret
|
|
|
|
LOCAL_DOCKER_REGISTRY:
|
|
|
|
from_secret: local-docker-registry
|
|
|
|
SSH_USER:
|
|
|
|
from_secret: ssh-user
|
|
|
|
CERTBOT_EMAIL:
|
|
|
|
from_secret: certbot-email
|
|
|
|
GIT_DOMAIN:
|
|
|
|
from_secret: git-domain
|
2020-04-19 08:42:59 +00:00
|
|
|
GUACAMOLE_POSTGRES_USER:
|
|
|
|
from_secret: guacamole-postgres-user
|
|
|
|
GUACAMOLE_POSTGRES_DB:
|
|
|
|
from_secret: guacamole-postgres-db
|
|
|
|
GUACAMOLE_POSTGRES_PASSWORD:
|
|
|
|
from_secret: guacamole-postgres-password
|
2020-04-02 15:38:35 +00:00
|
|
|
settings:
|
|
|
|
envs:
|
|
|
|
- drone_rpc_secret
|
|
|
|
- drone_gitea_client_id
|
|
|
|
- drone_gitea_client_secret
|
|
|
|
- ssh_user
|
|
|
|
- local_docker_registry
|
|
|
|
- certbot_email
|
|
|
|
- git_domain
|
2020-04-19 08:42:59 +00:00
|
|
|
- guacamole_postgres_user
|
|
|
|
- guacamole_postgres_db
|
|
|
|
- guacamole_postgres_password
|
2020-04-02 15:38:35 +00:00
|
|
|
host:
|
|
|
|
from_secret: ssh-host
|
|
|
|
username:
|
|
|
|
from_secret: ssh-user
|
2020-04-03 07:28:18 +00:00
|
|
|
key:
|
2020-04-03 08:21:42 +00:00
|
|
|
from_secret: ssh-key
|
2020-04-03 07:53:24 +00:00
|
|
|
passphrase:
|
|
|
|
from_secret: ssh-passphrase
|
2020-04-02 15:38:35 +00:00
|
|
|
port:
|
|
|
|
from_secret: ssh-port
|
|
|
|
script:
|
|
|
|
- set -e
|
|
|
|
- export LOCAL_DOCKER_REGISTRY=$LOCAL_DOCKER_REGISTRY
|
|
|
|
- export DRONE_RPC_SECRET=$DRONE_RPC_SECRET
|
|
|
|
- export DRONE_GITEA_CLIENT_ID=$DRONE_GITEA_CLIENT_ID
|
|
|
|
- export DRONE_GITEA_CLIENT_SECRET=$DRONE_GITEA_CLIENT_SECRET
|
|
|
|
- export SSH_USER=$SSH_USER
|
|
|
|
- export CERTBOT_EMAIL=$CERTBOT_EMAIL
|
|
|
|
- export GIT_DOMAIN=$GIT_DOMAIN
|
2020-04-19 08:42:59 +00:00
|
|
|
- export GUACAMOLE_POSTGRES_USER=$GUACAMOLE_POSTGRES_USER
|
|
|
|
- export GUACAMOLE_POSTGRES_DB=$GUACAMOLE_POSTGRES_DB
|
|
|
|
- export GUACAMOLE_POSTGRES_PASSWORD=$GUACAMOLE_POSTGRES_PASSWORD
|
2020-04-02 15:38:35 +00:00
|
|
|
- docker network prune -f
|
2020-04-03 09:07:02 +00:00
|
|
|
- cd ~/stack-deploy
|
2020-04-03 11:26:37 +00:00
|
|
|
- docker pull $${LOCAL_DOCKER_REGISTRY}letsencrypt-do
|
2020-04-19 08:42:59 +00:00
|
|
|
- docker pull $${LOCAL_DOCKER_REGISTRY}guacamole-postgresql
|
2020-04-02 15:38:35 +00:00
|
|
|
- docker stack rm gitea
|
|
|
|
- sleep 60
|
|
|
|
- docker stack deploy -c docker-compose-do.yml gitea
|
2020-04-02 16:09:49 +00:00
|
|
|
- docker service scale gitea_chat=1
|
2020-04-02 15:38:35 +00:00
|
|
|
#- sleep 300
|
|
|
|
|
|
|
|
services:
|
|
|
|
- name: docker
|
|
|
|
image: docker:dind
|
|
|
|
privileged: true
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
path: /var/run
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: dockersock
|
|
|
|
temp: {}
|