-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathup.sh
executable file
·62 lines (54 loc) · 1.91 KB
/
up.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
set -e
env="$1"
if [[ -z "$env" ]]; then
echo "A name for the environment must be provided"
exit 1
fi
provider="$2"
if [[ -z "$provider" ]]; then
echo "The cloud provider must be specified"
echo "Valid values are 'aws' or 'digital-ocean'"
exit 1
fi
node_count="$3"
if [[ -z "$node_count" ]]; then
echo "The number of nodes must be provided"
exit 1
fi
node_instance_count="$4"
if [[ -z "$node_instance_count" ]]; then
echo "The number of node service instances must be provided."
echo "This is the number of node services that run on each VM."
exit 1
fi
custom_bin="false"
org="$5"
if [[ ! -z "$org" ]]; then
custom_bin="true"
fi
branch="$6"
if [[ "$custom_bin" = true && -z "$branch" ]]; then
echo "If you wish to use a custom binary you must supply the repo org and branch as arguments."
exit 1
fi
export $(cat .env | sed 's/#.*//g' | xargs)
docker run --rm \
--env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_DEFAULT_REGION \
--env SSH_KEY_NAME --env DO_PAT --env SN_TESTNET_DEV_SUBNET_ID \
--env SN_TESTNET_DEV_SECURITY_GROUP_ID --env TERRAFORM_STATE_BUCKET_NAME \
--env DIGITALOCEAN_TOKEN --env DO_API_TOKEN \
--volume $HOME/.ansible:/home/runner/.ansible \
--volume $HOME/.ssh:/home/runner/.ssh \
--volume $(pwd):/home/runner/sn_testnet_tool \
jacderida/sn_testnet_tool:latest just init $env $provider
docker run --rm --tty \
--env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY --env AWS_DEFAULT_REGION \
--env SSH_KEY_NAME --env DO_PAT --env SN_TESTNET_DEV_SUBNET_ID \
--env SN_TESTNET_DEV_SECURITY_GROUP_ID --env TERRAFORM_STATE_BUCKET_NAME \
--env DIGITALOCEAN_TOKEN --env DO_API_TOKEN \
--volume $HOME/.ansible:/home/runner/.ansible \
--volume $HOME/.ssh:/home/runner/.ssh \
--volume $(pwd):/home/runner/sn_testnet_tool \
jacderida/sn_testnet_tool:latest just testnet \
$env $provider $node_count $node_instance_count $custom_bin $org $branch