aboutsummaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/dev-bucket.sh6
-rwxr-xr-xscript/dev-clean.sh7
-rwxr-xr-xscript/dev-cluster.sh12
-rwxr-xr-xscript/dev-configure.sh5
-rw-r--r--script/dev-env-aws.sh14
-rw-r--r--[-rwxr-xr-x]script/dev-env-s3cmd.sh (renamed from script/dev-env.sh)3
-rwxr-xr-xscript/test-smoke.sh62
7 files changed, 99 insertions, 10 deletions
diff --git a/script/dev-bucket.sh b/script/dev-bucket.sh
index f07263f5..8c0ef4e4 100755
--- a/script/dev-bucket.sh
+++ b/script/dev-bucket.sh
@@ -6,11 +6,11 @@ GARAGE_DEBUG="${REPO_FOLDER}/target/debug/"
GARAGE_RELEASE="${REPO_FOLDER}/target/release/"
PATH="${GARAGE_DEBUG}:${GARAGE_RELEASE}:$PATH"
-garage bucket create éprouvette
+garage bucket create eprouvette
KEY_INFO=`garage key new --name opérateur`
ACCESS_KEY=`echo $KEY_INFO|grep -Po 'GK[a-f0-9]+'`
SECRET_KEY=`echo $KEY_INFO|grep -Po 'secret_key: "[a-f0-9]+'|grep -Po '[a-f0-9]+$'`
-garage bucket allow éprouvette --read --write --key $ACCESS_KEY
+garage bucket allow eprouvette --read --write --key $ACCESS_KEY
echo "$ACCESS_KEY $SECRET_KEY" > /tmp/garage.s3
-echo "Bucket s3://éprouvette created. Credentials stored in /tmp/garage.s3."
+echo "Bucket s3://eprouvette created. Credentials stored in /tmp/garage.s3."
diff --git a/script/dev-clean.sh b/script/dev-clean.sh
new file mode 100755
index 00000000..151c5547
--- /dev/null
+++ b/script/dev-clean.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -ex
+
+killall -9 garage || echo "garage is not running"
+rm -rf /tmp/garage*
+rm -rf /tmp/config.*.toml
diff --git a/script/dev-cluster.sh b/script/dev-cluster.sh
index cfe9be0d..101a18bd 100755
--- a/script/dev-cluster.sh
+++ b/script/dev-cluster.sh
@@ -24,11 +24,11 @@ cat > $CONF_PATH <<EOF
block_size = 1048576 # objects are split in blocks of maximum this number of bytes
metadata_dir = "/tmp/garage-meta-$count"
data_dir = "/tmp/garage-data-$count"
-rpc_bind_addr = "127.0.0.$count:3901" # the port other Garage nodes will use to talk to this node
+rpc_bind_addr = "[::]:$((3900+$count))" # the port other Garage nodes will use to talk to this node
bootstrap_peers = [
- "127.0.0.1:3901",
- "127.0.0.2:3901",
- "127.0.0.3:3901"
+ "[::1]:3901",
+ "[::1]:3902",
+ "[::1]:3903"
]
max_concurrent_rpc_requests = 12
data_replication_factor = 3
@@ -36,11 +36,11 @@ meta_replication_factor = 3
meta_epidemic_fanout = 3
[s3_api]
-api_bind_addr = "127.0.0.$count:3900" # the S3 API port, HTTP without TLS. Add a reverse proxy for the TLS part.
+api_bind_addr = "[::]:$((3910+$count))" # the S3 API port, HTTP without TLS. Add a reverse proxy for the TLS part.
s3_region = "garage" # set this to anything. S3 API calls will fail if they are not made against the region set here.
[s3_web]
-bind_addr = "127.0.0.$count:3902"
+bind_addr = "[::]:$((3920+$count))"
EOF
echo -en "$LABEL configuration written to $CONF_PATH\n"
diff --git a/script/dev-configure.sh b/script/dev-configure.sh
index 8b7392c6..698c7ed9 100755
--- a/script/dev-configure.sh
+++ b/script/dev-configure.sh
@@ -6,6 +6,11 @@ GARAGE_DEBUG="${REPO_FOLDER}/target/debug/"
GARAGE_RELEASE="${REPO_FOLDER}/target/release/"
PATH="${GARAGE_DEBUG}:${GARAGE_RELEASE}:$PATH"
+until garage status 2>&1|grep -q Healthy ; do
+ echo "cluster starting..."
+ sleep 1
+done
+
garage status \
| grep UNCONFIGURED \
| grep -Po '^[0-9a-f]+' \
diff --git a/script/dev-env-aws.sh b/script/dev-env-aws.sh
new file mode 100644
index 00000000..c9a57660
--- /dev/null
+++ b/script/dev-env-aws.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+SCRIPT_FOLDER="`dirname \"${BASH_SOURCE[0]}\"`"
+REPO_FOLDER="${SCRIPT_FOLDER}/../"
+GARAGE_DEBUG="${REPO_FOLDER}/target/debug/"
+GARAGE_RELEASE="${REPO_FOLDER}/target/release/"
+PATH="${GARAGE_DEBUG}:${GARAGE_RELEASE}:$PATH"
+
+export AWS_ACCESS_KEY_ID=`cat /tmp/garage.s3 |cut -d' ' -f1`
+export AWS_SECRET_ACCESS_KEY=`cat /tmp/garage.s3 |cut -d' ' -f2`
+export AWS_DEFAULT_REGION='garage'
+
+alias awsgrg="aws s3 \
+ --endpoint-url http://127.0.0.1:3911"
diff --git a/script/dev-env.sh b/script/dev-env-s3cmd.sh
index 7e8ffc50..88d2941f 100755..100644
--- a/script/dev-env.sh
+++ b/script/dev-env-s3cmd.sh
@@ -10,7 +10,8 @@ ACCESS_KEY=`cat /tmp/garage.s3 |cut -d' ' -f1`
SECRET_KEY=`cat /tmp/garage.s3 |cut -d' ' -f2`
alias s3grg="s3cmd \
- --host 127.0.0.1:3900 \
+ --host 127.0.0.1:3911 \
+ --host-bucket 127.0.0.1:3911 \
--access_key=$ACCESS_KEY \
--secret_key=$SECRET_KEY \
--region=garage \
diff --git a/script/test-smoke.sh b/script/test-smoke.sh
new file mode 100755
index 00000000..111afac9
--- /dev/null
+++ b/script/test-smoke.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+set -ex
+shopt -s expand_aliases
+
+SCRIPT_FOLDER="`dirname \"$0\"`"
+REPO_FOLDER="${SCRIPT_FOLDER}/../"
+
+cargo build
+${SCRIPT_FOLDER}/dev-clean.sh
+${SCRIPT_FOLDER}/dev-cluster.sh > /tmp/garage.log 2>&1 &
+${SCRIPT_FOLDER}/dev-configure.sh
+${SCRIPT_FOLDER}/dev-bucket.sh
+source ${SCRIPT_FOLDER}/dev-env-aws.sh
+source ${SCRIPT_FOLDER}/dev-env-s3cmd.sh
+
+garage status
+garage key list
+garage bucket list
+
+dd if=/dev/urandom of=/tmp/garage.1.rnd bs=1k count=2 # < INLINE_THRESHOLD = 3072 bytes
+dd if=/dev/urandom of=/tmp/garage.2.rnd bs=1M count=5
+dd if=/dev/urandom of=/tmp/garage.3.rnd bs=1M count=10
+
+for idx in $(seq 1 3); do
+ # AWS sends
+ awsgrg cp /tmp/garage.$idx.rnd s3://eprouvette/garage.$idx.aws
+
+ awsgrg ls s3://eprouvette
+
+ awsgrg cp s3://eprouvette/garage.$idx.aws /tmp/garage.$idx.dl
+ diff /tmp/garage.$idx.rnd /tmp/garage.$idx.dl
+ rm /tmp/garage.$idx.dl
+
+ s3grg get s3://eprouvette/garage.$idx.aws /tmp/garage.$idx.dl
+ diff /tmp/garage.$idx.rnd /tmp/garage.$idx.dl
+ rm /tmp/garage.$idx.dl
+
+ awsgrg rm s3://eprouvette/garage.$idx.aws
+
+ # S3CMD sends
+ s3grg put /tmp/garage.$idx.rnd s3://eprouvette/garage.$idx.s3cmd
+
+ s3grg ls s3://eprouvette
+
+ s3grg get s3://eprouvette/garage.$idx.s3cmd /tmp/garage.$idx.dl
+ diff /tmp/garage.$idx.rnd /tmp/garage.$idx.dl
+ rm /tmp/garage.$idx.dl
+
+ awsgrg cp s3://eprouvette/garage.$idx.s3cmd /tmp/garage.$idx.dl
+ diff /tmp/garage.$idx.rnd /tmp/garage.$idx.dl
+ rm /tmp/garage.$idx.dl
+
+ s3grg rm s3://eprouvette/garage.$idx.s3cmd
+done
+rm /tmp/garage.{1,2,3}.rnd
+
+garage bucket deny --read --write eprouvette --key $AWS_ACCESS_KEY_ID
+garage bucket delete --yes eprouvette
+garage key delete --yes $AWS_ACCESS_KEY_ID
+
+echo "success"