Compare commits
No commits in common. "master" and "home-deploy" have entirely different histories.
master
...
home-deplo
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
load("@this//ghost:drone.star", "drone")
|
||||||
|
load("@this//ghost:stack-name.star", "stackName")
|
||||||
|
load("@this//ghost:stack-root.star", "stackRoot")
|
||||||
|
|
||||||
|
def main(ctx):
|
||||||
|
return drone(
|
||||||
|
ctx,
|
||||||
|
"do",
|
||||||
|
stackRoot,
|
||||||
|
stackName,
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
load("@this//ghost:drone.star", "drone")
|
||||||
|
load("@this//ghost:stack-name.star", "stackName")
|
||||||
|
load("@this//ghost:stack-root.star", "stackRoot")
|
||||||
|
|
||||||
|
def main(ctx):
|
||||||
|
return drone(
|
||||||
|
ctx,
|
||||||
|
"home-deploy",
|
||||||
|
stackRoot,
|
||||||
|
stackName,
|
||||||
|
[]
|
||||||
|
)
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
sleep 10
|
|
||||||
|
|
||||||
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,6 +0,0 @@
|
||||||
export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/ \
|
|
||||||
&& echo "scheme: ${SCHEME}" \
|
|
||||||
&& docker stack rm ghost \
|
|
||||||
&& echo 'sleeping...zzz' \
|
|
||||||
&& sleep 60 \
|
|
||||||
&& docker stack deploy -c docker-compose.yml ghost --with-registry-auth
|
|
|
@ -1,79 +0,0 @@
|
||||||
|
|
||||||
local secretSecrets = import 'lib/secret-secrets.libsonnet';
|
|
||||||
local publicSecrets = import 'lib/public-secrets.libsonnet';
|
|
||||||
|
|
||||||
local deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
|
|
||||||
local register = import 'node_modules/@sigyl/jsonnet-drone/register.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 = {
|
|
||||||
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,
|
|
||||||
registry(
|
|
||||||
config {
|
|
||||||
script: 'sh .drone/scripts/initialise-images.sh',
|
|
||||||
secrets: [],
|
|
||||||
images: defs,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
save(config)(
|
|
||||||
defs,
|
|
||||||
[
|
|
||||||
'my-ghost',
|
|
||||||
],
|
|
||||||
),
|
|
||||||
print(config)(
|
|
||||||
[],
|
|
||||||
publicSecrets,
|
|
||||||
secretSecrets,
|
|
||||||
),
|
|
||||||
build(config)(
|
|
||||||
['THEME'],
|
|
||||||
),
|
|
||||||
deploy(config)(
|
|
||||||
[
|
|
||||||
'THEME',
|
|
||||||
],
|
|
||||||
publicSecrets,
|
|
||||||
secretSecrets,
|
|
||||||
[
|
|
||||||
'SCHEME',
|
|
||||||
'DOMAIN',
|
|
||||||
'REGISTRY_DOMAIN',
|
|
||||||
'REGISTRY_PORT',
|
|
||||||
'REGISTRY_PASSWORD',
|
|
||||||
],
|
|
||||||
) {
|
|
||||||
trigger +: {
|
|
||||||
event +: [
|
|
||||||
'promote',
|
|
||||||
],
|
|
||||||
target +: [
|
|
||||||
'production',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,376 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: register
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
exclude:
|
|
||||||
- promote
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: registry
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
clone:
|
|
||||||
disable: true
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: alpine/git:v2.26.2
|
|
||||||
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 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:
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
|
|
||||||
services:
|
|
||||||
- name: docker
|
|
||||||
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
|
||||||
privileged: true
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
- name: ca
|
|
||||||
path: /etc/docker/certs.d
|
|
||||||
- name: daemonjson
|
|
||||||
path: /etc/docker/daemon.json
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
temp: {}
|
|
||||||
- name: ca
|
|
||||||
host:
|
|
||||||
path: /etc/docker/certs.d
|
|
||||||
- name: daemonjson
|
|
||||||
host:
|
|
||||||
path: /etc/docker/daemon.json
|
|
||||||
|
|
||||||
image_pull_secrets:
|
|
||||||
- dockerconfigjson
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- promote
|
|
||||||
target:
|
|
||||||
- registry
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
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:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: print env
|
|
||||||
image: appleboy/drone-ssh:1.6.2@sha256:b801dc2cd238c192b6e99acfa7bc3f5b9a03f312bd2feb1e10b3a7a28a1b80ea
|
|
||||||
settings:
|
|
||||||
envs:
|
|
||||||
- drone_tag
|
|
||||||
- drone_commit
|
|
||||||
- drone_build_number
|
|
||||||
- drone_repo_name
|
|
||||||
- drone_repo_namespace
|
|
||||||
- mail
|
|
||||||
- commento_origin
|
|
||||||
- theme
|
|
||||||
- mysql_root_password
|
|
||||||
script:
|
|
||||||
- rm -f env-ghost
|
|
||||||
- "echo \"export MAIL='$${MAIL}'\" >> env-ghost # \"mail\""
|
|
||||||
- "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\""
|
|
||||||
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
|
|
||||||
target:
|
|
||||||
- print
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: build
|
|
||||||
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: "dockerbuild:"
|
|
||||||
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
|
||||||
commands:
|
|
||||||
- set -e
|
|
||||||
- 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/push.sh
|
|
||||||
environment:
|
|
||||||
THEME:
|
|
||||||
from_secret: theme
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
|
|
||||||
services:
|
|
||||||
- name: docker
|
|
||||||
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
|
||||||
privileged: true
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
path: /var/run
|
|
||||||
- name: ca
|
|
||||||
path: /etc/docker/certs.d
|
|
||||||
- name: daemonjson
|
|
||||||
path: /etc/docker/daemon.json
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: dockersock
|
|
||||||
temp: {}
|
|
||||||
- name: ca
|
|
||||||
host:
|
|
||||||
path: /etc/docker/certs.d
|
|
||||||
- name: daemonjson
|
|
||||||
host:
|
|
||||||
path: /etc/docker/daemon.json
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- promote
|
|
||||||
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
|
|
||||||
|
|
||||||
...
|
|
|
@ -1,6 +0,0 @@
|
||||||
[
|
|
||||||
'mail-service',
|
|
||||||
'mail-user',
|
|
||||||
'commento-origin',
|
|
||||||
'theme'
|
|
||||||
]
|
|
|
@ -1,3 +0,0 @@
|
||||||
[
|
|
||||||
'mysql-root-password',
|
|
||||||
]
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"private": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@sigyl/jsonnet-drone": "^1.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
docker pull ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/my-ghost
|
|
|
@ -1 +0,0 @@
|
||||||
docker push ${REGISTRY_DOMAIN}:${REGISTRY_PORT}/${ROOT}/${NAME}/my-ghost
|
|
|
@ -1,37 +0,0 @@
|
||||||
Arguments:
|
|
||||||
/usr/bin/node /home/giles/.yarn/bin/yarn.js
|
|
||||||
|
|
||||||
PATH:
|
|
||||||
/home/giles/.yarn/bin:/home/giles/.config/yarn/global/node_modules/.bin:/home/giles/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin
|
|
||||||
|
|
||||||
Yarn version:
|
|
||||||
1.22.4
|
|
||||||
|
|
||||||
Node version:
|
|
||||||
11.14.0
|
|
||||||
|
|
||||||
Platform:
|
|
||||||
linux x64
|
|
||||||
|
|
||||||
Trace:
|
|
||||||
Error: self signed certificate in certificate chain
|
|
||||||
at TLSSocket.onConnectSecure (_tls_wrap.js:1176:34)
|
|
||||||
at TLSSocket.emit (events.js:193:13)
|
|
||||||
at TLSSocket._finishInit (_tls_wrap.js:667:8)
|
|
||||||
|
|
||||||
npm manifest:
|
|
||||||
{
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@sigyl/jsonnet-compose": "^0.0.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
yarn manifest:
|
|
||||||
No manifest
|
|
||||||
|
|
||||||
Lockfile:
|
|
||||||
No lockfile
|
|
|
@ -1,21 +0,0 @@
|
||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
"@sigyl/jsonnet-compose@^0.0.2":
|
|
||||||
version "0.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-compose/-/jsonnet-compose-0.0.2.tgz#8900a21e8cd8109929b6042703f8645aacb9bcda"
|
|
||||||
integrity sha512-wWS3CgPeNi/o1pcS6n/4pafxlMD0KC9/RKMZr/ySmzeGNRW++sPuKuxajYse2TNd47uNDdeUSnk4aEeEIKL0zA==
|
|
||||||
|
|
||||||
"@sigyl/jsonnet-drone-environment@0.0.5":
|
|
||||||
version "0.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone-environment/-/jsonnet-drone-environment-0.0.5.tgz#9ea85e08904777bd21a3e4b30b0b91461d0285ff"
|
|
||||||
integrity sha512-xVGmdMO1pOyozAWUbJm6mzKBgsLPJ+1hWnGCK3AxPkr7kkDh18hu30+TLzlcQtqq76s5jUfvJUztezsGj/mIcw==
|
|
||||||
|
|
||||||
"@sigyl/jsonnet-drone@^1.0.0":
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-1.0.0.tgz#943bd8a1abc8a916026944816709f5ed1d8e7ef8"
|
|
||||||
integrity sha512-ubyVC1/nAM584wTnnRBZTOP18z28Yy7SRApvSuo/3y2arngKlNI1FwOzKTFt/7L9+rNy19dRO/g0obEkyR3KmA==
|
|
||||||
dependencies:
|
|
||||||
"@sigyl/jsonnet-compose" "^0.0.2"
|
|
||||||
"@sigyl/jsonnet-drone-environment" "0.0.5"
|
|
|
@ -1 +0,0 @@
|
||||||
node_modules
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"tagMessageInChangeLog": true
|
|
||||||
}
|
|
26
CHANGELOG.md
26
CHANGELOG.md
|
@ -1,26 +0,0 @@
|
||||||
# Changelog
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* registry promotion ([299d4da](https://sigyl.com///commit/299d4da0f5e91eab79ab637e4b5c6f13df612a29))
|
|
||||||
|
|
||||||
### [0.0.4](https://sigyl.com///compare/v0.0.1...v0.0.4) "chore(release): 0.0.4" (2020-08-28)
|
|
||||||
|
|
||||||
### [0.0.3](https://sigyl.com///compare/v0.0.2...v0.0.3) "chore(release): 0.0.3" (2020-08-19)
|
|
||||||
|
|
||||||
### [0.0.2](https://sigyl.com///compare/v0.0.1...v0.0.2) "chore(release): 0.0.2" (2020-08-19)
|
|
||||||
|
|
||||||
### 0.0.1 "chore(release): 0.0.1" (2020-08-12)
|
|
13
README.md
13
README.md
|
@ -1,10 +1,11 @@
|
||||||
# ghost
|
# ghost
|
||||||
|
|
||||||
## secrets
|
## secrets
|
||||||
|
|
||||||
* commento-origin
|
* commento-origin
|
||||||
* mail-password
|
* ghost-mail-password
|
||||||
* mail-service
|
* ghost-mail-service
|
||||||
* mail-user
|
* ghost-mail-user
|
||||||
* mysql-root-password
|
* ghost-mysql-root-password
|
||||||
*
|
* git-domain
|
||||||
|
* local-docker-registry
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ services:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
image: ${LOCAL_DOCKER_REGISTRY}my-ghost
|
image: ${LOCAL_DOCKER_REGISTRY}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,22 +16,22 @@ 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
|
- GIT_DOMAIN=$GIT_DOMAIN
|
||||||
- DOMAIN=$DOMAIN
|
- GHOST-MAIL-SERVICE=$GHOST-MAIL-SERVICE
|
||||||
- SCHEME=$SCHEME
|
- GHOST-MAIL-USER=$GHOST-MAIL-USER
|
||||||
|
- GHOST-MAIL-PASSWORD=$GHOST-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
|
||||||
- database__connection__password=$MYSQL_ROOT_PASSWORD
|
- database__connection__password=$GHOST_MYSQL_ROOT_PASSWORD
|
||||||
- database__connection__database=ghost
|
- database__connection__database=ghost
|
||||||
- database__pool__min=0 # https://github.com/knex/knex/issues/975
|
- database__pool__min=0 # https://github.com/knex/knex/issues/975
|
||||||
networks:
|
networks:
|
||||||
- appnet
|
- appnet
|
||||||
- externalnet
|
- externalnet
|
||||||
ghost-mysql:
|
ghost-mysql:
|
||||||
image: ${LOCAL_DOCKER_REGISTRY}mysql:5.7
|
image: mysql:5.7
|
||||||
deploy:
|
deploy:
|
||||||
placement:
|
placement:
|
||||||
constraints: [node.labels.com.sigyl.git-stack-data == yes]
|
constraints: [node.labels.com.sigyl.git-stack-data == yes]
|
||||||
|
@ -41,7 +41,7 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ghost-data:/var/lib/mysql
|
- ghost-data:/var/lib/mysql
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
|
MYSQL_ROOT_PASSWORD: $GHOST_MYSQL_ROOT_PASSWORD
|
||||||
networks:
|
networks:
|
||||||
- appnet
|
- appnet
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
ARG REGISTRY
|
FROM alpine/git as git
|
||||||
FROM ${REGISTRY}alpine/git:v2.26.2 as git
|
|
||||||
|
|
||||||
WORKDIR /themes
|
WORKDIR /themes
|
||||||
ARG THEME=https://sigyl.com/git/themes/casper.git
|
RUN git clone https://sigyl.com/git/themes/casper.git
|
||||||
RUN git clone ${THEME}
|
|
||||||
|
|
||||||
FROM ${REGISTRY}ghost:3.14.0
|
FROM 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.template /var/lib/ghost/
|
COPY config.production.json /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": "${SCHEME}://${DOMAIN}/",
|
"url": "https://${GIT_DOMAIN}/",
|
||||||
"server": {
|
"server": {
|
||||||
"port": 2368,
|
"port": 2368,
|
||||||
"host": "0.0.0.0"
|
"host": "0.0.0.0"
|
||||||
|
@ -13,10 +13,10 @@
|
||||||
"mail": {
|
"mail": {
|
||||||
"transport": "SMTP",
|
"transport": "SMTP",
|
||||||
"options": {
|
"options": {
|
||||||
"service": "${MAIL_SERVICE}",
|
"service": "${GHOST_MAIL_SERVICE}",
|
||||||
"auth": {
|
"auth": {
|
||||||
"user": "${MAIL_USER}",
|
"user": "${GHOST_MAIL_USER}",
|
||||||
"pass": "${MAIL_PASSWORD}"
|
"pass": "${GHOST_MAIL_PASSWORD}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"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.template > /var/lib/ghost/config.production.json
|
envsubst < /var/lib/ghost/config.production.json > __tmp && mv __tmp /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,3 +0,0 @@
|
||||||
drone jsonnet --source .drone/drone-home.jsonnet --target .drone/drone-home.yml --stream \
|
|
||||||
&& git add .drone/drone-home.yml \
|
|
||||||
&& echo "jsonnet built"
|
|
21
package.json
21
package.json
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"private": true,
|
|
||||||
"name": "ghost",
|
|
||||||
"version": "0.0.6",
|
|
||||||
"description": "ghost blog",
|
|
||||||
"scripts": {
|
|
||||||
"deploy": "sh deploy.sh",
|
|
||||||
"build": "sh build.sh",
|
|
||||||
"release": "standard-version",
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://sigyl.com/git/stack/ghost"
|
|
||||||
},
|
|
||||||
"author": "Giles Bradshaw",
|
|
||||||
"license": "ISC",
|
|
||||||
"devDependencies": {
|
|
||||||
"standard-version": "git+https://github.com/gilesbradshaw/standard-version.git"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue