Full-stack Web development with NixOps

November 24, 2016

This is a series of short articles covering the basics of building, testing, deploying, and scaling a Web application using NixOps.

When we're done, we'll have two clusters: a VirtualBox-based cluster for local development and testing, and an EC2-based cluster for production.

Each cluster will look like this:

.-------------------------------------------------------------------------------.
| Web                                                                           |
|                         .-------------------------------------------------.   |
|                         | Cluster                                         |   |
|                         |                                  .----------.   |   |
|                         |         .----------------------->| Frontend |   |   |
|   .------.              |        /   HTTP: /               '----------'   |   |
|   |.------.             |       /                                         |   |
|   '|.------.            |   .-------.                      .---------.    |   |
|    '| User |--------------->| Proxy |                  .-->| Backend |    |   |
|     '------'  HTTP: /*  |   '-------'                 /    '---------'    |   |
|                         |       \                    /                    |   |
|                         |        \                  /      .----------.   |   |
|                         |         '----------------+------>| Backend2 |   |   |
|                         |            HTTP: /api/*   \      '----------'   |   |
|                         |                            \                    |   |
|                         |                             \    .----------.   |   |
|                         |                              '-->| Backend3 |   |   |
|                         |                                  '----------'   |   |
|                         |                                                 |   |
|                         '-------------------------------------------------'   |
|                                                                               |
'-------------------------------------------------------------------------------'

Table of contents

  1. Setup
  2. Hello, world!
  3. Toward an API
  4. NixOS backend
  5. Local deployment
  6. Frontend
  7. NixOS frontend
  8. Proxy
  9. EC2 deployment
  10. Scaling out