diff --git a/.github/workflows/build-test-image.yaml b/.github/workflows/build-test-image.yaml index d3a9e9c5..3d92b35a 100644 --- a/.github/workflows/build-test-image.yaml +++ b/.github/workflows/build-test-image.yaml @@ -118,6 +118,7 @@ jobs: if [[ -n "$sec" ]];then mkdir -p secrets || { echo "Failed to create secrets directory"; exit 1; } echo '{{ $var.falkordbPassword }}' > ./secrets/falkordbpassword || { echo "Failed to write falkordbpassword"; exit 1; } + echo '{{ $var.falkordbPasswordReplica }}' > ./secrets/falkordbpasswordreplica || { echo "Failed to write falkordbpassword"; exit 1; } echo '{{ $func.random(string, 16, $sys.deterministicSeedValue) }}' > ./secrets/adminpassword || { echo "Failed to write adminpassword"; exit 1; } else echo "secrets option was not used" @@ -206,7 +207,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-failover' --instance-description 'test-sz-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always'" + extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-failover' --persist-instance-on-fail --instance-description 'test-sz-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always'" - name: PRO/MultiZone - GCP/us-central1 - Failover & Persistence if: "true" testFile: test_replication.py @@ -216,7 +217,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-failover' --instance-description 'test-mz-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always'" + extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-failover' --persist-instance-on-fail --instance-description 'test-mz-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always'" - name: PRO/Standalone - GCP/us-central1 - Failover & Persistence With TLS if: "true" testFile: test_standalone.py @@ -236,7 +237,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-failover-tls' --instance-description 'test-sz-failover-tls' --instance-type 'e2-medium' --storage-size '30' --tls --rdb-config 'medium' --aof-config 'always'" + extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-failover-tls' --persist-instance-on-fail --instance-description 'test-sz-failover-tls' --instance-type 'e2-medium' --storage-size '30' --tls --rdb-config 'medium' --aof-config 'always'" - name: PRO/MultiZone - GCP/us-central1 - Failover & Persistence With TLS if: "true" testFile: test_replication.py @@ -246,7 +247,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-failover-tls' --instance-description 'test-mz-failover-tls' --instance-type 'e2-medium' --storage-size '30' --tls --rdb-config 'medium' --aof-config 'always'" + extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-failover-tls' --persist-instance-on-fail --instance-description 'test-mz-failover-tls' --instance-type 'e2-medium' --storage-size '30' --tls --rdb-config 'medium' --aof-config 'always'" - name: PRO/Standalone - GCP/us-central1 - Update Memory if: "true" testFile: test_update_memory.py @@ -368,7 +369,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-enterprise-failover' --instance-description 'test-sz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --custom-network=gcp-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" + extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-enterprise-failover' --persist-instance-on-fail --instance-description 'test-sz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --custom-network=gcp-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" - name: Enterprise/MultiZone - GCP/us-central1 - Failover & Persistence if: "${{ contains(github.ref, 'refs/tags/v') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}" testFile: test_replication.py @@ -378,7 +379,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-enterprise-failover' --instance-description 'test-mz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --custom-network=gcp-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" + extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-enterprise-failover' --persist-instance-on-fail --instance-description 'test-mz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --custom-network=gcp-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" - name: Enterprise/ClusterSingleZone - GCP/us-central1 - Failover & Persistence if: "${{ contains(github.ref, 'refs/tags/v') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}" testFile: test_cluster.py @@ -388,7 +389,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'cluster-Single-Zone' --replica-id 'cluster-sz-0' --instance-name 'test-cluster-sz-enterprise-failover' --instance-description 'test-cluster-sz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --host-count '6' --cluster-replicas '1' --custom-network=gcp-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} --deployment-create-timeout-seconds 4800" + extraParams: "--resource-key 'cluster-Single-Zone' --replica-id 'cluster-sz-1' --instance-name 'test-cluster-sz-enterprise-failover' --instance-description 'test-cluster-sz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --host-count '6' --cluster-replicas '1' --custom-network=gcp-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} --deployment-create-timeout-seconds 4800" - name: Enterprise/ClusterMultiZone - GCP/us-central1 - Failover & Persistence if: "${{ contains(github.ref, 'refs/tags/v') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}" testFile: test_cluster.py @@ -398,7 +399,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'cluster-Multi-Zone' --replica-id 'cluster-mz-0' --instance-name 'test-cluster-mz-enterprise-failover' --instance-description 'test-cluster-mz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --host-count '6' --cluster-replicas '1' --ensure-mz-distribution --custom-network=gcp-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} --deployment-create-timeout-seconds 4800" + extraParams: "--resource-key 'cluster-Multi-Zone' --replica-id 'cluster-mz-1' --instance-name 'test-cluster-mz-enterprise-failover' --instance-description 'test-cluster-mz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --host-count '6' --cluster-replicas '1' --ensure-mz-distribution --custom-network=gcp-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} --deployment-create-timeout-seconds 4800" # - name: PRO/ClusterSingleZone - GCP/us-central1 - Add/Remove Shards # if: "true" @@ -491,7 +492,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-failover' --instance-description 'test-sz-failover' --instance-type 't2.medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always'" + extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-failover' --persist-instance-on-fail --instance-description 'test-sz-failover' --instance-type 't2.medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always'" - name: PRO/MultiZone - AWS/us-east-2 - Failover & Persistence if: "true" testFile: test_replication.py @@ -501,7 +502,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-failover' --instance-description 'test-mz-failover' --instance-type 't2.medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always'" + extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-failover' --persist-instance-on-fail --instance-description 'test-mz-failover' --instance-type 't2.medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always'" - name: PRO/ClusterSingleZone - AWS/us-east-2 - Failover & Persistence if: "true" testFile: test_cluster.py @@ -543,7 +544,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-enterprise-failover' --instance-description 'test-sz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --custom-network=aws-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" + extraParams: "--resource-key 'single-Zone' --instance-name 'test-sz-enterprise-failover' --persist-instance-on-fail --instance-description 'test-sz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --custom-network=aws-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" - name: Enterprise/MultiZone - AWS/us-east-2 - Failover & Persistence if: "${{ contains(github.ref, 'refs/tags/v') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}" testFile: test_replication.py @@ -553,7 +554,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-enterprise-failover' --instance-description 'test-mz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --custom-network=aws-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" + extraParams: "--resource-key 'multi-Zone' --instance-name 'test-mz-enterprise-failover' --persist-instance-on-fail--instance-description 'test-mz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --custom-network=aws-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}" - name: Enterprise/ClusterSingleZone - AWS/us-east-2 - Failover & Persistence if: "${{ contains(github.ref, 'refs/tags/v') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}" testFile: test_cluster.py @@ -563,7 +564,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'cluster-Single-Zone' --replica-id 'cluster-sz-0' --instance-name 'test-cluster-sz-enterprise-failover' --instance-description 'test-cluster-sz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --host-count '6' --cluster-replicas '1' --custom-network=aws-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} --deployment-create-timeout-seconds 4800" + extraParams: "--resource-key 'cluster-Single-Zone' --replica-id 'cluster-sz-1' --instance-name 'test-cluster-sz-enterprise-failover' --instance-description 'test-cluster-sz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --host-count '6' --cluster-replicas '1' --custom-network=aws-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} --deployment-create-timeout-seconds 4800" - name: Enterprise/ClusterMultiZone - AWS/us-east-2 - Failover & Persistence if: "${{ contains(github.ref, 'refs/tags/v') || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }}" testFile: test_cluster.py @@ -573,7 +574,7 @@ jobs: subscriptionId: sub-GJPV3NoNC0 serviceId: ${{ vars.OMNISTRATE_INTERNAL_SERVICE_ID }} environmentId: ${{ vars.OMNISTRATE_INTERNAL_DEV_ENVIRONMENT}} - extraParams: "--resource-key 'cluster-Multi-Zone' --replica-id 'cluster-mz-0' --instance-name 'test-cluster-mz-enterprise-failover' --instance-description 'test-cluster-mz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --host-count '6' --cluster-replicas '1' --ensure-mz-distribution --custom-network=aws-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} --deployment-create-timeout-seconds 4800" + extraParams: "--resource-key 'cluster-Multi-Zone' --replica-id 'cluster-mz-1' --instance-name 'test-cluster-mz-enterprise-failover' --instance-description 'test-cluster-mz-enterprise-failover' --instance-type 'e2-medium' --storage-size '30' --rdb-config 'medium' --aof-config 'always' --host-count '6' --cluster-replicas '1' --ensure-mz-distribution --custom-network=aws-network-${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }} --deployment-create-timeout-seconds 4800" steps: - name: Checkout diff --git a/falkordb-node/node-entrypoint.sh b/falkordb-node/node-entrypoint.sh index 4467b7ec..4a9d8fb9 100755 --- a/falkordb-node/node-entrypoint.sh +++ b/falkordb-node/node-entrypoint.sh @@ -2,22 +2,17 @@ FALKORDB_USER=${FALKORDB_USER:-falkordb} #FALKORDB_PASSWORD=${FALKORDB_PASSWORD:-''} -if [[ -f "/run/secrets/falkordbpassword" ]] && [[ -s "/run/secrets/falkordbpassword" ]]; then - FALKORDB_PASSWORD=$(cat "/run/secrets/falkordbpassword") -elif [[ -n "$FALKORDB_PASSWORD" ]]; then - FALKORDB_PASSWORD=$FALKORDB_PASSWORD +if [[ $HOSTNAME =~ .*replica.* ]]; then + SECRET_PATH="/run/secrets/falkordbpasswordreplica" else - FALKORDB_PASSWORD='' + SECRET_PATH="/run/secrets/falkordbpassword" fi -#ADMIN_PASSWORD=${ADMIN_PASSWORD:-''} -if [[ -f "/run/secrets/adminpassword" ]] && [[ -s "/run/secrets/adminpassword" ]]; then - ADMIN_PASSWORD=$(cat "/run/secrets/adminpassword") - export ADMIN_PASSWORD -elif [[ -n "$ADMIN_PASSWORD" ]]; then - export ADMIN_PASSWORD=$ADMIN_PASSWORD +if [[ -f "$SECRET_PATH" && -s "$SECRET_PATH" ]]; then + # Use `read` instead of `cat` for better performance + FALKORDB_PASSWORD=$(cat "$SECRET_PATH") else - export ADMIN_PASSWORD='' + FALKORDB_PASSWORD='' fi RUN_SENTINEL=${RUN_SENTINEL:-0} diff --git a/omnistrate.pro.yaml b/omnistrate.pro.yaml index a3c04094..a782144f 100644 --- a/omnistrate.pro.yaml +++ b/omnistrate.pro.yaml @@ -1331,7 +1331,7 @@ services: - source: adminpasspath target: /run/secrets/adminpassword - source: falkordbpasspath - target: /run/secrets/falkordbpassword + target: /run/secrets/falkordbpasswordreplica environment: - RUN_NODE=1 - RUN_SENTINEL=0