layout: true name: titleslide class: center, middle
.footnote[ ###
@schmonz
####
#AATC2017
[schmonz.com/talk
/2017-aatc](https://schmonz.com/talk/2017-aatc/) ] --- layout: true name: footnotelinks .left-column[
] .footnote[ ###
@schmonz
####
#AATC2017
[schmonz.com/talk
/2017-aatc](https://schmonz.com/talk/2017-aatc/) ] --- template: titleslide # Cross-Platform Full-Stack Deployment
## Amitai Schleier ### Agile Alliance Technical Conference ### 2017/04/20 ??? 1. Press 'C' to clone and move it to projector 2. Press 'P' to show these here presenter notes ### 90 minutes Sure, it works on your machine. But how confident are you that your Linux servers provide the same runtime environment as your Mac laptop? And when there's a security hole somewhere in your app stack, how quickly and safely can you upgrade to fix it? How much happier would you be if you could generate identical software configurations for your dev and prod boxen, no matter what OS they run? Stop crossing your fingers that brew-ing here and apt-get-ing there will produce matching results. You deserve DevOps happiness! Learn how to pronounce "pkgsrc" -- and how a practical, proven cross-platform package manager can save you from the kind of surprises that ruin your week. --- layout: false template: footnotelinks .right-column[ # Required: Enough Laptops - Running any Unixy OS (maybe even
Windows Subsystem for Linux
), - With a working C compiler, - And a cloned [pkgsrc-2017Q1 tree](https://github.com/jsonn/pkgsrc.git) - (Post-clone, run `git checkout pkgsrc_2017Q1`)
] ??? - Need pkgsrc? All USB sticks have a `.zip` (already on the right branch) - Need a Unix VirtualBox? A couple USB sticks have NetBSD and Ubuntu - File -> Import Appliance... - Username/password: "aatc"/"aatc" --- .right-column[ # Required: Code of Conduct ## [agilealliance.org/the-alliance
/code_of_conduct](https://www.agilealliance.org/the-alliance/code_of_conduct)
] --- .right-column[ # Why have a CoC? ## [agilealliance.org/the-alliance
/code_of_conduct](https://www.agilealliance.org/the-alliance/code_of_conduct) **Not** to prevent behavior we don't like -- nothing can -- but To remind ourselves, when we see some, how _we'll_ want to behave. ] -- .right-column[ ### Why do we test-drive code? It's a cognitive aid: Declaring our intentions helps us live up to them. ] --- .right-column[ # Specification By Example ## [agilealliance.org/the-alliance
/code_of_conduct](https://www.agilealliance.org/the-alliance/code_of_conduct) ### Key features 1. "Harassment includes..." 2. "To make clear what is expected..." 3. "If you are being harassed, notice that someone else is being harassed, or..." ### Homework Build shared understanding: Hit the [Learning Lounge](https://www.agilealliance.org/agile-alliance-technical-conference-2017/program/special-events/) and pair with someone on a few Gherkin examples for this Code of Conduct. (Extra credit: Figure out how to automate them.) ] --- .right-column[ # _How_ We'll Learn ## 1. Talk a little ## 2. Pair a little ## 3. Solo a little ] --- .right-column[ # _What_ We'll Learn ## 1. Get pkgsrc (and get rid of it) ## 2. Install `$FOO` from source ## 3. Update laptop from source ## 4. Update server from binaries ## 5. Build deploy-ready binaries ## 6. Package your own code ] --- .right-column[ # Move Your Feet ## Two options: ### 1. Not your thing? Cool, find something else or ### 2. Sound good? Cool, find your new pair partner ] --- .right-column[ # Get These Slides ##
schmonz.com/talk
/2017-aatc
] ??? There's a payoff at the end! --- .right-column[ # 1.1. Get pkgsrc ```sh $ git clone https://github.com/jsonn/pkgsrc.git $ cd pkgsrc && git checkout pkgsrc_2017Q1 $ cd bootstrap && ./bootstrap --unprivileged $ sudo vi /etc/paths # add ~/pkg/sbin and ~/pkg/bin $ pkg_info ``` ] ??? While you wait, I'll set up a mail server! --- .right-column[ # 1.2. Get rid of pkgsrc ```sh $ rm -rf ~/pkg $ rm -rf .../pkgsrc ``` ] --- .right-column[ # 2.1. Install _newer_ ```sh $ git --version $ cd .../pkgsrc/*/git-base $ bmake install $ bmake clean $ git --version ``` ] --- .right-column[ # 2.2. Install _safer_ ## [openssl.org/news
/vulnerabilities.html](https://www.openssl.org/news/vulnerabilities.html) ```sh $ openssl version $ cd .../pkgsrc/*/openssl $ bmake install clean $ openssl version ``` ] --- .right-column[ # 2.3. Install _trickier_ ## [smashcompany.com/technology
/i-hate-dependencies](http://www.smashcompany.com/technology/i-hate-dependencies) ```sh $ cd .../pkgsrc/*/ruby-nokogiri $ bmake install clean ``` ] ??? What isn't totally making sense yet? --- .right-column[ # 2.4. Install _customizier_ ## [vimdoc.sourceforge.net/htmldoc
/usr_90.html](http://vimdoc.sourceforge.net/htmldoc/usr_90.html) ```sh $ cd .../pkgsrc/*/vim $ bmake show-installed-depends $ bmake show-options $ vi ~/pkg/etc/mk.conf # add PKG_OPTIONS.vim+=python $ bmake show-options $ bmake sid $ bmake install clean $ ldd ~/pkg/bin/vim # or otool -L ``` ] --- .right-column[ # 3. Update laptop, from source ```sh $ pkg_rolling-replace -suv ``` Oh yeah, and rebuild everything with our preferred OpenSSL: ```sh $ vi ~/pkg/etc/mk.conf # add PREFER_PKGSRC=openssl $ cd ~/pkg/pkgdb && grep "blddep openssl" */+CONTENTS \ | cut -d / -f 1 | sort -u \ | xargs pkg_admin set rebuild=YES $ pkg_rolling-replace -sv $ pkg_info openssl ``` ] --- .right-column[ # 4. Update server, from binaries ```sh $ sudo pkgin update $ sudo pkgin upgrade ``` ] --- .right-column[ # 5. Build deploy-ready binaries ```sh $ cd .../pkgsrc/*/pkg_comp && make install clean $ sudo pkg_comp auto bash sudo tmux qmail-run ``` ] ??? - "If you depend on it, update more often. Keep your search space small. When things break -- and they will -- you'll understand sooner." - Example: post-branch, https://github.com/mattn/p5-Devel-CheckLib/issues/23 - Count dependencies: pkg_comp, built, installed --- .right-column[ # 6. Package your own code ## [netbsd.org/docs
/pkgsrc/creating.html](https://www.netbsd.org/docs/pkgsrc/creating.html) ```sh $ url2pkg http://www.libsrs2.org/srs/libsrs2-1.0.18.tar.gz $ vi Makefile # etc. ``` ] --- .right-column[ # Summary - Uniquely flexible package manager - Uniquely powerful supporting infrastructure - 20 years of automation effort - Your habits are portable across systems - No magic ] --- .right-column[ # Retrospective - For speed, start from VM or Docker image - The Git example was realistic; could replace a custom script - For speed, pick an example with fewer dependencies - The OpenSSL security example was relevant - Use `cd */foo` to switch to a subdirectory without knowing its parent - Could use nicer ["porcelain"](http://stackoverflow.com/questions/6976473/what-does-the-term-porcelain-mean-in-git) - Harder than `yum`, but also does more - Could especially help manage dependencies on dev machines -
Nix
is a very interesting package manager, competes with pkgsrc ] --- .right-column[ # Rate This Session ## [submissions.agilealliance.org/aatc2017
/feedback/5813](https://submissions.agilealliance.org/aatc2017/feedback/5813)
] --- .right-column[ # Agile in 3 Minutes > "Before Agile in 3 Minutes, I couldn't get my team to have a > conversation about important topics. Now I have to timebox it." ##
agilein3minut.es
] --- .right-column[ # Agile in 3 Minutes: The Book The simplest _essays_ that could possibly work. $4 today! ## [leanpub.com/agilein3minutes
/c/aatc17](https://leanpub.com/agilein3minutes/c/aatc17)
] --- .right-column[ # Let's Keep Going Does your company deliver valuable software? Maybe I can help. Consulting, coaching, training. ##
schmonz.com/coach
] --- template: titleslide # Cross-Platform Full-Stack Deployment
## Amitai Schleier ### [schmonz.com](https://schmonz.com)