Files
nip/docs/DEVELOPER.md
Brian Cunnie bf4f039001 Metrics are served via metrics.status.sslip.io
- The metrics aren't fleshed out. In fact, there's only two so far:
  1. uptime
  2. number of queries
- Even though the metrics aren't complete, I'm checking it in because
  this commit is already much too big.
- I moved the version information to `version.status.sslip.io`;
  previously it was at `version.sslip.io`. I didn't want one endpoint
  for both metrics & version (worry: DNS amplification), and I wanted a
  consistent subdomain to find that information (i.e.
  `status.sslip.io`).
- I'm not worried about atomic updates to the metrics; if a metric is
  off by one, if I skip a count because two lookups are happening at the
  exact same time, I don't care.
- The `Metrics` struct is a pointer within `Xip` because I might have
  several copies of `Xip` (if I'm binding to several interfaces
  individually), but I must only have one copy of `Metrics`
- I only include the metrics I'm interested in, usually because it took
  some work to implement that feature. I don't care about MX records,
  but I care about IPv6 lookups, DNS-01 challenges, public IP lookups.
- got rid of a section of unreachable code at the end of
  `ProcessQuestion()`; I was tired of Goland flagging it. I had it there
  mostly because I was paranoid of falling through a `switch` statement
2022-01-19 06:47:21 -08:00

4.6 KiB

Updating BOSH Releases

These instructions are meant primarily for me when deploying a new BOSH release; they might not make sense unless you're on my workstation.

export OLD_VERSION=2.2.4
export VERSION=2.3.0
cd ~/workspace/sslip.io
git pull -r --autostash
# update the version number for the TXT record for version.status.sslip.io
sed -i '' "s/$OLD_VERSION/$VERSION/g" \
  bin/make_all \
  bosh-release/packages/sslip.io-dns-server/packaging \
  spec/check-dns_spec.rb
# update the download instructions on the website
sed -i '' "s~/$OLD_VERSION/~/$VERSION/~g" \
  k8s/document_root/index.html \
  k8s/Dockerfile-sslip.io-dns-server
# update the git hash for the TXT record for version.status.sslip.io for BOSH release
sed -i '' "s/VersionGitHash=[0-9a-fA-F]*/VersionGitHash=$(git rev-parse --short HEAD)/g" \
  bosh-release/packages/sslip.io-dns-server/packaging
cd bosh-release/
lpass show a # refresh LastPass token
. ~/workspace/deployments/.envrc # set BOSH auth
export BOSH_DEPLOYMENT=sslip.io-dns-server
bosh create-release --force
bosh upload-release
bosh -n -d sslip.io-dns-server deploy ~/workspace/deployments/sslip.io-dns-server.yml --recreate
bosh instances # record the IP address of the instance
IP=10.0.250.22
dig +short 127.0.0.1.example.com @$IP
echo 127.0.0.1
dig +short ns example.com @$IP
printf "ns-aws.sslip.io.\nns-azure.sslip.io.\nns-gce.sslip.io.\n"
dig +short mx example.com @$IP
echo "0 example.com."
dig +short mx sslip.io @$IP
printf "10 mail.protonmail.ch.\n20 mailsec.protonmail.ch.\n"
dig +short txt sslip.io @$IP
printf "\"protonmail-verification=ce0ca3f5010aa7a2cf8bcc693778338ffde73e26\"\n\"v=spf1 include:_spf.protonmail.ch mx ~all\"\n"
dig +short txt 127.0.0.1.sslip.io @$IP # no records
dig +short cname sslip.io @$IP # no records
dig +short cname protonmail._domainkey.sslip.io @$IP
echo protonmail.domainkey.dw4gykv5i2brtkjglrf34wf6kbxpa5hgtmg2xqopinhgxn5axo73a.domains.proton.ch.
dig a _Acme-ChallengE.127-0-0-1.sslip.io @$IP | grep "^127"
echo "127-0-0-1.sslip.io.	604800	IN	A	127.0.0.1"
dig +short sSlIp.Io
echo 78.46.204.247
dig @$IP txt ip.sslip.io +short | tr -d '"'
curl curlmyip.org; echo
dig @$IP txt version.status.sslip.io +short | grep $VERSION
echo "\"$VERSION\""
dig @$IP my-key.kv.sslip.io txt +short # returns nothing
echo " ===" # separator because the results are too similar
dig @$IP put.MyValue.my-key.kv.sslip.io txt +short
echo "\"MyValue\""
echo " ===" # separator because the results are too similar
dig @$IP MY-KEY.kv.sslip.io txt +short
echo "\"MyValue\""
echo " ===" # separator because the results are too similar
dig @$IP delete.my-key.kv.sslip.io txt +short
echo "\"MyValue\""
echo " ===" # separator because the results are too similar
dig @$IP my-key.kv.sslip.io txt +short # returns nothing
pushd ..
git add -p
git ci -vm"BOSH release: $VERSION: kv.sslip.io key-value store"
popd
bosh upload-blobs
bosh create-release \
  --final \
  --tarball ~/Downloads/sslip.io-release-${VERSION}.tgz \
  --version ${VERSION}
git add -N releases/ .final_builds/
git add -p
git ci --amend
git tag $VERSION
git push
git push --tags
bosh upload-release
cd ..
bin/make_all
scp bin/sslip.io-dns-server-linux-arm64 ns-aws:
ssh ns-aws sudo install sslip.io-dns-server-linux-arm64 /usr/bin/sslip.io-dns-server
ssh ns-aws sudo shutdown -r now
  • Browse to https://github.com/cunnie/sslip.io/releases/new to draft a new release
  • Drag and drop ~/Downloads/sslip.io-release-${VERSION}.tgz to the Attach binaries... section
  • Drag and drop the executables in bin/ to the Attach binaries... section.
fly -t nono trigger-job -j dockerfiles/build-and-push-sslip.io-dns-server

Prepare the BOSH release

shasum ~/Downloads/sslip.io-release-${VERSION}.tgz
lpass show a # refresh LastPass token so we don't get stuck next step
z deployments
git pull -r
nvim sslip.io.yml
bosh -e vsphere -d sslip.io deploy sslip.io.yml -l <(lpass show --note deployments.yml) --no-redact
dig @ns-azure 127-0-0-1.sslip.io +short  # output should be 127.0.0.1
dig @ns-azure.nono.io txt version.status.sslip.io +short
git add -p
git ci -v -m"Bump sslip.io BOSH release: $OLD_VERSION$VERSION"
git push
popd

Update the webservers with the HTML with new versions:

ssh nono.io curl -L -o /www/sslip.io/document_root/index.html https://raw.githubusercontent.com/cunnie/sslip.io/master/k8s/document_root/index.html
ssh ns-aws.sslip.io curl -L -o /var/nginx/sslip.io/index.html https://raw.githubusercontent.com/cunnie/sslip.io/master/k8s/document_root/index.html

Update GCP/GKE with the new executable:

kubectl rollout restart deployment/sslip.io
kubectl rollout restart deployment/sslip.io-nginx