okami.mom/albedo

git clone https://git.nkp.pet/okami.mom/albedo

Aly Raffauffeat(daemon): add native storage helper modes159a58a

main
1.4 KiB24 linesraw
1#!/bin/sh
2# VM defaults must be installed before Erlang starts in every launch mode.
3# The daemon waits on the network and its kernels, so two schedulers that never
4# spin carry it. Mostly-empty heap and binary carriers are abandoned (acul) and
5# their free pages handed back (acful), and freed segments are not cached
6# (MMmcs), so memory a busy turn took goes back once it is over.
7set -eu
8# Application startup can log before Gleam main runs. Keep diagnostics off the
9# helpers' JSON stdout, including when a shipment starts dependencies first.
10vm_defaults='+P 65536 +Q 16384 +S 2:2 +SDcpu 2:2 +SDio 2 +sbwt none +sbwtdcpu none +sbwtdio none +MBsbct 16 +MHsbct 32 +MBlmbcs 256 +MHlmbcs 256 +MBsmbcs 32 +MHsmbcs 32 +MBas aobf +MHas aobf +MBacul 50 +MHacul 50 +MBacful 50 +MHacful 50 +MMmcs 0 -kernel logger [{handler,default,logger_std_h,#{config=>#{type=>standard_error}}}]'
11ERL_FLAGS="$vm_defaults ${ERL_FLAGS:-}"
12export ERL_FLAGS
13if [ "$#" -eq 0 ] || [ "$1" = storage ]; then
14    source_root=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
15    cd "$source_root"
16    if [ "$#" -eq 0 ]; then
17        exec gleam run
18    fi
19    # The helper must replace this process, so cancellation kills its VM rather
20    # than a `gleam run` parent that could leave SQLite work behind.
21    gleam build </dev/null >&2
22    exec erl -pa "$source_root"/build/dev/erlang/*/ebin -eval 'albedo@@main:run(albedo)' -noshell -extra "$@"
23fi
24exec "$@"