-
-
Save dch/aee49d986e6acf7621c0b48366dab727 to your computer and use it in GitHub Desktop.
run halbot directly without all the pre-existing crappy shell scripts. This neat little script runs your elixir app just from its name and std FreeBSD pkg layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh -e | |
| # obvious | |
| export APP=$(basename -s .sh $0) | |
| # derived paths are OS dependent | |
| export ERTS=$(find /usr/local/lib/erlang -type d -depth 1 -name erts-\*) | |
| export VERSION=$(cut -swf 2 /usr/local/lib/${APP}/releases/start_erl.data) | |
| # config files | |
| CONFIGS=/usr/local/etc/${APP} | |
| export SYSCONFIG=${CONFIGS}/sys.config | |
| export VMARGS=${CONFIGS}/vm.args | |
| # custom parameters | |
| export PORT=4003 | |
| # BEAM essentials | |
| export LD_LIBRARY_PATH=${ERTS}/lib: | |
| export BINDIR=${ERTS}/bin | |
| export PATH=${BINDIR}:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
| export ROOTDIR=/usr/local/lib | |
| export PROGNAME=${ROOTDIR}/releases/${VERSION}/${APP}.sh | |
| export ERL_LIBS=${ROOTDIR}/lib:/usr/local/erlang/lib | |
| export MODE="-mode embedded" | |
| # elixir | |
| export LANG=en_US.UTF-8 | |
| export LC_ALL=en_US.UTF-8 | |
| # useful BEAM bits | |
| # export ERL_AFLAGS="-kernel shell_history enabled" | |
| # no turds on BEAM exit | |
| export ERL_CRASH_DUMP=/dev/null | |
| export ERL_CRASH_DUMP_BYTES=0 | |
| export ERL_CRASH_DUMP_SECONDS=0 | |
| # debug beam startup | |
| # export VERBOSE="-init_debug " | |
| # ensure epmd is managed by OS daemons and not tied to this app | |
| export EPMD="-start_epmd false" | |
| # keep user sticky fingers out of the console | |
| # see http://erlang.org/doc/man/run_erl.html | |
| # export RUN_ERL_DISABLE_FLOWCNTRL=1 | |
| # export DOTERL="-boot no_dot_erlang" | |
| cd /usr/local/lib/${APP} | |
| ${BINDIR}/erlexec \ | |
| ${VERBOSE} \ | |
| ${DOTERL} \ | |
| ${EPMD} \ | |
| ${MODE} \ | |
| -boot ${ROOTDIR}/releases/${VERSION}/${APP} \ | |
| -boot_var ERTS_LIB_DIR ${ERTS}/../lib \ | |
| -env ERL_LIBS ./rel/${APP}/lib \ | |
| -pa ${ROOTDIR}/lib/${APP}-${VERSION}/consolidated \ | |
| -pz ${ROOTDIR}/lib/${APP}-${VERSION}/ebin \ | |
| -args_file ${VMARGS} \ | |
| -config ${SYSCONFIG} \ | |
| -user Elixir.IEx.CLI \ | |
| -extra \ | |
| --no-halt \ | |
| +iex -- console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment