diff --git a/.github/workflows/docker-dist-tests.yml b/.github/workflows/docker-dist-tests.yml index 43bdc6bb..304c5959 100644 --- a/.github/workflows/docker-dist-tests.yml +++ b/.github/workflows/docker-dist-tests.yml @@ -14,7 +14,7 @@ on: - '!.github/workflows/docker-dist-tests.yml' - '!.github/workflows/docker-reusable.yml' - 'docker/**' - - '!docker/codex.Dockerfile' + - '!docker/storage.Dockerfile' - '!docker/docker-entrypoint.sh' workflow_dispatch: inputs: @@ -30,7 +30,7 @@ jobs: name: Build and Push uses: ./.github/workflows/docker-reusable.yml with: - nimflags: '-d:disableMarchNative -d:codex_enable_api_debug_peers=true -d:codex_enable_proof_failures=true -d:codex_enable_log_counter=true -d:verify_circuit=true' + nimflags: '-d:disableMarchNative -d:storage_enable_api_debug_peers=true -d:storage_enable_log_counter=true' nat_ip_auto: true tag_latest: ${{ github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/') }} tag_suffix: dist-tests diff --git a/.github/workflows/docker-reusable.yml b/.github/workflows/docker-reusable.yml index 41eccda5..b1a0aa06 100644 --- a/.github/workflows/docker-reusable.yml +++ b/.github/workflows/docker-reusable.yml @@ -5,12 +5,12 @@ on: workflow_call: inputs: docker_file: - default: docker/codex.Dockerfile + default: docker/storage.Dockerfile description: Dockerfile required: false type: string docker_repo: - default: codexstorage/nim-codex + default: logosstorage/logos-storage-nim description: DockerHub repository required: false type: string @@ -65,9 +65,9 @@ on: type: string default: false outputs: - codex_image: + logos_storage_image: description: Logos Storage Docker image tag - value: ${{ jobs.publish.outputs.codex_image }} + value: ${{ jobs.publish.outputs.logos_storage_image }} env: @@ -181,7 +181,7 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ steps.meta.outputs.version }} - codex_image: ${{ steps.image_tag.outputs.codex_image }} + logos_storage_image: ${{ steps.image_tag.outputs.logos_storage_image }} needs: [build, compute] steps: - name: Docker - Variables @@ -245,10 +245,10 @@ jobs: - name: Docker - Image tag id: image_tag - run: echo "codex_image=${{ env.DOCKER_REPO }}:${{ steps.meta.outputs.version }}" >> "$GITHUB_OUTPUT" + run: echo "logos_storage_image=${{ env.DOCKER_REPO }}:${{ steps.meta.outputs.version }}" >> "$GITHUB_OUTPUT" - name: Docker - Inspect image - run: docker buildx imagetools inspect ${{ steps.image_tag.outputs.codex_image }} + run: docker buildx imagetools inspect ${{ steps.image_tag.outputs.logos_storage_image }} # Compute Tests inputs @@ -261,13 +261,13 @@ jobs: source: ${{ steps.compute.outputs.source }} branch: ${{ env.TESTS_BRANCH }} workflow_source: ${{ env.TESTS_SOURCE }} - codexdockerimage: ${{ steps.compute.outputs.codexdockerimage }} + storagedockerimage: ${{ steps.compute.outputs.storagedockerimage }} steps: - name: Compute Tests inputs id: compute run: | echo "source=${{ format('{0}/{1}', github.server_url, env.TESTS_SOURCE) }}" >> "$GITHUB_OUTPUT" - echo "codexdockerimage=${{ inputs.docker_repo }}:${{ needs.publish.outputs.version }}" >> "$GITHUB_OUTPUT" + echo "storagedockerimage=${{ inputs.docker_repo }}:${{ needs.publish.outputs.version }}" >> "$GITHUB_OUTPUT" # Compute Continuous Tests inputs @@ -301,7 +301,7 @@ jobs: with: source: ${{ needs.compute-tests-inputs.outputs.source }} branch: ${{ needs.compute-tests-inputs.outputs.branch }} - codexdockerimage: ${{ needs.compute-tests-inputs.outputs.codexdockerimage }} + storagedockerimage: ${{ needs.compute-tests-inputs.outputs.storagedockerimage }} nameprefix: ${{ needs.compute-continuous-tests-inputs.outputs.nameprefix }}-${{ matrix.tests }}-${{ needs.compute-continuous-tests-inputs.outputs.continuous_tests_duration }} tests_filter: ${{ matrix.tests }} tests_target_duration: ${{ needs.compute-tests-inputs.outputs.continuous_tests_duration }} @@ -318,6 +318,6 @@ jobs: with: source: ${{ needs.compute-tests-inputs.outputs.source }} branch: ${{ needs.compute-tests-inputs.outputs.branch }} - codexdockerimage: ${{ needs.compute-tests-inputs.outputs.codexdockerimage }} + storagedockerimage: ${{ needs.compute-tests-inputs.outputs.storagedockerimage }} workflow_source: ${{ needs.compute-tests-inputs.outputs.workflow_source }} secrets: inherit diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6dd4abd6..b8a66843 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,7 +14,7 @@ on: - '!.github/workflows/docker.yml' - '!.github/workflows/docker-reusable.yml' - 'docker/**' - - '!docker/codex.Dockerfile' + - '!docker/storage.Dockerfile' - '!docker/docker-entrypoint.sh' workflow_dispatch: @@ -25,4 +25,4 @@ jobs: with: tag_latest: ${{ github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/') }} tag_stable: ${{ startsWith(github.ref, 'refs/tags/') }} - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/docker/README.md b/docker/README.md index 21356698..76af6cd8 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,17 +1,17 @@ -# Codex Docker Image +# Logos Storage Docker Image - Codex provides pre-built docker images and they are stored in the [codexstorage/nim-codex](https://hub.docker.com/repository/docker/codexstorage/nim-codex) repository. + Logos Storage provides pre-built docker images and they are stored in the [logosstorage/logos-storage-nim](https://hub.docker.com/repository/docker/logosstorage/logos-storage-nim) repository. ## Run - We can run Codex Docker image using CLI + We can run Logos Storage Docker image using CLI ```shell # Default run - docker run --rm codexstorage/nim-codex + docker run --rm logosstorage/logos-storage-nim # Mount local datadir - docker run -v ./datadir:/datadir --rm codexstorage/nim-codex codex --data-dir=/datadir + docker run -v ./datadir:/datadir --rm logosstorage/logos-storage-nim storage --data-dir=/datadir ``` And Docker Compose @@ -23,15 +23,15 @@ ## Arguments - Docker image is based on the [codex.Dockerfile](codex.Dockerfile) and there is + Docker image is based on the [storage.Dockerfile](storage.Dockerfile) and there is ``` ENTRYPOINT ["/docker-entrypoint.sh"] - CMD ["codex"] + CMD ["storage"] ``` - It means that at the image run it will just run `codex` application without any arguments and we can pass them as a regular arguments, by overriding command + It means that at the image run it will just run `storage` application without any arguments and we can pass them as a regular arguments, by overriding command ```shell - docker run codexstorage/nim-codex codex --api-bindaddr=0.0.0.0 --api-port=8080 + docker run logosstorage/logos-storage-nim storage --api-bindaddr=0.0.0.0 --api-port=8080 ``` @@ -42,12 +42,12 @@ We also added a temporary environment variable `NAT_IP_AUTO` to the entrypoint which is set as `false` for releases and ` true` for regular builds. That approach is useful for Dist-Tests. ```shell # Disable NAT_IP_AUTO for regular builds - docker run -e NAT_IP_AUTO=false codexstorage/nim-codex + docker run -e NAT_IP_AUTO=false logosstorage/logos-storage-nim ``` ## Slim - 1. Build the image using `docker build -t codexstorage/codexsetup:latest -f codex.Dockerfile ..` + 1. Build the image using `docker build -t logosstorage/logos-storage-nim:latest -f storage.Dockerfile ..` 2. The docker image can then be minified using [slim](https://github.com/slimtoolkit/slim). Install slim on your path and then run: ```shell slim # brings up interactive prompt diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 9ffdd821..467edf82 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -1,33 +1,27 @@ services: - codex-node1: - image: codexstorage/nim-codex:sha-82b0399 + storage-node1: + image: logosstorage/logos-storage-nim:latest environment: - - CODEX_LOG_LEVEL=${CODEX_LOG_LEVEL:-TRACE} - - CODEX_METRICS=${CODEX_METRICS:-false} - - CODEX_METRICS_ADDRESS=${CODEX_METRICS_ADDRESS:-0.0.0.0} - - CODEX_METRICS_PORT=${CODEX_METRICS_PORT:-8008} - - CODEX_DATA_DIR=${CODEX_DATA_DIR:-/datadir} - - CODEX_LISTEN_ADDRS=${CODEX_LISTEN_ADDRS:-/ip4/0.0.0.0/tcp/2345} - - CODEX_NAT=${CODEX_NAT:-10.0.0.10} - - CODEX_DISC_PORT=${CODEX_DISC_PORT:-8090} - - CODEX_NET_PRIVKEY=${CODEX_NET_PRIVKEY:-key} - # - CODEX_BOOTSTRAP_NODE=${CODEX_BOOTSTRAP_NODE} - - CODEX_MAX_PEERS=${CODEX_MAX_PEERS:-160} - - CODEX_AGENT_STRING=${CODEX_AGENT_STRING:-Codex} - - CODEX_API_BINDADDR=${CODEX_API_BINDADDR:-0.0.0.0} - - CODEX_API_PORT=${CODEX_API_PORT:-8080} - - CODEX_REPO_KIND=${CODEX_REPO_KIND:-fs} - - CODEX_STORAGE_QUOTA=${CODEX_STORAGE_QUOTA:-8589934592} - - CODEX_BLOCK_TTL=${CODEX_BLOCK_TTL:-0} - # - CODEX_BLOCK_MI=${CODEX_BLOCK_MI} - - CODEX_BLOCK_MN=${CODEX_BLOCK_MN:-1000} - - CODEX_CACHE_SIZE=${CODEX_CACHE_SIZE:-0} - - CODEX_PERSISTENCE=${CODEX_PERSISTENCE:-false} - - CODEX_ETH_PROVIDER=${CODEX_ETH_PROVIDER:-ws://localhost:8545} - # - CODEX_ETH_ACCOUNT=${CODEX_ETH_ACCOUNT} - # - CODEX_MARKETPLACE_ADDRESS=${CODEX_MARKETPLACE_ADDRESS:-0x59b670e9fA9D0A427751Af201D676719a970857b} - - CODEX_VALIDATOR=${CODEX_VALIDATOR:-false} - - CODEX_VALIDATOR_MAX_SLOTS=${CODEX_VALIDATOR_MAX_SLOTS:-1000} + - STORAGE_LOG_LEVEL=${STORAGE_LOG_LEVEL:-TRACE} + - STORAGE_METRICS=${STORAGE_METRICS:-false} + - STORAGE_METRICS_ADDRESS=${STORAGE_METRICS_ADDRESS:-0.0.0.0} + - STORAGE_METRICS_PORT=${STORAGE_METRICS_PORT:-8008} + - STORAGE_DATA_DIR=${STORAGE_DATA_DIR:-/datadir} + - STORAGE_LISTEN_ADDRS=${STORAGE_LISTEN_ADDRS:-/ip4/0.0.0.0/tcp/2345} + - STORAGE_NAT=${STORAGE_NAT:-10.0.0.10} + - STORAGE_DISC_PORT=${STORAGE_DISC_PORT:-8090} + - STORAGE_NET_PRIVKEY=${STORAGE_NET_PRIVKEY:-key} + # - STORAGE_BOOTSTRAP_NODE=${STORAGE_BOOTSTRAP_NODE} + - STORAGE_MAX_PEERS=${STORAGE_MAX_PEERS:-160} + - STORAGE_AGENT_STRING=${STORAGE_AGENT_STRING:-LogosStorage} + - STORAGE_API_BINDADDR=${STORAGE_API_BINDADDR:-0.0.0.0} + - STORAGE_API_PORT=${STORAGE_API_PORT:-8080} + - STORAGE_REPO_KIND=${STORAGE_REPO_KIND:-fs} + - STORAGE_STORAGE_QUOTA=${STORAGE_STORAGE_QUOTA:-8589934592} + - STORAGE_BLOCK_TTL=${STORAGE_BLOCK_TTL:-0} + # - STORAGE_BLOCK_MI=${STORAGE_BLOCK_MI} + - STORAGE_BLOCK_MN=${STORAGE_BLOCK_MN:-1000} + - STORAGE_CACHE_SIZE=${STORAGE_CACHE_SIZE:-0} - NAT_IP_AUTO=false - NAT_PUBLIC_IP_AUTO=https://ipinfo.io/ip ports: @@ -38,7 +32,7 @@ services: volumes: - ./datadir:/datadir:z networks: - - codex + - logosstorage networks: - codex: + logosstorage: driver: bridge diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index ff07898c..86b5bc42 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -9,14 +9,9 @@ if [[ -n "${ENV_PATH}" ]]; then set +a fi -# Codex Network -if [[ -n "${NETWORK}" ]]; then - export BOOTSTRAP_NODE_FROM_URL="${BOOTSTRAP_NODE_FROM_URL:-https://spr.codex.storage/${NETWORK}}" -fi - # Bootstrap node URL if [[ -n "${BOOTSTRAP_NODE_URL}" ]]; then - BOOTSTRAP_NODE_URL="${BOOTSTRAP_NODE_URL}/api/codex/v1/spr" + BOOTSTRAP_NODE_URL="${BOOTSTRAP_NODE_URL}/api/storage/v1/spr" WAIT=${BOOTSTRAP_NODE_URL_WAIT:-300} SECONDS=0 SLEEP=1 @@ -25,7 +20,7 @@ if [[ -n "${BOOTSTRAP_NODE_URL}" ]]; then SPR=$(curl -s -f -m 5 -H 'Accept: text/plain' "${BOOTSTRAP_NODE_URL}") # Check if exit code is 0 and returned value is not empty if [[ $? -eq 0 && -n "${SPR}" ]]; then - export CODEX_BOOTSTRAP_NODE="${SPR}" + export STORAGE_BOOTSTRAP_NODE="${SPR}" break else # Sleep and check again @@ -59,16 +54,16 @@ if [[ -n "${BOOTSTRAP_NODE_FROM_URL}" ]]; then fi -# Stop Codex run if unable to get SPR -if [[ -n "${BOOTSTRAP_NODE_URL}" && -z "${CODEX_BOOTSTRAP_NODE}" ]]; then - echo "Unable to get SPR from ${BOOTSTRAP_NODE_URL} in ${BOOTSTRAP_NODE_URL_WAIT} seconds - Stop Codex run" +# Stop Logos Storage run if unable to get SPR +if [[ -n "${BOOTSTRAP_NODE_URL}" && -z "${STORAGE_BOOTSTRAP_NODE}" ]]; then + echo "Unable to get SPR from ${BOOTSTRAP_NODE_URL} in ${BOOTSTRAP_NODE_URL_WAIT} seconds - Stop Logos Storage run" exit 1 fi # Parameters -if [[ -z "${CODEX_NAT}" ]]; then +if [[ -z "${STORAGE_NAT}" ]]; then if [[ "${NAT_IP_AUTO}" == "true" && -z "${NAT_PUBLIC_IP_AUTO}" ]]; then - export CODEX_NAT="extip:$(hostname --ip-address)" + export STORAGE_NAT="extip:$(hostname --ip-address)" elif [[ -n "${NAT_PUBLIC_IP_AUTO}" ]]; then # Run for 60 seconds if fail WAIT=120 @@ -78,7 +73,7 @@ if [[ -z "${CODEX_NAT}" ]]; then IP=$(curl -s -f -m 5 "${NAT_PUBLIC_IP_AUTO}") # Check if exit code is 0 and returned value is not empty if [[ $? -eq 0 && -n "${IP}" ]]; then - export CODEX_NAT="extip:${IP}" + export STORAGE_NAT="extip:${IP}" break else # Sleep and check again @@ -89,21 +84,21 @@ if [[ -z "${CODEX_NAT}" ]]; then fi fi -# Stop Codex run if can't get NAT IP when requested -if [[ "${NAT_IP_AUTO}" == "true" && -z "${CODEX_NAT}" ]]; then - echo "Can't get Private IP - Stop Codex run" +# Stop Logos Storage run if can't get NAT IP when requested +if [[ "${NAT_IP_AUTO}" == "true" && -z "${STORAGE_NAT}" ]]; then + echo "Can't get Private IP - Stop Logos Storage run" exit 1 -elif [[ -n "${NAT_PUBLIC_IP_AUTO}" && -z "${CODEX_NAT}" ]]; then - echo "Can't get Public IP in $WAIT seconds - Stop Codex run" +elif [[ -n "${NAT_PUBLIC_IP_AUTO}" && -z "${STORAGE_NAT}" ]]; then + echo "Can't get Public IP in $WAIT seconds - Stop Logos Storage run" exit 1 fi # Show -echo -e "\nCodex run parameters:" -vars=$(env | grep "CODEX_" | grep -v -e "[0-9]_SERVICE_" -e "[0-9]_NODEPORT_") -echo -e "${vars//CODEX_/ - CODEX_}" +echo -e "\Logos Storage run parameters:" +vars=$(env | grep "STORAGE_" | grep -v -e "[0-9]_SERVICE_" -e "[0-9]_NODEPORT_") +echo -e "${vars//STORAGE_/ - STORAGE_}" echo -e " - $@\n" # Run -echo "Run Codex node" +echo "Run Logos Storage node" exec "$@" diff --git a/docker/codex.Dockerfile b/docker/storage.Dockerfile similarity index 95% rename from docker/codex.Dockerfile rename to docker/storage.Dockerfile index a7cd70dd..d96975b5 100644 --- a/docker/codex.Dockerfile +++ b/docker/storage.Dockerfile @@ -5,7 +5,7 @@ ARG BUILD_HOME=/src ARG MAKE_PARALLEL=${MAKE_PARALLEL:-4} ARG NIMFLAGS="${NIMFLAGS:-"-d:disableMarchNative"}" ARG USE_LIBBACKTRACE=${USE_LIBBACKTRACE:-1} -ARG APP_HOME=/codex +ARG APP_HOME=/logosstorage ARG NAT_IP_AUTO=${NAT_IP_AUTO:-false} # Build @@ -38,4 +38,4 @@ COPY --from=builder --chmod=0755 ${BUILD_HOME}/docker/docker-entrypoint.sh / RUN apt-get update && apt-get install -y libgomp1 curl jq && rm -rf /var/lib/apt/lists/* ENV NAT_IP_AUTO=${NAT_IP_AUTO} ENTRYPOINT ["/docker-entrypoint.sh"] -CMD ["codex"] +CMD ["storage"]