[emacs-berlin] Literate dev-ops

Arthur Leonard Andersen arthur at andersen.berlin
Wed May 11 12:19:50 UTC 2016

And just as I hit send, it comes to me...

#+BEGIN_SRC yaml :tangle /sshx:my-server|sudo:my-server:/srv/docker-compose.yml
    name: my_postgres
    image: postgres
      - 5432:5432

Being in the block with the cursor hitting `C-c C-v t` invokes

Thanks! :-)

On Wed, May 11 2016, Arthur Leonard Andersen wrote:

> That's awesome! Thanks for hinting me to this video again. It was in my
> "watch later" list, but I just forgot.
> I did not know about the tower of babel. This will simplify many of my
> org-files!
> You tweeted you'd use this to setup your lambdaisland server.
> How do you save config files from an org-mode block to the server?
> I know for sure I am overlooking something here... but trying to execute
> a yaml block just gives me "No org-babel-execute function for yaml".
> On Fri, May 06 2016, Arne Brasseur wrote:
>> I came across this video of someone using org-mode to do "devops" stuff
>> (i.e. server maintenance).
>> It's really good, I'm already using a lot of the ideas in it.
>> https://www.youtube.com/watch?v=dljNabciEGg
>> The main idea is that org + org-babel + tramp == solid gold.
>> - Use tramp syntax to link to common configuration files on the server, so
>> you can open them instantly with C-c C-o
>> - 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.
>> - When these snippets grow into their own thing you can "tangle" them to a
>> file, including a remote file
>> e.g. this is an example of part of my org file that I'm using to deploy new
>> versions of a Clojure app.
>>   :dir: ~/LambdaIsland/app
>>   :END:
>>   #+NAME: current-version
>>   #+BEGIN_SRC sh
>>     VERSION=`head -1 project.clj | sed
>> 's/.defproject.lambdaisland."\(.*\)"/\1/'`
>>     echo $VERSION
>>   #+END_SRC
>>   #+NAME: build-new-uberjar
>>   #+BEGIN_SRC sh :var VERSION=current-version :dir /
>> ssh:root at lambdaisland.com|sudo:web at lambdaisland.com:/var/web/app :results
>> scalar
>>     set -e
>>     git checkout v$VERSION
>>     /opt/bin/lein uberjar 2>&1
>>     mkdir /var/web/deploys/v$VERSION
>>     cp target/lambdaisland.jar /var/web/deploys/v$VERSION
>>     cp -r resources/public /var/web/deploys/v$VERSION
>>   #+END_SRC

More information about the emacs-berlin mailing list