Skip to content

Commit

Permalink
Version increment for new feature
Browse files Browse the repository at this point in the history
Pass consul servers in as comma-deliminated list
  • Loading branch information
bretton committed May 2, 2023
1 parent 667758f commit 5156cb5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
7 changes: 7 additions & 0 deletions openldap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.8

* Version increment for new feature
* Pass consul servers in as comma-deliminated list

---

1.7

* Version bump for new base image
Expand Down
10 changes: 6 additions & 4 deletions openldap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ Thereafter these files will load automatically, along with any updates, from per
sudo pot set-env -p <jailname> \
-E NODENAME=name \
-E DATACENTER=<datacenter> \
-E CONSULSERVERS='"1.2.3.4"' \
-E GOSSIPKEY=<key> \
-E CONSULSERVERS="<comma-deliminated list of consul servers>" \
-E GOSSIPKEY="<key>" \
-E IP=<IP address> \
-E DOMAIN=<domain name> \
-E DOMAIN="<domain name>" \
-E MYCREDS=<openldap root pass> \
-E HOSTNAME=<hostname> \
[ -E CRONBACKUP=/mnt/openldap-data/backups ] \
Expand All @@ -84,7 +84,9 @@ The NODENAME parameter is the name of the node.

The DATACENTER parameter is the name of the datacenter.

The CONSULSERVERS parameter defines the consul server instances, and must be set as ```CONSULSERVERS='"10.0.0.2"'``` or ```CONSULSERVERS='"10.0.0.2", "10.0.0.3", "10.0.0.4"'``` or ```CONSULSERVERS='"10.0.0.2", "10.0.0.3", "10.0.0.4", "10.0.0.5", "10.0.0.6"'```
The CONSULSERVERS parameter is a comma-deliminated list of consul servers. Do not include spaces!

e.g. ```CONSULSERVERS="10.0.0.2"``` or ```CONSULSERVERS="10.0.0.2,10.0.0.3,10.0.0.4,10.0.0.5,10.0.0.6"```

The GOSSIPKEY parameter is the gossip encryption key for consul agent.

Expand Down
17 changes: 14 additions & 3 deletions openldap/openldap.d/local/bin/cook
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ log() {
echo "$(date '+%Y-%m-%dT%H:%M:%S') $*" | tee -a $COOKLOG
}

convert_to_required_format() {
echo "$1" | sed 's/\([^,]*\)/"\1"/g'
}

set -e
export HOME=/root

Expand Down Expand Up @@ -63,16 +67,23 @@ for var in $optional_args; do
fi
done

########################################################################
## Provision image
########################################################################

# split domain argument into parts
MYSUFFIX=$(echo "$DOMAIN" | awk -F '.' 'NF>=2 {print $(NF-1)}')
export MYSUFFIX
MYTLD=$(echo "$DOMAIN" | awk -F '.' 'NF>=2 {print $(NF)}')
export MYTLD
echo "From DOMAIN of $DOMAIN we get MYSUFFIX of $MYSUFFIX and MYTLD of $MYTLD"

########################################################################
## Provision image
########################################################################
# Input is "10.0.0.1,10.2.0.1,10.45.2.4"
# Expected output is "10.0.0.1","10.2.0.1","10.45.2.4"
if [ -n "${CONSULSERVERS+x}" ]; then
FIXCONSULSERVERS=$(convert_to_required_format "$CONSULSERVERS")
export FIXCONSULSERVERS
fi

# stop services
timeout --foreground 10 \
Expand Down
4 changes: 3 additions & 1 deletion openldap/openldap.d/local/share/cook/bin/configure-consul.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ sep=$'\001'
sed "s${sep}%%datacenter%%${sep}$DATACENTER${sep}g" | \
sed "s${sep}%%nodename%%${sep}$NODENAME${sep}g" | \
sed "s${sep}%%ip%%${sep}$IP${sep}g" | \
sed "s${sep}%%consulservers%%${sep}$CONSULSERVERS${sep}g" \
sed "s${sep}%%consulservers%%${sep}$FIXCONSULSERVERS${sep}g" \
> /usr/local/etc/consul.d/agent.hcl

chmod 600 \
/usr/local/etc/consul.d/agent.hcl

# gossipkey
echo "s${sep}%%gossipkey%%${sep}$GOSSIPKEY${sep}" | sed -i '' -f - \
/usr/local/etc/consul.d/agent.hcl

Expand Down
2 changes: 1 addition & 1 deletion openldap/openldap.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[manifest]
potname="openldap"
author = "Stephan Lichtenauer, Bretton Vine, Michael Gmelin"
version="1.7.2"
version="1.8.1"
origin="freebsd"
runs_in_nomad="false"

0 comments on commit 5156cb5

Please sign in to comment.