Skip to content

Commit bb8dc6b

Browse files
wip local testing with vault
1 parent 993ea41 commit bb8dc6b

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed

.github/docker/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ services:
1111
# using artesca container, with persistent volumes for sse migration
1212
- ../../localData:/usr/src/app/localData
1313
- ../../localMetadata:/usr/src/app/localMetadata
14+
- ../../tests/functional/sse-kms-migration/config.${SSE_CONF}.json:/conf/config.json
1415
environment:
16+
- S3_CONFIG_FILE=/conf/config.json
1517
- CI=true
1618
- ENABLE_LOCAL_CACHE=true
1719
- REDIS_HOST=0.0.0.0

.github/docker/local.sh

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/bin/bash
2+
set -e -o pipefail
3+
#in .github/docker
4+
5+
export S3BACKEND=file
6+
export S3METADATA=scality
7+
export S3VAULT=scality
8+
export CLOUDSERVER_IMAGE_BEFORE_SSE_MIGRATION=ghcr.io/scality/cloudserver:7.70.21-11
9+
export CLOUDSERVER_IMAGE_ORIGINAL=ghcr.io/scality/cloudserver:50db1ada69a394cf877bd3486d4d0e318158e338
10+
export MPU_TESTING="yes"
11+
export JOB_NAME=sse-kms-migration-tests-show-arn
12+
export kmsHideScalityArn=showArn
13+
14+
export VAULT_IMAGE_BEFORE_SSE_MIGRATION=ghcr.io/scality/vault:7.70.15-5
15+
export VAULT_IMAGE_ORIGINAL=ghcr.io/scality/vault:e8c0fa2890c131581efd13ad3fd1ade7dcbd0968
16+
export KMS_IMAGE=nsmithuk/local-kms:3.11.7
17+
18+
# IMAGE IS HARDCODED FOR OKMS TO HIDE
19+
export JOB_NAME=sse-kms-migration-tests-hide-arn
20+
export kmsHideScalityArn=hideArn
21+
# export JOB_NAME=sse-kms-migration-tests-show-arn
22+
# export kmsHideScalityArn=showArn
23+
24+
mkdir -p /tmp/artifacts/$JOB_NAME
25+
26+
export CLOUDSERVER_IMAGE=$CLOUDSERVER_IMAGE_BEFORE_SSE_MIGRATION
27+
export VAULT_IMAGE=$VAULT_IMAGE_BEFORE_SSE_MIGRATION
28+
export SSE_CONF=before
29+
30+
export KMS_AWS_SECRET_ACCESS_KEY=123
31+
export KMS_AWS_ACCESS_KEY_ID=456
32+
33+
# START KMS
34+
docker run -d -p 8080:8080 $KMS_IMAGE || true
35+
36+
echo "waiting for local AWS KMS service on port 8080 to be available."
37+
38+
timeout 300 bash -c 'until curl -sS 0:8080 > /dev/null; do
39+
echo "service not ready on port 8080. Retrying in 2 seconds."
40+
sleep 2
41+
done'
42+
echo "local AWS KMS service is up and running on port 8080."
43+
44+
AWS_ENDPOINT_URL=http://0:8080 AWS_DEFAULT_REGION=us-east-1 AWS_ACCESS_KEY_ID=456 AWS_SECRET_ACCESS_KEY=123 aws kms list-keys --max-items 1
45+
# END KMS
46+
47+
# Start all before migration
48+
docker compose up -d
49+
bash ../../wait_for_local_port.bash 8500 40
50+
bash ../../wait_for_local_port.bash 8000 40
51+
# HAVE vaultclient bin in your PATH or an alias
52+
alias vaultclient="~/scality/vaultclient/bin/vaultclient"
53+
export PATH="$PATH:~/scality/vaultclient/bin/"
54+
# vaultclient --config admin.json delete-account --name mick || true
55+
# vaultclient --config admin.json create-account --name mick --email [email protected]
56+
# vaultclient --config admin.json generate-account-access-key --name mick --accesskey SCUBAINTERNAL0000000 --secretkey SCUBAINTERNAL000000000000000000000000000
57+
# vaultclient --config admin.json get-account --account-name mick
58+
59+
cd ../..
60+
61+
echo ===== RUN BEFORE MIGRATION =====
62+
export S3_CONFIG_FILE=config.before.json
63+
64+
set -o pipefail;
65+
66+
67+
echo Ensures the expected version of cloudserver is old one:
68+
VERSION=$(docker compose -f .github/docker/docker-compose.yaml \
69+
exec cloudserver cat package.json | jq -r .version)
70+
if [[ "$VERSION" != "7.70.21-11" ]]; then
71+
echo "bad version of container. Should be 7.70.21-11. Was $VERSION" >&2
72+
exit 1
73+
else
74+
echo OK $VERSION
75+
fi
76+
77+
yarn run ft_sse_before_migration | tee /tmp/artifacts/$JOB_NAME/beforeMigration.log
78+
79+
# RUN latest images
80+
cd .github/docker
81+
export SSE_CONF=sseMigration.$kmsHideScalityArn
82+
export CLOUDSERVER_IMAGE=$CLOUDSERVER_IMAGE_ORIGINAL
83+
export VAULT_IMAGE=$VAULT_IMAGE_ORIGINAL
84+
85+
docker compose down cloudserver vault && docker compose up -d vault # cloudserver-sse-migration
86+
87+
echo ==== RUN MIGRATION ====
88+
cd ../..
89+
yarn start_migration > s3.log
90+
export S3_CONFIG_FILE=config.sseMigration.$kmsHideScalityArn.json
91+
export S3KMS=aws
92+
93+
set -o pipefail;
94+
bash wait_for_local_port.bash 8500 40
95+
bash wait_for_local_port.bash 8000 40
96+
97+
# echo Ensures the expected version of cloudserver is NOT old one
98+
# VERSION=$(docker compose -f .github/docker/docker-compose.yaml \
99+
# exec cloudserver-sse-migration cat package.json | jq -r .version)
100+
# if [[ "$VERSION" == "7.70.21-11" ]]; then
101+
# echo "bad version of container. Should NOT be 7.70.21-11. Was $VERSION" >&2
102+
# exit 1
103+
# else
104+
# echo OK $VERSION
105+
# fi
106+
107+
yarn run ft_sse_migration # | tee /tmp/artifacts/$JOB_NAME/migration.log
108+
# sleep 10
109+
# yarn run ft_sse_arn # | tee /tmp/artifacts/$JOB_NAME/migration.log
110+

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"ft_sse_before_migration": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 10000 cleanup.js beforeMigration.js",
7979
"ft_sse_migration": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 10000 migration.js",
8080
"ft_sse_arn": "cd tests/functional/sse-kms-migration && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json -t 10000 cleanup.js arnPrefix.js",
81+
"start_migration": "S3DATA=file S3METADATA=scality S3KMS=aws S3VAULT=scality S3_CONFIG_FILE=./tests/functional/sse-kms-migration/config.sseMigration.hideArn.json yarn start",
8182
8283
"lint": "eslint $(git ls-files '*.js')",
8384
"lint_md": "mdlint $(git ls-files '*.md')",

0 commit comments

Comments
 (0)