Compare commits
11 Commits
Author | SHA1 | Date |
---|---|---|
Giles Bradshaw | 3429f512b0 | |
Giles Bradshaw | b1e21bf238 | |
Giles Bradshaw | 5f2379b9ab | |
Giles Bradshaw | d074d183ff | |
Giles Bradshaw | d6abd8898e | |
Giles Bradshaw | 65270d533c | |
Giles Bradshaw | 5d5728c88c | |
Giles Bradshaw | 5ee2f74699 | |
Giles Bradshaw | 9143a4e12e | |
Giles Bradshaw | fb57269ce5 | |
Giles Bradshaw | ea90a7cd27 |
|
@ -1,4 +1,5 @@
|
||||||
docker stack rm portainer
|
export LOCAL_DOCKER_REGISTRY=${REGISTRY_DOMAIN}:${REGISTRY_PORT}/ \
|
||||||
echo 'sleeping...60'
|
&& docker stack rm portainer \
|
||||||
sleep 60
|
&& echo 'sleeping...60' \
|
||||||
docker stack deploy -c docker-compose.yml portainer
|
&& sleep 60 \
|
||||||
|
&& docker stack deploy -c docker-compose.yml portainer --with-registry-auth
|
||||||
|
|
|
@ -4,9 +4,33 @@ 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 deploy = import 'node_modules/@sigyl/jsonnet-drone/deploy.libsonnet';
|
||||||
|
local registry = import 'node_modules/@sigyl/jsonnet-drone/registry.libsonnet';
|
||||||
|
|
||||||
|
|
||||||
|
local config = {
|
||||||
|
registry: '',
|
||||||
|
};
|
||||||
|
|
||||||
[
|
[
|
||||||
register,
|
register,
|
||||||
deploy(
|
registry(
|
||||||
|
config {
|
||||||
|
script: 'sh .drone/scripts/initialise-images.sh',
|
||||||
|
secrets: [],
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
trigger +: {
|
||||||
|
event +: [
|
||||||
|
'promote',
|
||||||
|
],
|
||||||
|
target +: [
|
||||||
|
'registry',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
deploy(config)(
|
||||||
'portainer',
|
'portainer',
|
||||||
'/stack/',
|
'/stack/',
|
||||||
[],
|
[],
|
||||||
|
|
|
@ -15,6 +15,57 @@ trigger:
|
||||||
exclude:
|
exclude:
|
||||||
- promote
|
- promote
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: registry
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "dockerpull and save docker images:"
|
||||||
|
image: docker:19.03.12-dind@sha256:8dded163e463f4a59bf305b3dca98e312b2cfb89a43da3872e48f95a7554c48f
|
||||||
|
commands:
|
||||||
|
- set -e
|
||||||
|
- export REGISTRY=$${REGISTRY_DOMAIN}:$${REGISTRY_PORT}/
|
||||||
|
- sh .drone/scripts/initialise-images.sh $${REGISTRY} "$${REGISTRY_PASSWORD}"
|
||||||
|
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
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
|
@ -34,26 +85,16 @@ steps:
|
||||||
- drone_build_number
|
- drone_build_number
|
||||||
- drone_repo_name
|
- drone_repo_name
|
||||||
- drone_repo_namespace
|
- drone_repo_namespace
|
||||||
host: ${SSH_HOST}
|
|
||||||
key: ${SSH_KEY}
|
|
||||||
passphrase: ${SSH_PASSPHRASE}
|
|
||||||
port: ${SSH_PORT}
|
|
||||||
script:
|
script:
|
||||||
- rm -f env-portainer
|
- rm -f env-portainer
|
||||||
username: ${SSH_USER}
|
|
||||||
|
|
||||||
- name: scp
|
- name: scp
|
||||||
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
image: appleboy/drone-scp:1.6.2@sha256:bd37a55f4b97e7742b0de7333669b96220b3cc422d366e1fa8c34059b736ab47
|
||||||
settings:
|
settings:
|
||||||
command_timeout: 2m
|
command_timeout: 2m
|
||||||
host: ${SSH_HOST}
|
|
||||||
key: ${SSH_KEY}
|
|
||||||
passphrase: ${SSH_PASSPHRASE}
|
|
||||||
port: ${SSH_PORT}
|
|
||||||
source:
|
source:
|
||||||
- .
|
- .
|
||||||
target: /stack/portainer
|
target: /stack/portainer
|
||||||
username: ${SSH_USER}
|
|
||||||
|
|
||||||
- name: wait
|
- name: wait
|
||||||
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
|
image: alpine:3.12.0@sha256:90baa0922fe90624b05cb5766fa5da4e337921656c2f8e2b13bd3c052a0baac1
|
||||||
|
@ -85,10 +126,6 @@ steps:
|
||||||
- registry_domain
|
- registry_domain
|
||||||
- registry_port
|
- registry_port
|
||||||
- registry_password
|
- registry_password
|
||||||
host: ${SSH_HOST}
|
|
||||||
key: ${SSH_KEY}
|
|
||||||
passphrase: ${SSH_PASSPHRASE}
|
|
||||||
port: ${SSH_PORT}
|
|
||||||
script:
|
script:
|
||||||
- export DOMAIN=$${DOMAIN}
|
- export DOMAIN=$${DOMAIN}
|
||||||
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
|
- export REGISTRY_DOMAIN=$${REGISTRY_DOMAIN}
|
||||||
|
@ -99,7 +136,6 @@ steps:
|
||||||
- sh .drone/login.sh
|
- sh .drone/login.sh
|
||||||
- sh .drone/pull.sh
|
- sh .drone/pull.sh
|
||||||
- sh .drone/deploy.sh
|
- sh .drone/deploy.sh
|
||||||
username: ${SSH_USER}
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- name: docker
|
- name: docker
|
||||||
|
@ -110,6 +146,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
|
||||||
|
@ -117,6 +155,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
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sigyl/jsonnet-drone": "^0.4.0"
|
"@sigyl/jsonnet-drone": "^0.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
n=0
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
docker pull $2 \
|
||||||
|
&& docker tag $2 $1$3 \
|
||||||
|
&& docker push $1$3 && 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
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
sh $(dirname $0)/login.sh $1 "$2" \
|
||||||
|
&& sh $(dirname $0)/initialise-image.sh $1 \
|
||||||
|
portainer/portainer-ce:2.0.0-alpine@sha256:5555e1538aa4bc56d7ae85787278e4b972573b205e2ae260717ef17985e0e24f \
|
||||||
|
sigyl.stack.portainer_portainer/portainer-ce:2.0.0-alpine \
|
||||||
|
&& sh $(dirname $0)/initialise-image.sh $1 \
|
||||||
|
portainer/agent:2.0.0@sha256:8f994457bc32480bff351f0b1d371557238e69f5902037addfe76fa7bd930b9d \
|
||||||
|
sigyl.stack.portainer_portainer/agent:2.0.0
|
|
@ -0,0 +1,13 @@
|
||||||
|
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.1.0":
|
"@sigyl/jsonnet-drone@^0.4.1":
|
||||||
version "0.1.0"
|
version "0.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.1.0.tgz#feda1797e8e9ef799cad72e65f7163ca26a9e3a5"
|
resolved "https://registry.yarnpkg.com/@sigyl/jsonnet-drone/-/jsonnet-drone-0.4.1.tgz#3527edb00f8bb860de1658f4c9fa6f81f932d3b7"
|
||||||
integrity sha512-QY/ngucxFOtLfL8Mt0f2bxN4fQDUOGOFtaRpSH2cNyg84xADkzehT0ORZtbLitr+AwhyF5KN/zAGvzkyNAoqPw==
|
integrity sha512-+TOx51KJG1RxrPRZ2lPpia7a6Ms5UvkyLIuXuumPtenyxJ/pivY1TdcLvSAvFgVZHMjh9CxBCuOu8vNT1fPy2A==
|
||||||
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"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
version: "3.7"
|
version: "3.7"
|
||||||
services:
|
services:
|
||||||
portainer:
|
portainer:
|
||||||
image: portainer/portainer-ce:2.0.0-alpine@sha256:5555e1538aa4bc56d7ae85787278e4b972573b205e2ae260717ef17985e0e24f
|
image: ${LOCAL_DOCKER_REGISTRY}sigyl.stack.portainer_portainer/portainer-ce:2.0.0-alpine
|
||||||
command: -H tcp://tasks.portainer-agent:9001 --tlsskipverify
|
command: -H tcp://tasks.portainer-agent:9001 --tlsskipverify
|
||||||
# command: -H unix:///var/run/docker.sock
|
# command: -H unix:///var/run/docker.sock
|
||||||
deploy:
|
deploy:
|
||||||
|
@ -18,7 +18,7 @@ services:
|
||||||
- appnet
|
- appnet
|
||||||
- externalnet
|
- externalnet
|
||||||
portainer-agent:
|
portainer-agent:
|
||||||
image: portainer/agent:2.0.0@sha256:8f994457bc32480bff351f0b1d371557238e69f5902037addfe76fa7bd930b9d
|
image: ${LOCAL_DOCKER_REGISTRY}sigyl.stack.portainer_portainer/agent:2.0.0
|
||||||
environment:
|
environment:
|
||||||
# REQUIRED: Should be equal to the service name prefixed by "tasks." when
|
# REQUIRED: Should be equal to the service name prefixed by "tasks." when
|
||||||
# deployed inside an overlay network
|
# deployed inside an overlay network
|
||||||
|
|
Loading…
Reference in New Issue