Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of the store location for updater #26

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
19 changes: 9 additions & 10 deletions docker/entrypoint
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash
set -euo pipefail

BINARY_DIR=/app/bin
BINARY_STORE_DIR=${BINARY_STORE_DIR:-/app/config/bin}

get_default_url() {
Expand All @@ -12,9 +11,9 @@ get_default_url() {

copy_binary() {
binary=$1
mkdir -p "${BINARY_DIR}"
cp "${BINARY_STORE_DIR}/${binary}" "${BINARY_DIR}/${binary}"
chmod u+x "${BINARY_DIR}/${binary}"
mkdir -p "/app/bin"
cp "${BINARY_STORE_DIR}/${binary}" "/app/bin/${binary}"
chmod u+x "/app/bin/${binary}"
}

get_binary() {
Expand All @@ -30,8 +29,8 @@ should_update() {
binary=$1
copy_binary ${binary}
for version in minimum suggested; do
if ${BINARY_DIR}/storagenode-updater should-update ${binary} \
--binary-location "${BINARY_DIR}/${binary}" \
if /app/bin/storagenode-updater should-update ${binary} \
--binary-location "/app/bin/${binary}" \
--identity-dir identity \
--version.server-address="${VERSION_SERVER_URL}" 2>/dev/null
then
Expand Down Expand Up @@ -92,15 +91,15 @@ if [ -n "${LOG_LEVEL:-}" ]; then
fi

if [ "${SETUP:-}" = "true" ]; then
echo "Running ${BINARY_DIR}/storagenode setup $SNO_RUN_PARAMS ${*}"
exec ${BINARY_DIR}/storagenode setup ${SNO_RUN_PARAMS} ${*}
echo "Running /app/bin/storagenode setup $SNO_RUN_PARAMS ${*}"
exec /app/bin/storagenode setup ${SNO_RUN_PARAMS} ${*}
else
sed -i \
"s#^command=/app/bin/storagenode-updater\$#command=${BINARY_DIR}/storagenode-updater run --binary-location ${BINARY_DIR}/storagenode ${RUN_PARAMS} #" \
"s#^command=/app/bin/storagenode-updater\$#command=/app/bin/storagenode-updater run --binary-location /app/bin/storagenode --binary-store-dir ${BINARY_STORE_DIR} ${RUN_PARAMS} #" \
/etc/supervisor/supervisord.conf

sed -i \
"s#^command=/app/bin/storagenode\$#command=${BINARY_DIR}/storagenode run ${SNO_RUN_PARAMS} ${*}#" \
"s#^command=/app/bin/storagenode\$#command=/app/bin/storagenode run ${SNO_RUN_PARAMS} ${*}#" \
/etc/supervisor/supervisord.conf

# remove explicit user flag when container is run as non-root
Expand Down
Loading