Skip to content

Instantly share code, notes, and snippets.

Avatar

Basi bvis

View GitHub Profile
@bvis
bvis / deploy.sh
Created Sep 5, 2017
Autoregister your swarm nodes in Portainer
View deploy.sh
# Create the password needed to login to portainer and reuse it for the portainer endpoints.
export VOLUME_DRIVER=local
export PORTAINER_PASS=mySuperSECRETPass
export PORTAINER_ENC_PASS=$(docker run --rm httpd:2.4-alpine htpasswd -nbB admin ${PORTAINER_PASS} | cut -d ":" -f 2)
echo $PORTAINER_PASS | docker secret create portainer_password.v1 --label portainer -
# Deploy the stack!
docker stack deploy --compose-file docker-compose.yml portainer
@bvis
bvis / Jenkinsfile
Last active May 14, 2021
Jenkin pipeline definition example to be integrated with Docker Swarm cluster in our CI/CD environment
View Jenkinsfile
pipeline {
agent { node { label 'swarm-ci' } }
environment {
TEST_PREFIX = "test-IMAGE"
TEST_IMAGE = "${env.TEST_PREFIX}:${env.BUILD_NUMBER}"
TEST_CONTAINER = "${env.TEST_PREFIX}-${env.BUILD_NUMBER}"
REGISTRY_ADDRESS = "my.registry.address.com"
SLACK_CHANNEL = "#deployment-notifications"
@bvis
bvis / README.md
Last active Jun 14, 2021
Docker Env Vars expanded with secrets content
View README.md

Variables by Secrets

Sample script that allows you to define as environment variables the name of the docker secret that contains the secret value. It will be in charge of analyze all the environment variables searching for the placeholder to substitute the variable value by the secret.

Usage

You can define the next environment variables: