my deployment platform is a shell script
Jes Olson j3s@c3f.net
Tue, 09 Apr 2024 18:52:08 -0400
4 files changed,
227 insertions(+),
0 deletions(-)
M
templates/now.html
→
templates/now.html
@@ -16,6 +16,27 @@ <p>
books i have finished: <a href="https://openlibrary.org/people/j3sj3sj3s/books/already-read">linky</a> </p> <h4>journal</h4> +<p><b>2023-04-09</b></p> +<li>spent summer and winter with my parents</li> +<li>and my sister</li> +<li>and maddy</li> +<li>fell in love and</li> +<li>moved to virginia</li> +<li>backed a trailer up</li> +<li>(it was hard)</li> +<li>...</li> +<li>started exercise</li> +<li>got promoted</li> +<li>spent a lot of time reflecting</li> +<li>gained 12lbs :D</li> +<li>decided to care more</li> +<li>but also less.</li> +<li>looking at a happy place</li> +<li>i'll find a healthy way</li> +<li>to live & talk & breathe</li> +<li>& interact with the things i love</li> +<li>but are so, so bad for me.</li> +<li>guess we'll see!!</li> <p><b>2023-03-10</b></p> <li>went up the cali coast</li> <li>to morro bay, san diego</li>
M
templates/thoughts.html
→
templates/thoughts.html
@@ -3,6 +3,8 @@ {{ template "head" . }}
{{ template "nav" . }} <div id="main"> <h3>thoughts</h3> +<h4>2024</h4> +<li><a href="/thought/my-deployment-platform-is-a-shell-script.html">my deployment platform is a shell script</a></li> <h4>2023</h4> <li><a href="/thought/recover-lost-text-by-coredumping-firefox.html">recover lost text by coredumping firefox</a></li> <li><a href="/thought/shell-tip-print-json-with-printf.html">shell tip: print json with printf</a></li>
A
thought/my-deployment-platform-is-a-shell-script.html
@@ -0,0 +1,139 @@
+my deployment platform is a shell script +2024-04-09 + +like many people, i fell in love with free software +because i could install it. i'd come home from work and +install a bunch of software. + +what fun! tee hee! a playground and i'm the prince! + +but eventually, relentlessly, it all starts to feel more +like a horror show. + +proxmox needs an upgrade! *SPOOKY WIND* +how the fuck does k8s work again?? *SPOOKY CRICKETS* +promql *EXISTENTIAL SCREAM* + + +i'm too old now - i'm more fickle with my time. i like +things that work for years with as little interaction +from me as possible. + +when it comes to my own projects, i always prioritize +maintainability. + +to that end, i built a little deployment system that i +run on a single virtual machine - it's a shell script! + +i run it every minute via cron. + +here's the script, in its entirety: + + #!/bin/sh + + println() { + printf "%s\n" "$1" >> /root/gocicd.log + } + + die() { + printf "%s\n" "$1" >> /root/gocicd.log + exit 1 + } + + cd /root + for project in $(ls go-cicd); do + cd "/root/go-cicd/$project" 2>&1 >> /root/gocicd.log + git fetch origin 2>&1 >> /root/gocicd.log + if git status | grep -q behind; then + println "$(date): building $project" + git merge origin/main || + git merge origin/master || + die "could not merge $project" + go build || + die "could not build $project" + mv "$project" "/usr/local/bin/$project" + cat <<EOF >/etc/init.d/$project" + #!/sbin/openrc-run + + supervisor="supervise-daemon" + command="/usr/local/bin/j3s.sh" + directory="/root/go-cicd/j3s.sh" + EOF + service "$project" restart + exec gocicd + fi + done + +whenever i make an upstream change to any of my tracked +projects, it is cloned, built, and running within 60 +seconds. + +this gives me a lot of joy. the blog post you're reading +right now was deployed using this system (j3s.sh is a go +application). + +this has worked for many years with no maintenance at +all! + +my script will never: + - go down + - require an upgrade + - force me to migrate + - surprise me + - keep me up at night + +all of this makes jes very happy. + + +digging in a little, the contents of the go-cicd dir look like this: + + $ ls go-cicd/ + existentialcrisis.sh jackal nekobot + j3s.sh vore neoarkbot + +these are all of my "tracked projects". + +to start tracking a new project, i only need to clone a +repository: + + $ cd go-cicd + $ git clone git.j3s.sh/newproject + +now whenever a new commit is made to +git.j3s.sh/newproject, it is deployed within 60 seconds. + +ez. + +here's a little taste of the log file: + + $ tail -n 5 go-cicd.log + Thu Feb 8 00:13:12 UTC 2024: building vore + Fri Feb 9 22:08:25 UTC 2024: building vore + Mon Apr 8 02:07:00 UTC 2024: building j3s.sh + Mon Apr 8 02:59:00 UTC 2024: building j3s.sh + Tue Apr 9 21:11:00 UTC 2024: building vore + +cool! i wonder what happened in march. +(oh, i moved to Virginia, right) + + +i recognize that this script is pretty limited. it can +only deploy golang applications to my alpine system, but +that's exactly the point i'm trying to prove: + +a little, specific solution might be easier to maintain +and straight up more enjoyable than a larger, more +general system. + +i spent maybe 10 minutes writing this script in December +of 2021, and i'm proud of how reliable it has been. + +consider keeping your little things little. + +it worked for little old me. + + +until next time, with love from virginia, + + + lil jes
A
thought/prioritize-maintainability.html
@@ -0,0 +1,65 @@
+draft + +prioritize maintainability +2024-04-09 + +tech hype sucks. + +i have been around long enough to see the cycle. a +new technology breaks ground. every developer at every +tech company wants to start using it. not because it's a +good idea to use it, but because it's a FUN idea. and all +the big boys are doing it, so it couldn't possibly be a +bad idea. + +let's be honest - it's also a good career move. getting +good at Chef in 2009 is getting good with AWS in 2010 is +getting good at kubernetes in 2015 is getting good at +?????ARTIFICIAL???INTELLIGENCE?????? in 2024. + +these people make a lot of money and have tons of fun, +and i've done this too, in my earlier years. + +bust out some hype new tech + force it into being implemented + support it until i can claim success + bail, leaving other suckers to pick up the pieces + +unmaintanable. messes. + +in one case, when jenkins was hype a dev crafted a giant +wall of impenetrable that nobody else could +read, rigged it up to openshift, migrated a few +springboot applications, got promoted then bailed. + +can you believe that i had so much trouble tearing it out +that i opted to learn _groovy_? + +another time, it was me. i had been pushing prometheus, +because hey - graphite sucks now, right? + +and prometheus is cool, and hot, and good! + +the senior engineers around me resisted me at every turn, +but nobody told me no. + +would've spent my time differently. it's not his +fault for building that abomination in an industry that +rewards abomination-building. it's not my fault for +agreeing to take care of it. + + + + +it felt kind of fun the first time! getting my hands +dirty with some new piece of tech. but these days i am +more fickle with my time, because i value it more. +because my time is passing, and i'm starting to feel it. + +is this what it means to get old??? being more fickle +with the time you have left? + + + +it's not a good use of my time to sweep up last year's +hype. i'll sigh & grab my broom