Skip to content

Instantly share code, notes, and snippets.

@jamiejackson
jamiejackson / README.md
Last active June 8, 2023 16:27
Upgrade a Docker Secret in a Running Swarm Service

Update: I'm using this strategy, at the moment: https://github.com/jamiejackson/docker-secret-hash


This is a helper script for updating a secret in a running service. It does cause the service containers to restart (there's no avoiding that), but it does so as elegantly/conveniently as I know how.

See the motivation for this script, as well as alternatives, here.

Caveat:

  • Secret names with a length approaching 64 characters might exhibit weird behavior, as this relies on a version token being tacked onto the secret name. Since the secret name is truncated to 64 characters, a long name might result in a smaller (or nonexistent) version token, leading to uniqueness problems and unexpected behavior.
#!/bin/bash
# https://codefresh.io/blog/deploy-docker-compose-v3-swarm-mode-cluster/
# vars
[ -z "$NUM_WORKERS" ] && NUM_WORKERS=3
# init swarm (need for service command); if not created
docker node ls 2> /dev/null | grep "Leader"
if [ $? -ne 0 ]; then
@jamiejackson
jamiejackson / Application.cfc
Created November 2, 2016 19:18
Just throws a 404 and presents content. Doesn't do what I want.
public any function onMissingView(any rc) {
variables.out = "have to add something here or i get a fw/1 error";
header statuscode="404" statustext="Not Found";
}
...
<dataSource
driver="${dataimporter.datasource.driver}"
url="${dataimporter.datasource.url}"
user="${dataimporter.datasource.user}"
password="${dataimporter.datasource.password}"
encryptKeyFile="/opt/solr/credentials/enky.txt"
/>
...
@jamiejackson
jamiejackson / Timeouts.md
Last active February 2, 2017 19:51
Lucee Networking and Database Timeouts

Overview

This will serve to document various timeouts, what they're used for, and project-specific decisions as to their use/values.

JVM

Networking Timeouts

(These are being set in lucee/tomcat/bin/setenv.sh.)

@jamiejackson
jamiejackson / TestBoxBDDDynamicSuitesExample.cfc
Last active May 5, 2016 19:59
Example of Creating Dynamic Tests/Suites in TestBox BDD Syntax
component
extends="testbox.system.BaseSpec"
hint="This is an example of a TestBox BDD test bundle containing dynamically-defined suites."
{
/*
* Need to do config for *dynamic* test suites here, in the pseudo-
* constructor, versus in beforeAll(). See explanation here:
* https://goo.gl/gosdBK
*/
@jamiejackson
jamiejackson / TestBoxBddBundleExample.cfc
Created May 5, 2016 19:52
TestBox BDD Examples, Including Dynamically-Generated Tests
component
extends="testbox.system.BaseSpec"
hint="This is an example of a TestBox BDD test bundle. For (much) more information, see the documentation at http://testbox.ortusbooks.com/content/primers/bdd/index.html."
{
/******************** "Global" setup/teardown *****************************/
/*
* Need to do config for *dynamic* test suites here, in the pseudo-
* constructor, versus in beforeAll(). See explanation here:
@jamiejackson
jamiejackson / Vagrantfile
Created March 24, 2016 17:20
Using Cygwin and NFS for Vagrant on Windows
...
require './os'
...
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.7.0"
@jamiejackson
jamiejackson / mailcatcher.service
Created January 6, 2016 19:34
MailCatcher Systemd Service / Daemon
[Unit]
Description=MailCatcher Service
After=network.service vagrant.mount
[Service]
Type=simple
ExecStart=/usr/local/bin/mailcatcher --foreground --ip 10.0.2.15
[Install]
WantedBy=multi-user.target
# /etc/init/mailcatcher.conf
description "mailcatcher"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
chdir /srv
script
/usr/local/bin/mailcatcher --ip 10.0.2.15