<div dir="ltr"><div><div><div><div><div>I came across this video of someone using org-mode to do "devops" stuff (i.e. server maintenance).<br><br></div>It's really good, I'm already using a lot of the ideas in it.<br><br><a href="https://www.youtube.com/watch?v=dljNabciEGg">https://www.youtube.com/watch?v=dljNabciEGg</a><br><br></div>The main idea is that org + org-babel + tramp == solid gold.<br><br></div>- Use tramp syntax to link to common configuration files on the server, so you can open them instantly with C-c C-o<br></div>- Make sh code snippets with :dir set to a tramp string and you can have it execute on the server. You can also configure this for a group of snippets under the same heading with a :dir: property.<br></div><div>- When these snippets grow into their own thing you can "tangle" them to a file, including a remote file<br><br></div>e.g. this is an example of part of my org file that I'm using to deploy new versions of a Clojure app.<br><span style="font-family:monospace,monospace"><br>  :PROPERTIES:<br>  :dir: ~/LambdaIsland/app<br>  :END:<br><br>  #+NAME: current-version<br>  #+BEGIN_SRC sh<br>    VERSION=`head -1 project.clj | sed 's/.defproject.lambdaisland."\(.*\)"/\1/'`<br>    echo $VERSION<br>  #+END_SRC<br><br>  #+NAME: build-new-uberjar<br>  #+BEGIN_SRC sh :var VERSION=current-version :dir /<a href="mailto:ssh%3Aroot@lambdaisland.com">ssh:root@lambdaisland.com</a>|sudo:web@lambdaisland.com:/var/web/app :results scalar<br>    set -e<br>    git checkout v$VERSION<br>    /opt/bin/lein uberjar 2>&1<br>    mkdir /var/web/deploys/v$VERSION<br>    cp target/lambdaisland.jar /var/web/deploys/v$VERSION<br>    cp -r resources/public /var/web/deploys/v$VERSION<br>  #+END_SRC</span><br><br clear="all"><div><div><div><div><div><div><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><a href="https://twitter.com/plexus" target="_blank">@plexus</a> | <a href="http://arnebrasseur.net" target="_blank">arnebrasseur.net</a> <br></div></div></div></div></div>
</div></div></div></div></div></div></div>