refactor progress
This commit is contained in:
99
fluxer_gateway/scripts/docker_entrypoint.sh
Executable file
99
fluxer_gateway/scripts/docker_entrypoint.sh
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -eu
|
||||
|
||||
NODE_BASE_NAME="${FLUXER_GATEWAY_NODE_BASENAME:-fluxer_gateway}"
|
||||
|
||||
if [ -z "${FLUXER_GATEWAY_NODE_FLAG:-}" ] && [ -n "${FLUXER_GATEWAY_NODE_NAME:-}" ]; then
|
||||
case "${FLUXER_GATEWAY_NODE_NAME}" in
|
||||
*@*)
|
||||
FLUXER_GATEWAY_NODE_FLAG="-name"
|
||||
;;
|
||||
*)
|
||||
FLUXER_GATEWAY_NODE_FLAG="-sname"
|
||||
;;
|
||||
esac
|
||||
export FLUXER_GATEWAY_NODE_FLAG
|
||||
fi
|
||||
|
||||
if [ -z "${FLUXER_GATEWAY_NODE_HOST:-}" ]; then
|
||||
if [ -n "${HOSTNAME:-}" ]; then
|
||||
FLUXER_GATEWAY_NODE_HOST="$HOSTNAME"
|
||||
else
|
||||
FLUXER_GATEWAY_NODE_HOST="$(hostname)"
|
||||
fi
|
||||
export FLUXER_GATEWAY_NODE_HOST
|
||||
fi
|
||||
|
||||
if [ -n "${FLUXER_GATEWAY_NODE_FLAG:-}" ]; then
|
||||
case "$FLUXER_GATEWAY_NODE_FLAG" in
|
||||
-name | -sname)
|
||||
;;
|
||||
*)
|
||||
echo "Invalid FLUXER_GATEWAY_NODE_FLAG: $FLUXER_GATEWAY_NODE_FLAG" >&2
|
||||
exit 64
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -z "${FLUXER_GATEWAY_NODE_FLAG:-}" ]; then
|
||||
NODE_MODE=""
|
||||
if [ -n "${FLUXER_GATEWAY_NODE_MODE:-}" ]; then
|
||||
NODE_MODE="$FLUXER_GATEWAY_NODE_MODE"
|
||||
fi
|
||||
|
||||
if [ -z "$NODE_MODE" ]; then
|
||||
FQDN_HOST=""
|
||||
if command -v hostname >/dev/null 2>&1; then
|
||||
FQDN_HOST="$(hostname -f 2>/dev/null || true)"
|
||||
fi
|
||||
|
||||
if [ -n "$FQDN_HOST" ] && printf '%s' "$FQDN_HOST" | grep -q '\.'; then
|
||||
NODE_MODE="long"
|
||||
FLUXER_GATEWAY_NODE_HOST="$FQDN_HOST"
|
||||
else
|
||||
if printf '%s' "$FLUXER_GATEWAY_NODE_HOST" | grep -q '\.'; then
|
||||
NODE_MODE="long"
|
||||
else
|
||||
NODE_MODE="short"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$NODE_MODE" in
|
||||
long)
|
||||
FLUXER_GATEWAY_NODE_FLAG="-name"
|
||||
;;
|
||||
short)
|
||||
FLUXER_GATEWAY_NODE_FLAG="-sname"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid FLUXER_GATEWAY_NODE_MODE: $NODE_MODE" >&2
|
||||
exit 64
|
||||
;;
|
||||
esac
|
||||
|
||||
export FLUXER_GATEWAY_NODE_FLAG
|
||||
export FLUXER_GATEWAY_NODE_HOST
|
||||
fi
|
||||
|
||||
if [ -z "${FLUXER_GATEWAY_NODE_NAME:-}" ]; then
|
||||
if [ "$FLUXER_GATEWAY_NODE_FLAG" = "-name" ]; then
|
||||
FLUXER_GATEWAY_NODE_NAME="${NODE_BASE_NAME}@${FLUXER_GATEWAY_NODE_HOST}"
|
||||
else
|
||||
SAFE_HOST="$(printf '%s' "$FLUXER_GATEWAY_NODE_HOST" | tr -c 'A-Za-z0-9' '_' | tr 'A-Z' 'a-z')"
|
||||
FLUXER_GATEWAY_NODE_NAME="${NODE_BASE_NAME}_${SAFE_HOST}"
|
||||
fi
|
||||
export FLUXER_GATEWAY_NODE_NAME
|
||||
fi
|
||||
|
||||
if [ "$FLUXER_GATEWAY_NODE_FLAG" = "-sname" ]; then
|
||||
case "$FLUXER_GATEWAY_NODE_NAME" in
|
||||
*@*)
|
||||
echo "FLUXER_GATEWAY_NODE_NAME must not include '@' when using -sname." >&2
|
||||
exit 64
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
exec /opt/fluxer_gateway/bin/fluxer_gateway foreground
|
||||
61
fluxer_gateway/scripts/rebar3_wrapper.sh
Executable file
61
fluxer_gateway/scripts/rebar3_wrapper.sh
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2026 Fluxer Contributors
|
||||
#
|
||||
# This file is part of Fluxer.
|
||||
#
|
||||
# Fluxer is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Fluxer is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Usage: $0 <rebar3 args...>" >&2
|
||||
exit 64
|
||||
fi
|
||||
|
||||
ASDF_SHIMS_PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims"
|
||||
if [ -d "$ASDF_SHIMS_PATH" ]; then
|
||||
export PATH="$ASDF_SHIMS_PATH:$PATH"
|
||||
fi
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
if [ -f "$SCRIPT_DIR/../rebar.config" ]; then
|
||||
GATEWAY_DIR=$(cd "$SCRIPT_DIR/.." && pwd)
|
||||
REPO_ROOT=$(cd "$GATEWAY_DIR/.." && pwd)
|
||||
else
|
||||
REPO_ROOT=$(cd "$SCRIPT_DIR/../.." && pwd)
|
||||
GATEWAY_DIR="$REPO_ROOT/fluxer_gateway"
|
||||
fi
|
||||
|
||||
if [ -z "${FLUXER_CONFIG:-}" ] && [ -f "$REPO_ROOT/config/config.test.json" ]; then
|
||||
export FLUXER_CONFIG="$REPO_ROOT/config/config.test.json"
|
||||
fi
|
||||
|
||||
should_skip_plugins=true
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
fmt | plugins)
|
||||
should_skip_plugins=false
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$should_skip_plugins" = true ]; then
|
||||
export REBAR_SKIP_PROJECT_PLUGINS=1
|
||||
fi
|
||||
|
||||
cd "$GATEWAY_DIR"
|
||||
|
||||
exec rebar3 "$@"
|
||||
23
fluxer_gateway/scripts/run_compile.sh
Executable file
23
fluxer_gateway/scripts/run_compile.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2026 Fluxer Contributors
|
||||
#
|
||||
# This file is part of Fluxer.
|
||||
#
|
||||
# Fluxer is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Fluxer is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
"$SCRIPT_DIR/rebar3_wrapper.sh" compile
|
||||
23
fluxer_gateway/scripts/run_dialyzer.sh
Executable file
23
fluxer_gateway/scripts/run_dialyzer.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2026 Fluxer Contributors
|
||||
#
|
||||
# This file is part of Fluxer.
|
||||
#
|
||||
# Fluxer is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Fluxer is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
"$SCRIPT_DIR/rebar3_wrapper.sh" dialyzer
|
||||
23
fluxer_gateway/scripts/run_eunit.sh
Executable file
23
fluxer_gateway/scripts/run_eunit.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2026 Fluxer Contributors
|
||||
#
|
||||
# This file is part of Fluxer.
|
||||
#
|
||||
# Fluxer is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Fluxer is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
"$SCRIPT_DIR/rebar3_wrapper.sh" eunit
|
||||
23
fluxer_gateway/scripts/run_fmt.sh
Executable file
23
fluxer_gateway/scripts/run_fmt.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2026 Fluxer Contributors
|
||||
#
|
||||
# This file is part of Fluxer.
|
||||
#
|
||||
# Fluxer is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Fluxer is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
"$SCRIPT_DIR/rebar3_wrapper.sh" fmt
|
||||
25
fluxer_gateway/scripts/run_prod_compile.sh
Executable file
25
fluxer_gateway/scripts/run_prod_compile.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2026 Fluxer Contributors
|
||||
#
|
||||
# This file is part of Fluxer.
|
||||
#
|
||||
# Fluxer is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Fluxer is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with Fluxer. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
||||
|
||||
"$SCRIPT_DIR/rebar3_wrapper.sh" as prod clean -a
|
||||
"$SCRIPT_DIR/rebar3_wrapper.sh" as prod compile
|
||||
Reference in New Issue
Block a user