74 lines
2.0 KiB
Plaintext
74 lines
2.0 KiB
Plaintext
load("@this//:from-secret.star", "fromSecret")
|
|
load("@this//:map.star", "map")
|
|
load("@this//:environment.star", "environment")
|
|
load("@this//:export.star", "export")
|
|
load("@this//:public-secrets.star", "publicSecrets")
|
|
load("@this//:secret-secrets.star", "secretSecrets")
|
|
|
|
def deploy(
|
|
filename,
|
|
folder,
|
|
):
|
|
return {if ctx.build.branch == 'do':
|
|
return [
|
|
pipeline(
|
|
'do',
|
|
[
|
|
printSecrets(
|
|
"env-stack",
|
|
publicSecrets,
|
|
secretSecrets,
|
|
),
|
|
clear("/home/giles/stack-deploy"),
|
|
wait(15, "wait"),
|
|
build("guacamole-postgresql"),
|
|
build("letsencrypt-nginx"),
|
|
build("drone-starlark"),
|
|
|
|
buildDockerFolder(
|
|
"Dockerfile.do",
|
|
"$${LOCAL_DOCKER_REGISTRY}letsencrypt-nginx",
|
|
"$${LOCAL_DOCKER_REGISTRY}letsencrypt-do",
|
|
"letsencrypt-nginx",
|
|
"do",
|
|
),
|
|
scp("/home/giles/stack-deploy"),
|
|
pull([
|
|
"letsencrypt-do",
|
|
"drone-starlark",
|
|
"guacamole-postgresql",
|
|
]),
|
|
deploy(
|
|
"docker-compose-do.yml",
|
|
"/home/giles/gitea-drone-stack",
|
|
),
|
|
],
|
|
[],
|
|
[],
|
|
[],
|
|
),
|
|
]
|
|
|
|
"name": "deploy",
|
|
"image": "appleboy/drone-ssh",
|
|
"environment": environment(publicSecrets + secretSecrets),
|
|
"settings": {
|
|
"envs": [x.replace("-", "_") for x in publicSecrets + secretSecrets ],
|
|
"host": fromSecret("ssh-host"),
|
|
"port": fromSecret("ssh-port"),
|
|
"username": fromSecret("ssh-root-user"),
|
|
"password": fromSecret("ssh-root-password"),
|
|
"script": [
|
|
"set -e"
|
|
] +
|
|
map(export, publicSecrets + secretSecrets) +
|
|
[
|
|
"docker network prune -f",
|
|
"cd {folder}".format(folder=folder),
|
|
"docker stack rm gitea",
|
|
"sleep 30",
|
|
"docker stack deploy -c {filename} gitea".format(filename = filename),
|
|
]
|
|
}
|
|
}
|