Your First Functional Deployment!
Functional programming is wonderful, but what happens after we're done writing code (functionally) and we need to put it in production? The most popular solution is to write a shell script that manually performs the work of installing dependencies, configuring the target, and running our software. This approach is hopelessly imperative and lacks reproducibility, immutability, and simplicity, things we otherwise take for granted. Can we do better?
The Nix package manager and ecosystem brings the functional programming approach to bear on the the problems of installing, configuring, maintaining, and upgrading software, and allows your development and operations teams to realise the promise of functional programming to move faster, break nothing, and sleep better at night.
In this workshop I'll walk you through the process of making your first functional deployment and effectively dealing with change. I hope that after this you will be inspired to take a closer look at Nix and see what it can do for you and your team!
Outline/Structure of the Workshop
1. Create a single-file Haskell web app with Scotty.
2. Use the Nix package manager to build the app without touching any Haskell tooling directly.
3. Create a NixOps description of a VirtualBox web server.
4. Spin up a web server with NixOps.
5. Configure the Haskell web app to run on the server.
6. Deploy the Haskell web app to the server.
7. Confirm that the app works as expected on the server.
8. Modify the app in response to changing requirements.
9. Deploy the changed app to the web server.
10. Confirm that everything works!
11. Roll back if desired/required.
Participants will have a working understanding of Nix and NixOps and how to use them after this talk, and an installation of NixOS in a virtual machine that they can play with.
Anyone who's interested in what happens between cutting a release and seeing it in production.
Prerequisites for Attendees
- A Linux or macOS laptop. Windows laptops do not enjoy the same level of support but might still work.
- An installation of VirtualBox.
- An installation of the Nix package manager: https://nixos.org/nix/
- An installation of NixOps: https://nixos.org/nixops/
- A quick skim of https://medium.com/@MrJamesFisher/nix-by-example-a0063a1a4c55 (optional)
- Basic knowledge of web development