Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
1.6 kB · 26 lines
123456789101112131415161718192021222324252627#!/bin/sh# VM defaults must be installed before Erlang starts in every launch mode.# The daemon waits on the network and its kernels, so two schedulers that never# spin carry it. Mostly-empty heap and binary carriers are abandoned (acul) and# their free pages handed back (acful), and freed segments are not cached# (MMmcs), so memory a busy turn took goes back once it is over.# Keep ten dirty-I/O threads: SQLite waits/fsync and file reads share this pool.# Two blocked calls must not stall unrelated storage or health requests.set -eu# Application startup can log before Gleam main runs. Keep diagnostics off the# helpers' JSON stdout, including when a shipment starts dependencies first.vm_defaults='+P 65536 +Q 16384 +S 2:2 +SDcpu 2:2 +SDio 10 +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}}}]'ERL_FLAGS="$vm_defaults ${ERL_FLAGS:-}"export ERL_FLAGSif [ "$#" -eq 0 ] || [ "$1" = storage ]; then source_root=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd) cd "$source_root" if [ "$#" -eq 0 ]; then exec gleam run fi # The helper must replace this process, so cancellation kills its VM rather # than a `gleam run` parent that could leave SQLite work behind. gleam build </dev/null >&2 exec erl -pa "$source_root"/build/dev/erlang/*/ebin -eval 'albedo@@main:run(albedo)' -noshell -extra "$@"fiexec "$@"