Compare commits
17 Commits
Author | SHA1 | Date |
---|---|---|
giles | 5a88017c61 | |
giles | 8472f77d24 | |
giles | 7694973da4 | |
giles | ca6cd5640f | |
Giles Bradshaw | 6a35a57711 | |
Giles Bradshaw | c724ef1f6e | |
Giles Bradshaw | 8294c04893 | |
Giles Bradshaw | e608b707fc | |
Giles Bradshaw | 36e4f27928 | |
Giles Bradshaw | 60f0306e90 | |
Giles Bradshaw | dbf318b643 | |
Giles Bradshaw | 4fe4458543 | |
Giles Bradshaw | ca0e2e73e7 | |
Giles Bradshaw | ad7601e7a1 | |
Giles Bradshaw | 2a0788b3ff | |
Giles Bradshaw | a899890c79 | |
Giles Bradshaw | cb047e3dfa |
|
@ -1,3 +1,6 @@
|
||||||
docker build ghost -t ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/ghost \
|
sleep 10
|
||||||
--build-arg REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/
|
|
||||||
|
docker build ghost -t ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/my-ghost \
|
||||||
|
--build-arg REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \
|
||||||
|
--build-arg THEME=${THEME}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/ \
|
export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \
|
||||||
|
&& echo "scheme: ${SCHEME}" \
|
||||||
&& docker stack rm ghost \
|
&& docker stack rm ghost \
|
||||||
&& echo 'sleeping...zzz' \
|
&& echo 'sleeping...zzz' \
|
||||||
&& sleep 60 \
|
&& sleep 60 \
|
||||||
&& docker stack deploy -c docker-compose.yml ghost
|
&& docker stack deploy -c docker-compose.yml ghost --with-registry-auth
|
||||||
|
|
|
@ -5,35 +5,62 @@ local publicSecrets = import 'lib/public-secrets.libsonnet';
|
||||||
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
|
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
|
||||||
local register = import 'node_modules/@sigyl/jsonnet-drone/register.libsonnet';
|
local register = import 'node_modules/@sigyl/jsonnet-drone/register.libsonnet';
|
||||||
local registry = import 'node_modules/@sigyl/jsonnet-drone/registry.libsonnet';
|
local registry = import 'node_modules/@sigyl/jsonnet-drone/registry.libsonnet';
|
||||||
|
local save = import 'node_modules/@sigyl/jsonnet-drone/save.libsonnet';
|
||||||
|
local build = import 'node_modules/@sigyl/jsonnet-drone/build.libsonnet';
|
||||||
|
local print = import 'node_modules/@sigyl/jsonnet-drone/print.libsonnet';
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
registry: '',
|
registry: '',
|
||||||
|
name: 'ghost',
|
||||||
|
root: 'stack'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
local defs = [
|
||||||
|
{
|
||||||
|
load: 'alpine/git:v2.26.2@sha256:8715680f27333935bb384a678256faf8e8832a5f2a0d4a00c9d481111c5a29c0',
|
||||||
|
save: 'alpine/git:v2.26.2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
load: 'ghost:3.14.0@sha256:38fb60af996dca89632e848c32e8c155d6dd20578c129752bd5449f99028fa92',
|
||||||
|
save: 'ghost:3.14.0'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
load: 'mysql:5.7@sha256:ce6815027949d0b48e3097a94fa3ec062866a78868d50c7900c697c13574599f',
|
||||||
|
save: 'mysql:5.7'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
[
|
[
|
||||||
register,
|
register,
|
||||||
registry(
|
registry(
|
||||||
config {
|
config {
|
||||||
script: 'sh .drone/scripts/initialise-images.sh',
|
script: 'sh .drone/scripts/initialise-images.sh',
|
||||||
secrets: [],
|
secrets: [],
|
||||||
|
images: defs,
|
||||||
},
|
},
|
||||||
) {
|
),
|
||||||
trigger +: {
|
save(config)(
|
||||||
event +: [
|
defs,
|
||||||
'promote',
|
[
|
||||||
|
'my-ghost',
|
||||||
],
|
],
|
||||||
target +: [
|
),
|
||||||
'registry',
|
print(config)(
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
deploy(config)(
|
|
||||||
'ghost',
|
|
||||||
'/stack/',
|
|
||||||
[],
|
[],
|
||||||
publicSecrets,
|
publicSecrets,
|
||||||
secretSecrets,
|
secretSecrets,
|
||||||
|
),
|
||||||
|
build(config)(
|
||||||
|
['THEME'],
|
||||||
|
),
|
||||||
|
deploy(config)(
|
||||||
[
|
[
|
||||||
|
'THEME',
|
||||||
|
],
|
||||||
|
publicSecrets,
|
||||||
|
secretSecrets,
|
||||||
|
[
|
||||||
|
'SCHEME',
|
||||||
'DOMAIN',
|
'DOMAIN',
|
||||||
'REGISTRY_DOMAIN',
|
'REGISTRY_DOMAIN',
|
||||||
'REGISTRY_PORT',
|
'REGISTRY_PORT',
|
||||||
|
|
|
@ -24,13 +24,36 @@ platform:
|
||||||
os: linux
|
os: linux
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "dockerpull and save docker images:"
|
- name: alpine/git:v2.26.2
|
||||||
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
commands:
|
commands:
|
||||||
- set -e
|
- set -e
|
||||||
- export REGISTRY=$${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
- sh .drone/scripts/initialise-images.sh $${REGISTRY} $${REGISTRY_PASSWORD}
|
- "n=0\nwhile :\ndo\n docker pull alpine/git:v2.26.2@sha256:8715680f27333935bb384a678256faf8e8832a5f2a0d4a00c9d481111c5a29c0 \\\\\n && docker tag alpine/git:v2.26.2@sha256:8715680f27333935bb384a678256faf8e8832a5f2a0d4a00c9d481111c5a29c0 $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/alpine/git:v2.26.2 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/alpine/git:v2.26.2 && break\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"initialise failed\"\n exit 1\n fi\n echo \"retrying..$n\"\n sleep 5\ndone\n"
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
- name: ghost:3.14.0
|
||||||
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
|
commands:
|
||||||
|
- set -e
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- "n=0\nwhile :\ndo\n docker pull ghost:3.14.0@sha256:38fb60af996dca89632e848c32e8c155d6dd20578c129752bd5449f99028fa92 \\\\\n && docker tag ghost:3.14.0@sha256:38fb60af996dca89632e848c32e8c155d6dd20578c129752bd5449f99028fa92 $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/ghost:3.14.0 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/ghost:3.14.0 && break\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"initialise failed\"\n exit 1\n fi\n echo \"retrying..$n\"\n sleep 5\ndone\n"
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
|
||||||
|
- name: mysql:5.7
|
||||||
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
|
commands:
|
||||||
|
- set -e
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- "n=0\nwhile :\ndo\n docker pull mysql:5.7@sha256:ce6815027949d0b48e3097a94fa3ec062866a78868d50c7900c697c13574599f \\\\\n && docker tag mysql:5.7@sha256:ce6815027949d0b48e3097a94fa3ec062866a78868d50c7900c697c13574599f $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/mysql:5.7 \\\\\n && docker push $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/mysql:5.7 && break\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"initialise failed\"\n exit 1\n fi\n echo \"retrying..$n\"\n sleep 5\ndone\n"
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
|
@ -44,6 +67,8 @@ services:
|
||||||
path: /var/run
|
path: /var/run
|
||||||
- name: ca
|
- name: ca
|
||||||
path: /etc/docker/certs.d
|
path: /etc/docker/certs.d
|
||||||
|
- name: daemonjson
|
||||||
|
path: /etc/docker/daemon.json
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
|
@ -51,6 +76,9 @@ volumes:
|
||||||
- name: ca
|
- name: ca
|
||||||
host:
|
host:
|
||||||
path: /etc/docker/certs.d
|
path: /etc/docker/certs.d
|
||||||
|
- name: daemonjson
|
||||||
|
host:
|
||||||
|
path: /etc/docker/daemon.json
|
||||||
|
|
||||||
image_pull_secrets:
|
image_pull_secrets:
|
||||||
- dockerconfigjson
|
- dockerconfigjson
|
||||||
|
@ -64,7 +92,120 @@ trigger:
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: deploy
|
name: save
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: mkdir
|
||||||
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
settings:
|
||||||
|
envs:
|
||||||
|
- drone_tag
|
||||||
|
- drone_commit
|
||||||
|
- drone_build_number
|
||||||
|
- drone_repo_name
|
||||||
|
- drone_repo_namespace
|
||||||
|
script:
|
||||||
|
- mkdir -p /stack/.images/ghost/built
|
||||||
|
- rm -f /stack/.images/ghost/*.*
|
||||||
|
- rm -f /stack/.images/ghost/built/*.*
|
||||||
|
|
||||||
|
- name: alpine/git:v2.26.2
|
||||||
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
settings:
|
||||||
|
envs:
|
||||||
|
- drone_tag
|
||||||
|
- drone_commit
|
||||||
|
- drone_build_number
|
||||||
|
- drone_repo_name
|
||||||
|
- drone_repo_namespace
|
||||||
|
- registry_domain
|
||||||
|
- registry_port
|
||||||
|
- registry_password
|
||||||
|
- destination_registry
|
||||||
|
script:
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/alpine/git:v2.26.2
|
||||||
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/alpine/git:v2.26.2 -o /stack/.images/ghost/alpine_git:v2.26.2.tar
|
||||||
|
- echo "docker load < alpine_git:v2.26.2.tar" >> /stack/.images/ghost/load.sh
|
||||||
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/alpine/git:v2.26.2 $${DESTINATION_REGISTRY}/stack/ghost/alpine/git:v2.26.2" >> /stack/.images/ghost/load.sh
|
||||||
|
|
||||||
|
- name: ghost:3.14.0
|
||||||
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
settings:
|
||||||
|
envs:
|
||||||
|
- drone_tag
|
||||||
|
- drone_commit
|
||||||
|
- drone_build_number
|
||||||
|
- drone_repo_name
|
||||||
|
- drone_repo_namespace
|
||||||
|
- registry_domain
|
||||||
|
- registry_port
|
||||||
|
- registry_password
|
||||||
|
- destination_registry
|
||||||
|
script:
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/ghost:3.14.0
|
||||||
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/ghost:3.14.0 -o /stack/.images/ghost/ghost:3.14.0.tar
|
||||||
|
- echo "docker load < ghost:3.14.0.tar" >> /stack/.images/ghost/load.sh
|
||||||
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/ghost:3.14.0 $${DESTINATION_REGISTRY}/stack/ghost/ghost:3.14.0" >> /stack/.images/ghost/load.sh
|
||||||
|
|
||||||
|
- name: mysql:5.7
|
||||||
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
settings:
|
||||||
|
envs:
|
||||||
|
- drone_tag
|
||||||
|
- drone_commit
|
||||||
|
- drone_build_number
|
||||||
|
- drone_repo_name
|
||||||
|
- drone_repo_namespace
|
||||||
|
- registry_domain
|
||||||
|
- registry_port
|
||||||
|
- registry_password
|
||||||
|
- destination_registry
|
||||||
|
script:
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/mysql:5.7
|
||||||
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/mysql:5.7 -o /stack/.images/ghost/mysql:5.7.tar
|
||||||
|
- echo "docker load < mysql:5.7.tar" >> /stack/.images/ghost/load.sh
|
||||||
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/mysql:5.7 $${DESTINATION_REGISTRY}/stack/ghost/mysql:5.7" >> /stack/.images/ghost/load.sh
|
||||||
|
|
||||||
|
- name: my-ghost
|
||||||
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
settings:
|
||||||
|
envs:
|
||||||
|
- drone_tag
|
||||||
|
- drone_commit
|
||||||
|
- drone_build_number
|
||||||
|
- drone_repo_name
|
||||||
|
- drone_repo_namespace
|
||||||
|
- registry_domain
|
||||||
|
- registry_port
|
||||||
|
- registry_password
|
||||||
|
- destination_registry
|
||||||
|
script:
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- docker pull $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/my-ghost
|
||||||
|
- docker save $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/my-ghost -o /stack/.images/ghost/built/my-ghost.tar
|
||||||
|
- echo "docker load my-ghost.tar" >> /stack/.images/ghost/built/load.sh
|
||||||
|
- echo "docker tag $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/stack/ghost/my-ghost ${DESINATION_REGISTRY}/stack/ghost/my-ghost" >> /stack/.images/ghost/built/load.sh
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- save
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: print
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
os: linux
|
os: linux
|
||||||
|
@ -80,92 +221,58 @@ steps:
|
||||||
- drone_build_number
|
- drone_build_number
|
||||||
- drone_repo_name
|
- drone_repo_name
|
||||||
- drone_repo_namespace
|
- drone_repo_namespace
|
||||||
- mail_service
|
- mail
|
||||||
- mail_user
|
|
||||||
- commento_origin
|
- commento_origin
|
||||||
|
- theme
|
||||||
- mysql_root_password
|
- mysql_root_password
|
||||||
script:
|
script:
|
||||||
- rm -f env-ghost
|
- rm -f env-ghost
|
||||||
- "echo \"export MAIL_SERVICE='$${MAIL_SERVICE}'\" >> env-ghost # \"mail-service\""
|
- "echo \"export MAIL='$${MAIL}'\" >> env-ghost # \"mail\""
|
||||||
- "echo \"export MAIL_USER='$${MAIL_USER}'\" >> env-ghost # \"mail-user\""
|
|
||||||
- "echo \"export COMMENTO_ORIGIN='$${COMMENTO_ORIGIN}'\" >> env-ghost # \"commento-origin\""
|
- "echo \"export COMMENTO_ORIGIN='$${COMMENTO_ORIGIN}'\" >> env-ghost # \"commento-origin\""
|
||||||
|
- "echo \"export THEME='$${THEME}'\" >> env-ghost # \"theme\""
|
||||||
- "echo \"export MYSQL_ROOT_PASSWORD='$${MYSQL_ROOT_PASSWORD}'\" >> env-ghost # \"mysql-root-password\""
|
- "echo \"export MYSQL_ROOT_PASSWORD='$${MYSQL_ROOT_PASSWORD}'\" >> env-ghost # \"mysql-root-password\""
|
||||||
environment:
|
environment:
|
||||||
COMMENTO_ORIGIN:
|
COMMENTO_ORIGIN:
|
||||||
from_secret: commento-origin
|
from_secret: commento-origin
|
||||||
MAIL_SERVICE:
|
MAIL:
|
||||||
from_secret: mail-service
|
from_secret: mail
|
||||||
MAIL_USER:
|
|
||||||
from_secret: mail-user
|
|
||||||
MYSQL_ROOT_PASSWORD:
|
MYSQL_ROOT_PASSWORD:
|
||||||
from_secret: mysql-root-password
|
from_secret: mysql-root-password
|
||||||
|
THEME:
|
||||||
|
from_secret: theme
|
||||||
|
|
||||||
- name: scp
|
trigger:
|
||||||
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
event:
|
||||||
settings:
|
- promote
|
||||||
command_timeout: 2m
|
target:
|
||||||
source:
|
- print
|
||||||
- .
|
|
||||||
target: /stack/ghost
|
|
||||||
|
|
||||||
- name: wait
|
---
|
||||||
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
|
kind: pipeline
|
||||||
commands:
|
type: docker
|
||||||
- sleep 15
|
name: build
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
- name: "dockerbuild:"
|
- name: "dockerbuild:"
|
||||||
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
commands:
|
commands:
|
||||||
- set -e
|
- set -e
|
||||||
- sh .drone/login.sh
|
- export NAME=ghost
|
||||||
|
- export ROOT=stack
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
- sh .drone/build.sh
|
- sh .drone/build.sh
|
||||||
- sh .drone/push.sh
|
- sh .drone/push.sh
|
||||||
- sh .drone/logout.sh
|
environment:
|
||||||
|
THEME:
|
||||||
|
from_secret: theme
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
|
|
||||||
- name: deploy
|
|
||||||
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
|
||||||
settings:
|
|
||||||
envs:
|
|
||||||
- drone_tag
|
|
||||||
- drone_commit
|
|
||||||
- drone_build_number
|
|
||||||
- drone_repo_name
|
|
||||||
- drone_repo_namespace
|
|
||||||
- domain
|
|
||||||
- registry_domain
|
|
||||||
- registry_port
|
|
||||||
- registry_password
|
|
||||||
- mail_service
|
|
||||||
- mail_user
|
|
||||||
- commento_origin
|
|
||||||
- mysql_root_password
|
|
||||||
script:
|
|
||||||
- export MYSQL_ROOT_PASSWORD=$${MYSQL_ROOT_PASSWORD}
|
|
||||||
- export MAIL_SERVICE=$${MAIL_SERVICE}
|
|
||||||
- export MAIL_USER=$${MAIL_USER}
|
|
||||||
- export COMMENTO_ORIGIN=$${COMMENTO_ORIGIN}
|
|
||||||
- export DOMAIN=$${DOMAIN}
|
|
||||||
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
|
|
||||||
- export REGISTRY_PORT=$${REGISTRY_PORT}
|
|
||||||
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
|
||||||
- set -e
|
|
||||||
- cd /stack/ghost
|
|
||||||
- sh .drone/login.sh
|
|
||||||
- sh .drone/pull.sh
|
|
||||||
- sh .drone/deploy.sh
|
|
||||||
environment:
|
|
||||||
COMMENTO_ORIGIN:
|
|
||||||
from_secret: commento-origin
|
|
||||||
MAIL_SERVICE:
|
|
||||||
from_secret: mail-service
|
|
||||||
MAIL_USER:
|
|
||||||
from_secret: mail-user
|
|
||||||
MYSQL_ROOT_PASSWORD:
|
|
||||||
from_secret: mysql-root-password
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- name: docker
|
- name: docker
|
||||||
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
|
@ -175,6 +282,8 @@ services:
|
||||||
path: /var/run
|
path: /var/run
|
||||||
- name: ca
|
- name: ca
|
||||||
path: /etc/docker/certs.d
|
path: /etc/docker/certs.d
|
||||||
|
- name: daemonjson
|
||||||
|
path: /etc/docker/daemon.json
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
|
@ -182,11 +291,86 @@ volumes:
|
||||||
- name: ca
|
- name: ca
|
||||||
host:
|
host:
|
||||||
path: /etc/docker/certs.d
|
path: /etc/docker/certs.d
|
||||||
|
- name: daemonjson
|
||||||
|
host:
|
||||||
|
path: /etc/docker/daemon.json
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
- promote
|
- promote
|
||||||
target:
|
target:
|
||||||
|
- build
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: deploy
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: scp
|
||||||
|
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
||||||
|
settings:
|
||||||
|
command_timeout: 2m
|
||||||
|
source:
|
||||||
|
- .
|
||||||
|
target: /stack/ghost
|
||||||
|
|
||||||
|
- name: deploy
|
||||||
|
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
||||||
|
settings:
|
||||||
|
envs:
|
||||||
|
- drone_tag
|
||||||
|
- drone_commit
|
||||||
|
- drone_build_number
|
||||||
|
- drone_repo_name
|
||||||
|
- drone_repo_namespace
|
||||||
|
- scheme
|
||||||
|
- domain
|
||||||
|
- registry_domain
|
||||||
|
- registry_port
|
||||||
|
- registry_password
|
||||||
|
- mail
|
||||||
|
- commento_origin
|
||||||
|
- theme
|
||||||
|
- mysql_root_password
|
||||||
|
- theme
|
||||||
|
script:
|
||||||
|
- export MYSQL_ROOT_PASSWORD=$${MYSQL_ROOT_PASSWORD}
|
||||||
|
- export MAIL=$${MAIL}
|
||||||
|
- export COMMENTO_ORIGIN=$${COMMENTO_ORIGIN}
|
||||||
|
- export THEME=$${THEME}
|
||||||
|
- export SCHEME=$${SCHEME}
|
||||||
|
- export DOMAIN=$${DOMAIN}
|
||||||
|
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
|
||||||
|
- export REGISTRY_PORT=$${REGISTRY_PORT}
|
||||||
|
- export REGISTRY_PASSWORD=$${REGISTRY_PASSWORD}
|
||||||
|
- set -e
|
||||||
|
- export NAME=ghost
|
||||||
|
- export ROOT=stack
|
||||||
|
- cd /stack/ghost
|
||||||
|
- "n=0\nwhile :\ndo\n docker login $${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/ --username client --password \"$${REGISTRY_PASSWORD}\" \\\\\n && break # substitute your command here\n n=$((n+1))\n if [ $n -ge 10 ]; then\n echo \"login failed\"\n exit 1\n fi\n echo \"retrying login..$n\"\n sleep 5\ndone\n"
|
||||||
|
- sh .drone/pull.sh
|
||||||
|
- sh .drone/deploy.sh
|
||||||
|
environment:
|
||||||
|
COMMENTO_ORIGIN:
|
||||||
|
from_secret: commento-origin
|
||||||
|
MAIL:
|
||||||
|
from_secret: mail
|
||||||
|
MYSQL_ROOT_PASSWORD:
|
||||||
|
from_secret: mysql-root-password
|
||||||
|
THEME:
|
||||||
|
from_secret: theme
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- deploy
|
||||||
- production
|
- production
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
'mail-service',
|
'mail-service',
|
||||||
'mail-user',
|
'mail-user',
|
||||||
'commento-origin',
|
'commento-origin',
|
||||||
|
'theme'
|
||||||
]
|
]
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
docker login ${REGISTRY_DOMAIN}:${REGISTRY_PORT} --username client --password "${REGISTRY_PASSWORD}"
|
|
|
@ -1 +0,0 @@
|
||||||
docker logout ${REGISTRY_DOMAIN}:${REGISTRY_PORT}
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sigyl/jsonnet-drone": "^0.3.1"
|
"@sigyl/jsonnet-drone": "^1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
docker pull ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/ghost
|
docker pull ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/my-ghost
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
docker push ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/ghost
|
docker push ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/my-ghost
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
n=0
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
docker pull $2 \
|
|
||||||
&& docker tag $2 $1$2 \
|
|
||||||
&& docker push $1$2 && break # substitute your command here
|
|
||||||
n=$((n+1))
|
|
||||||
if [ $n -ge 10 ]; then
|
|
||||||
echo "initialise failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "retrying..$n"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
sh $(dirname $0)/login.sh $1 "$2" \
|
|
||||||
&& sh $(dirname $0)/initialise-image.sh $1 alpine/git:v2.26.2 \
|
|
||||||
&& sh $(dirname $0)/initialise-image.sh $1 ghost:3.14.0 \
|
|
||||||
&& sh $(dirname $0)/initialise-image.sh $1 mysql:5.7
|
|
|
@ -1,13 +0,0 @@
|
||||||
n=0
|
|
||||||
while :
|
|
||||||
do
|
|
||||||
docker login $1 --username client --password $2 \
|
|
||||||
&& break # substitute your command here
|
|
||||||
n=$((n+1))
|
|
||||||
if [ $n -ge 10 ]; then
|
|
||||||
echo "login failed"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "retrying login..$n"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
|
@ -12,10 +12,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff"
|
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff"
|
||||||
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
|
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
|
||||||
|
|
||||||
"@sigyl/jsonnet-drone@^0.3.1":
|
"@sigyl/jsonnet-drone@^1.0.0":
|
||||||
version "0.3.1"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.3.1.tgz#790a83f45556cc613f07fbc98ca760027fa936e7"
|
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-1.0.0.tgz#943bd8a1abc8a916026944816709f5ed1d8e7ef8"
|
||||||
integrity sha512-FiSyunjR0Udc20I2gA6gkzX3sCB2dPq/ZODrXcm7ROQFKF2Wr4b+xhpovjEdnjKGy8G4d+rRcdN+Jyhp7WQLEg==
|
integrity sha512-ubyVC1/nAM584wTnnRBZTOP18z28Yy7SRApvSuo/3y2arngKlNI1FwOzKTFt/7L9+rNy19dRO/g0obEkyR3KmA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@sigyl/jsonnet-compose" "^0.0.2"
|
"@sigyl/jsonnet-compose" "^0.0.2"
|
||||||
"@sigyl/jsonnet-drone-environment" "0.0.5"
|
"@sigyl/jsonnet-drone-environment" "0.0.5"
|
||||||
|
|
|
@ -2,6 +2,14 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [0.0.6](https://sigyl.com///compare/v0.0.5...v0.0.6) "chore(release): 0.0.6" (2020-09-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* minor ([cb047e3](https://sigyl.com///commit/cb047e3dfac931486728862226fe29a9e7b303c0))
|
||||||
|
* set registry var in build ([54495d9](https://sigyl.com///commit/54495d95963941c8f00e88f8f9cf105dcecfb2b8))
|
||||||
|
|
||||||
### [0.0.5](https://sigyl.com///compare/v0.0.4...v0.0.5) "chore(release): 0.0.5" (2020-09-25)
|
### [0.0.5](https://sigyl.com///compare/v0.0.4...v0.0.5) "chore(release): 0.0.5" (2020-09-25)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ services:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
image: ${LOCAL_DOCKER_REGISTRY}ghost
|
image: ${LOCAL_DOCKER_REGISTRY}my-ghost
|
||||||
volumes:
|
volumes:
|
||||||
- ghost-content-images:/var/lib/ghost/content/images
|
- ghost-content-images:/var/lib/ghost/content/images
|
||||||
- ghost-content-settings:/var/lib/ghost/content/settings
|
- ghost-content-settings:/var/lib/ghost/content/settings
|
||||||
|
@ -16,11 +16,11 @@ services:
|
||||||
- ghost-content-data:/var/lib/ghost/content/data
|
- ghost-content-data:/var/lib/ghost/content/data
|
||||||
- ghost-content-logs:/var/lib/ghost/content/logs
|
- ghost-content-logs:/var/lib/ghost/content/logs
|
||||||
environment:
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
- DOMAIN=$DOMAIN
|
- DOMAIN=$DOMAIN
|
||||||
- MAIL-SERVICE=$MAIL-SERVICE
|
- SCHEME=$SCHEME
|
||||||
- MAIL-USER=$MAIL-USER
|
|
||||||
- MAIL-PASSWORD=$MAIL-PASSWORD
|
|
||||||
- COMMENTO_ORIGIN=$COMMENTO_ORIGIN
|
- COMMENTO_ORIGIN=$COMMENTO_ORIGIN
|
||||||
|
- MAIL=$MAIL
|
||||||
- database__client=mysql
|
- database__client=mysql
|
||||||
- database__connection__host=ghost-mysql
|
- database__connection__host=ghost-mysql
|
||||||
- database__connection__user=root
|
- database__connection__user=root
|
||||||
|
|
|
@ -2,14 +2,15 @@ ARG REGISTRY
|
||||||
FROM ${REGISTRY}alpine/git:v2.26.2 as git
|
FROM ${REGISTRY}alpine/git:v2.26.2 as git
|
||||||
|
|
||||||
WORKDIR /themes
|
WORKDIR /themes
|
||||||
RUN git clone https://sigyl.com/git/themes/casper.git
|
ARG THEME=https://sigyl.com/git/themes/casper.git
|
||||||
|
RUN git clone ${THEME}
|
||||||
|
|
||||||
FROM ${REGISTRY}ghost:3.14.0
|
FROM ${REGISTRY}ghost:3.14.0
|
||||||
# USER root
|
# USER root
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y gettext
|
RUN apt-get install -y gettext
|
||||||
|
|
||||||
COPY config.production.json /var/lib/ghost/
|
COPY config.production.json.template /var/lib/ghost/
|
||||||
COPY --from=git /themes/ /var/lib/ghost/content/themes/
|
COPY --from=git /themes/ /var/lib/ghost/content/themes/
|
||||||
COPY post.hbs /hbs/
|
COPY post.hbs /hbs/
|
||||||
COPY run.sh /
|
COPY run.sh /
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"url": "https://${DOMAIN}/",
|
"url": "${SCHEME}://${DOMAIN}/",
|
||||||
"server": {
|
"server": {
|
||||||
"port": 2368,
|
"port": 2368,
|
||||||
"host": "0.0.0.0"
|
"host": "0.0.0.0"
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"url": "${SCHEME}://${DOMAIN}/",
|
||||||
|
"server": {
|
||||||
|
"port": 2368,
|
||||||
|
"host": "0.0.0.0"
|
||||||
|
},
|
||||||
|
"database": {
|
||||||
|
"client": "sqlite3",
|
||||||
|
"connection": {
|
||||||
|
"filename": "/var/lib/ghost/content/data/ghost.db"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mail": ${MAIL},
|
||||||
|
"logging": {
|
||||||
|
"transports": [
|
||||||
|
"file",
|
||||||
|
"stdout"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"process": "systemd",
|
||||||
|
"paths": {
|
||||||
|
"contentPath": "/var/lib/ghost/content"
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,3 @@
|
||||||
envsubst < /var/lib/ghost/config.production.json > __tmp && mv __tmp /var/lib/ghost/config.production.json
|
envsubst < /var/lib/ghost/config.production.json.template > /var/lib/ghost/config.production.json
|
||||||
envsubst < /hbs/post.hbs > /var/lib/ghost/content/themes/casper/post.hbs
|
envsubst < /hbs/post.hbs > /var/lib/ghost/content/themes/casper/post.hbs
|
||||||
node "current/index.js"
|
node "current/index.js"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "ghost",
|
"name": "ghost",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"description": "ghost blog",
|
"description": "ghost blog",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"deploy": "sh deploy.sh",
|
"deploy": "sh deploy.sh",
|
||||||
|
|
Loading…
Reference in New Issue