summaryrefslogtreecommitdiff
path: root/README.md
blob: cac5b98e671ddc99d0eb0b85d176c0fa9ec69db1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
[![biz build status](https://builds.sr.ht/~ben/biz.svg)](https://builds.sr.ht/~ben/biz?)

# Source layout

    aero    browser apps, compiled with ghcjs
    apex    server-side api stuff, compiled with ghc
    bild    temporary storage for build artifacts
    chip    executable scripts in python, bash
    depo    for deployment, machine-specific nix code
    lore    shared libraries, compiled with either ghc/js
    mode    nixos modules; services and modular config
    pack    nix packages & external packages that we import
    soar    s3/spaces assets, like images, via git-annex

This isn't totally in place yet, but it's something to work toward.

The two special locations are 'soar' and 'bild'. The former is for images and
other assets and is synced to digital ocean's object storage. The latter's
contents are gitignore'd and can be deleted at any time because they will just
be rebuilt later.

# Development

To get a development shell, for example to work on ibb, you can do:

    $ nix-shell -A pack.ibb
    $ ghci
    GHCi, version 8.4.4: http://www.haskell.org/ghc/  :? for help
    Loaded GHCi configuration from /home/ben/src/biz/.ghci
    λ :load apex/Ibb.hs
    [1 of 2] Compiling Influencers      ( apex/Influencers.hs, interpreted )
    [2 of 2] Compiling Ibb              ( apex/Ibb.hs, interpreted )
    Ok, two modules loaded.

The build system topology is defined in `./default.nix`, so follow the import
paths there to see what's available for building and installing locally. For
example, to build `ibb`: `nix-build -A pack.ibb`. Or, to build the main app
server with all dependencies and configuration: `nix-build -A
depo.nutin-madaj.system`. Omitting `.system` will also build a VM that you can
run locally for testing.

## Goals of the developer workflow:

- have minimal ceremony
- default to asynchrony, but allow for synchronous work when necessary
- automate the boring stuff
- standardize environments, tooling, and versions to minimize friction while
  collaborating
- support the longevity and self-sustainability of the project

Ideally, each contributor should be able to go off grid for a day or a week or
more, continue working offline, submit their work when finished, and have no or
minimal conflicts. This also refers to the resiliance of the production systems.

We should never need "out of office" email auto-replies, or urgent contact. No
pager duy, no daily standups. Yes, this policy will affect what code we write,
not just how we write it; that is by design.

# Deployment

To build the production server config locally:

    nix-build -A depo.nutin-madaj.system

To push the built closure and switch to the new configuration (will ask for ssh
passphrase 2x):

    chip/push nutin-madaj