diff --git a/containers/alpine/Containerfile b/containers/alpine/Containerfile deleted file mode 100644 index e92daac..0000000 --- a/containers/alpine/Containerfile +++ /dev/null @@ -1,44 +0,0 @@ -ARG IMAGE_TAG=latest - -FROM docker.io/alpine:${IMAGE_TAG} - -ARG TEZOS_VERSION=19.1 -ARG PROTOCOLS=parisbox - -ENV ASCEND_SERVICES=/ascend/services -ENV ASCEND_HEALTHCHECKS=/ascend/healthchecks -ENV ASCEND_SOCKET=/var/run/ascend.socket -ENV ASCEND_LOGS=/var/log/ascend -ENV ASCEND_INIT="tezbox init --setup-services" -ENV TEZBOX_USER=tezos - -RUN adduser -D -H -s /sbin/nologin -G nogroup -g 'Tezos User' ${TEZBOX_USER} - -RUN printf '#!/bin/sh\n\ -if [ -z "$GITHUB_TOKEN" ]; then\n\ - wget "$@" \n\ -else\n\ - wget --header "Authorization: token $GITHUB_TOKEN" "$@" \n\ -fi\n' > /usr/local/bin/auth_wget && chmod +x /usr/local/bin/auth_wget - -# Use auth_wget for downloading files with optional authentication -RUN auth_wget https://raw.githubusercontent.com/alis-is/ascend/main/tools/setup/standalone-linux.sh -O /tmp/setup-ascend.sh && sh /tmp/setup-ascend.sh --prerelease - -RUN mkdir -p /tezbox /tezbox/configuration /tezbox/overrides /tezbox/overrides/context -COPY configuration /tezbox/configuration -RUN chown -R tezos:tezos /tezbox - -COPY bin/tezbox /usr/bin/tezbox -RUN chmod +x /usr/bin/tezbox -RUN chown -R tezos:nogroup /usr/bin/tezbox - -ENV PROTOCOLS=${PROTOCOLS} -RUN echo $PROTOCOLS -ADD tools/cleanup-protocols.lua /tmp/cleanup-protocols.lua -RUN eli /tmp/cleanup-protocols.lua && rm /tmp/cleanup-protocols.lua -ADD tools/download-binaries.lua /tmp/cleanup-protocols.lua -RUN eli /tmp/download-binaries.lua && rm /tmp/download-binaries.lua - -USER root -ENTRYPOINT [ "ascend" ] -CMD ["parisbox"] \ No newline at end of file diff --git a/containers/minimal/Containerfile b/containers/minimal/Containerfile deleted file mode 100644 index e36cf24..0000000 --- a/containers/minimal/Containerfile +++ /dev/null @@ -1,18 +0,0 @@ -ARG IMAGE_TAG=latest - -FROM docker.io/tezos/tezos:${IMAGE_TAG} - -ENV ASCEND_SERVICES=/ascend/services -ENV ASCEND_HEALTHCHECKS=/ascend/healthchecks -ENV ASCEND_SOCKET=/var/run/ascend.socket -ENV ASCEND_LOGS=/var/log/ascend - -RUN printf '#!/bin/sh\n\ -if [ -z "$GITHUB_TOKEN" ]; then\n\ - wget "$@" \n\ -else\n\ - wget --header "Authorization: token $GITHUB_TOKEN" "$@" \n\ -fi\n' > /usr/local/bin/auth_wget && chmod +x /usr/local/bin/auth_wget - -# Use auth_wget for downloading files with optional authentication -RUN auth_wget https://raw.githubusercontent.com/alis-is/ascend/main/tools/setup/standalone-linux.sh -O /tmp/setup-ascend.sh && sh /tmp/setup-ascend.sh --prerelease diff --git a/containers/tezos/Containerfile b/containers/tezos/Containerfile index 97668b3..270ace6 100644 --- a/containers/tezos/Containerfile +++ b/containers/tezos/Containerfile @@ -27,10 +27,6 @@ fi\n' > /usr/local/bin/auth_wget && chmod +x /usr/local/bin/auth_wget # Use auth_wget for downloading files with optional authentication RUN auth_wget https://raw.githubusercontent.com/alis-is/ascend/main/tools/setup/standalone-linux.sh -O /tmp/setup-ascend.sh && sh /tmp/setup-ascend.sh --prerelease -# RUN mkdir -p ${ASCEND_HEALTHCHECKS} -# COPY tools/healthchecks/baker ${ASCEND_HEALTHCHECKS}/baker -# RUN chmod +x ${ASCEND_HEALTHCHECKS}/baker - RUN mkdir -p /tezbox /tezbox/configuration /tezbox/overrides /tezbox/overrides/context COPY configuration /tezbox/configuration RUN chown -R tezos:tezos /tezbox diff --git a/src/box/core.lua b/src/box/core.lua index d068b5b..d84abc1 100644 --- a/src/box/core.lua +++ b/src/box/core.lua @@ -103,6 +103,12 @@ local function inject_ascend_services(protocol, bakers, options) local service_templates_directory = path.combine(serviceDirectory, "template") local baker_service_template = fs.read_file(path.combine(service_templates_directory, "baker.json")) for bakerId, bakerOptions in pairs(bakers) do + local serviceFilePath = path.combine(servicesDirectory, bakerId .. ".hjson") + if fs.exists(serviceFilePath) then + log_debug("service file " .. serviceFilePath .. " already exists, skipping") + goto continue + end + local args = { "run", "with", "local", "node", "${HOME}/.tezos-node", bakerId, "--votefile", "${VOTE_FILE}" } if table.is_array(bakerOptions.args) then for _, arg in ipairs(bakerOptions.args) do @@ -120,18 +126,23 @@ local function inject_ascend_services(protocol, bakers, options) }, { overwrite = true }) baker_service_template = baker_service_template:gsub("\"${BAKER_ARGS}\"", "${BAKER_ARGS}") local service = string.interpolate(baker_service_template, vars) - local serviceFilePath = path.combine(servicesDirectory, bakerId .. ".hjson") + local ok = fs.safe_write_file(serviceFilePath, service) if not ok then log_error("failed to write service file " .. serviceFilePath) os.exit(1) end + ::continue:: end local serviceExtraTemplatesDirectory = path.combine(serviceDirectory, "extra") for _, extraServiceFileName in ipairs(extraServices) do local serviceTemplatePath = path.combine(serviceExtraTemplatesDirectory, extraServiceFileName .. ".json") local serviceFilePath = path.combine(servicesDirectory, extraServiceFileName .. ".hjson") + if fs.exists(serviceFilePath) then + log_debug("service file " .. serviceFilePath .. " already exists, skipping") + goto continue + end local serviceTemplate = fs.read_file(serviceTemplatePath) local service = string.interpolate(serviceTemplate, vars) @@ -140,6 +151,7 @@ local function inject_ascend_services(protocol, bakers, options) log_error("failed to copy extra service file " .. serviceTemplatePath .. " to " .. serviceFilePath) os.exit(1) end + ::continue:: end -- healthchecks diff --git a/src/version-info.lua b/src/version-info.lua index 87ed59a..0e058fa 100644 --- a/src/version-info.lua +++ b/src/version-info.lua @@ -1,4 +1,4 @@ -local TEZBOX_VERSIOn = "0.3.0" +local TEZBOX_VERSIOn = "0.3.1" return { VERSION = TEZBOX_VERSIOn,