69: Stack Docker Adventure - JSToElm
All Episodes

69: Stack Docker Adventure

We started with an idea to use Haskell on AWS Lambda so we didn't have to deal with OS setup, config, update, and headache. By the end we found ourselves partitioning our local drive to dual boot it into Linux, running `sudo apt update` a dozen or so times. How did things go so wrong?

Serverless

  • Call it whatever you want. I just like the lack of sysAdmin work there is to do.
  • That being said. I just recently spent a silly amount of time self hosting a wordpress instance bc I wanted fine grain control.
  • With serverless, I still have control over the pieces I care about, and don’t have to worry about the rest.
  • Meow Notes API is all serverless. And Even from a ‘cold’ start it’s pretty snappy.

Setup

  • Stack with using the build in docker support

  • MB:lambda-haskell> stack install aws-lambda-haskell-runtime

  • Wait progress 2 of 110 ?!? This is when I need to remember that I spend my days waiting for npm to resolve 800 something packages to start a NEW project in JS. Also mad props to the npm team for their thankless hustle and work these past years. I’ve benefited.

    • Convinced this was not a good idea.
    • So I added it to the extra deps like the docs say to 🤷‍♂️
  • Well that’s a bummer. FULL STOP sad panda.

    MB:lambda-haskell> stack clean --docker --verbose
    Version 1.9.3, Git revision 40cf7b37526b86d1676da82167ea8758a854953b (6211 commits) x86_64 hpack-0.31.1
    2019-02-13 21:20:46.269592: [debug] Checking for project config at: /c/Users/jtomc/Documents/Haskell/lambda-haskell/stack.yaml
    2019-02-13 21:20:46.272348: [debug] Loading project config file stack.yaml
    2019-02-13 21:20:46.308044: [debug] Run process: /usr/bin/docker --version
    2019-02-13 21:20:46.460831: [debug] Process finished in 150ms: /usr/bin/docker --version
    2019-02-13 21:20:46.462081: [debug] Run process: /usr/bin/docker inspect fpco/stack-build:lts-12.13
    2019-02-13 21:20:46.628011: [debug] Process finished in 165ms: /usr/bin/docker inspect fpco/stack-build:lts-12.13
    2019-02-13 21:20:46.654578: [debug] Run process: /usr/bin/docker run -v /home/jtomchak/.local/bin/stack:/tmp/stack sha256:8b7fe581dc0148347fae4c883eba74e338bdf1b94df73f0db0c68201d129a454 /tmp/stack --version
    Received ExitFailure 1 when running
    Raw command: /usr/bin/docker run -v /home/jtomchak/.local/bin/stack:/tmp/stack sha256:8b7fe581dc0148347fae4c883eba74e338bdf1b94df73f0db0c68201d129a454 /tmp/stack --version
    
    MB:lambda-haskell>
    

    Pivot

    Plan #1 is to dual boot linux on my notebook. I made the switch last year from Mac to a Surface book, and have been pretty happy with the WLS support on windows. Very slick. BUT I have a lot of duplicate packages installed globally across my linux install and windows, I end up in the cmd more than care to admit, over all it’s great, but make / haskell / compile stuff it’s always a perfect match.

    Plan #2 So I hear Elixir is a thing. If you remember, I picked up a book on it while at Elm Conf last year. Part of my browsing for another language. And while I tried to refocus at that time, and be a bit less scatter brain about what I was diving into, I put the book down, but continued to listen to the podcasts Elixir Outlaws and Elixir Talk. Both shows are a lot of fun.

    Erlang Checklist

    Install

    • sudo apt install esl-erlang

    • sudo apt install elixir

    • $ mix local.hex

    Should now have all the things installed to see if we can stand up a Phoenix Web Framework starter.

    • Oh man Phoenix Web Framework used webpack to bundle up web assets. ♥

    • Ok. Side adventure to ensure

    Plan #1

    • Find a 4GB key
    • Shrink Windows
    • Download Ubuntu, wait choose Mint
    • Partition Manually - Run installer
    • Partition automatically next to windows - Run installer
    • Surface kernel for all the things like display, keyboard, backlight, buttons
    • Windows Secure Boot Disable
    • Ext 4 esf ok. so disable that for dropbox
    • Run all the updates
    • Run all the installers. Work wifi NOT fast
    • Erlang OTP error installing
    • stack docker, however working great.
    • Bitlocker failure, BUT I had the keys

    I like linux. I don’t think I’ve tried it in maybe 10 years other than ssh into a server for various things. Things like dropbox or Google Cloud drive weren’t available. Essentially cross platform apps COUGH Electron.

Still to do

  1. Display port link adapter
  2. Erlang install, Elixir stuck at 1.1-dev
  3. Recording and Editing this show. Audacity just needs to be set up
  4. ssh keys need to by sync’d
  5. aws, azure cli
  6. Elm failed for some bin-wrap thing. need to revisit
  7. And pair my bluetooth mouse. Which is an Apple Magic Mouse, so it won’d scroll. I guess get a mouse?

Picks

Belly full of Elixir

Resources

AWS lambda Haskell Runtime

reddit thread

premission denied

docs

cloudflare V8 Functions

Follow

Published 14 Feb 2019

A show about learning Elm, Functional Programing, and generally leveling up as a JS developer.
JavaScript To Elm on Twitter