Delete entrypoint.sh
Browse files- entrypoint.sh +0 -74
entrypoint.sh
DELETED
|
@@ -1,74 +0,0 @@
|
|
| 1 |
-
#!/bin/sh
|
| 2 |
-
set -eu
|
| 3 |
-
|
| 4 |
-
: "${RELEASE_COMMON_SH:=/usr/local/bin/release-common.sh}"
|
| 5 |
-
: "${SUPERVISORD_BIN:=/usr/bin/supervisord}"
|
| 6 |
-
: "${SUPERVISOR_CONF_TEMPLATE:=/etc/supervisord.conf.template}"
|
| 7 |
-
: "${OPEN_FILE_LIMIT:=65535}"
|
| 8 |
-
|
| 9 |
-
. "$RELEASE_COMMON_SH"
|
| 10 |
-
|
| 11 |
-
export RUNTIME_DIR
|
| 12 |
-
export SUPERVISOR_CONF
|
| 13 |
-
|
| 14 |
-
shell_quote() {
|
| 15 |
-
printf "'%s'" "$(printf '%s' "$1" | sed "s/'/'\"'\"'/g")"
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
escape_sed_replacement() {
|
| 19 |
-
printf '%s' "$1" | sed 's/[\/&]/\\&/g'
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
write_supervisord_conf() {
|
| 23 |
-
mkdir -p "$(dirname "$SUPERVISOR_CONF")"
|
| 24 |
-
app_program_name=$(escape_sed_replacement "$SUPERVISOR_PROGRAM_NAME")
|
| 25 |
-
updater_program_name=$(escape_sed_replacement "$SUPERVISOR_UPDATER_PROGRAM_NAME")
|
| 26 |
-
|
| 27 |
-
sed \
|
| 28 |
-
-e "s/__APP_PROGRAM__/$app_program_name/g" \
|
| 29 |
-
-e "s/__UPDATER_PROGRAM__/$updater_program_name/g" \
|
| 30 |
-
"$SUPERVISOR_CONF_TEMPLATE" > "$SUPERVISOR_CONF"
|
| 31 |
-
}
|
| 32 |
-
|
| 33 |
-
write_run_app_script() {
|
| 34 |
-
run_app_script="$RUNTIME_DIR/run-app.sh"
|
| 35 |
-
|
| 36 |
-
{
|
| 37 |
-
printf '#!/bin/sh\n'
|
| 38 |
-
printf 'set -eu\n'
|
| 39 |
-
printf 'exec "%s"' "$(current_binary_path)"
|
| 40 |
-
for arg in "$@"; do
|
| 41 |
-
printf ' %s' "$(shell_quote "$arg")"
|
| 42 |
-
done
|
| 43 |
-
printf '\n'
|
| 44 |
-
} > "$run_app_script"
|
| 45 |
-
|
| 46 |
-
chmod +x "$run_app_script"
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
prepare_runtime_environment() {
|
| 50 |
-
ulimit -n "$OPEN_FILE_LIMIT"
|
| 51 |
-
ensure_runtime_dirs
|
| 52 |
-
rm -f "$RUNTIME_DIR/supervisor.sock" "$RUNTIME_DIR/supervisord.pid"
|
| 53 |
-
}
|
| 54 |
-
|
| 55 |
-
bootstrap_release_or_exit() {
|
| 56 |
-
if ! ensure_initial_release; then
|
| 57 |
-
echo "错误: 初次启动时无法准备可运行版本" >&2
|
| 58 |
-
exit 1
|
| 59 |
-
fi
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
start_supervisord() {
|
| 63 |
-
exec "$SUPERVISORD_BIN" -c "$SUPERVISOR_CONF"
|
| 64 |
-
}
|
| 65 |
-
|
| 66 |
-
main() {
|
| 67 |
-
prepare_runtime_environment
|
| 68 |
-
write_supervisord_conf
|
| 69 |
-
bootstrap_release_or_exit
|
| 70 |
-
write_run_app_script "$@"
|
| 71 |
-
start_supervisord
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
main "$@"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|