Skip to content

Commit 638c9e7

Browse files
Merge pull request #202 from HathorNetwork/release-candidate
Release v1.6.3
2 parents 5d20679 + 94e6871 commit 638c9e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2970
-1731
lines changed

.codebuild/build.sh

Lines changed: 216 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -9,94 +9,219 @@ send_slack_message() {
99
-X POST https://slack.com/api/chat.postMessage;
1010
}
1111

12-
echo "Building git ref ${GIT_REF_TO_DEPLOY}..."
13-
14-
exit=false;
15-
16-
# Checks whether there is a file called "rollback_mainnet_production", which is used by our other CodeBuild to indicate that this is a mainnet-production rollback
17-
if [ -f "rollback_mainnet_production" ]; then
18-
# Gets all env vars with `mainnet_` prefix and re-exports them without the prefix
19-
for var in "${!mainnet_@}"; do
20-
export ${var#mainnet_}="${!var}"
21-
done
22-
make deploy-lambdas-mainnet;
23-
send_slack_message "Rollback performed on mainnet-production to: ${GIT_REF_TO_DEPLOY}";
24-
exit=true;
25-
fi;
26-
27-
# Checks whether there is a file called "rollback_testnet_production", which is used by our other CodeBuild to indicate that this is a testnet-production rollback
28-
if [ -f "rollback_testnet_production" ]; then
29-
# Gets all env vars with `testnet_` prefix and re-exports them without the prefix
30-
for var in "${!testnet_@}"; do
31-
export ${var#testnet_}="${!var}"
32-
done
33-
make deploy-lambdas-testnet;
34-
send_slack_message "Rollback performed on testnet-production to: ${GIT_REF_TO_DEPLOY}";
35-
exit=true;
36-
fi;
37-
38-
if [ "$exit" = true ]; then
39-
echo "Rollbacks performed successfully. Exiting now.";
40-
exit 0;
41-
fi
42-
43-
if expr "${GIT_REF_TO_DEPLOY}" : "master" >/dev/null; then
44-
# Gets all env vars with `dev_` prefix and re-exports them without the prefix
45-
for var in "${!dev_@}"; do
46-
export ${var#dev_}="${!var}"
47-
done
48-
49-
make migrate;
50-
make build-daemon;
51-
make deploy-lambdas-dev-testnet;
52-
# The idea here is that if the lambdas deploy fail, the built image won't be pushed:
53-
make push-daemon;
54-
55-
elif expr "${GIT_REF_TO_DEPLOY}" : "v[0-9]\+\.[0-9]\+\.[0-9]\+-rc\.[0-9]\+" >/dev/null; then
56-
# Gets all env vars with `mainnet_staging_` prefix and re-exports them without the prefix
57-
for var in "${!mainnet_staging_@}"; do
58-
export ${var#mainnet_staging_}="${!var}"
59-
done
60-
61-
echo $GIT_REF_TO_DEPLOY > /tmp/docker_image_tag
62-
make migrate;
63-
make build-daemon;
64-
make deploy-lambdas-mainnet-staging;
65-
make push-daemon;
66-
send_slack_message "New version deployed to mainnet-staging: ${GIT_REF_TO_DEPLOY}"
67-
elif expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
68-
# Gets all env vars with `testnet_` prefix and re-exports them without the prefix
69-
for var in "${!testnet_@}"; do
70-
export ${var#testnet_}="${!var}"
71-
done
72-
73-
echo $GIT_REF_TO_DEPLOY > /tmp/docker_image_tag
74-
make migrate;
75-
make build-daemon;
76-
make deploy-lambdas-testnet;
77-
make push-daemon;
78-
79-
# Unsets all the testnet env vars so we make sure they don't leak to the mainnet deploy below
80-
for var in "${!testnet_@}"; do
81-
unset ${var#testnet_}
82-
done
83-
84-
# Gets all env vars with `mainnet_` prefix and re-exports them without the prefix
85-
for var in "${!mainnet_@}"; do
86-
export ${var#mainnet_}="${!var}"
87-
done
88-
make migrate;
89-
make build-daemon;
90-
make deploy-lambdas-mainnet;
91-
make push-daemon;
92-
send_slack_message "New version deployed to testnet-production and mainnet-production: ${GIT_REF_TO_DEPLOY}"
93-
else
94-
# Gets all env vars with `dev_` prefix and re-exports them without the prefix
95-
for var in "${!dev_@}"; do
96-
export ${var#dev_}="${!var}"
97-
done
98-
make migrate;
99-
make build-daemon;
100-
make deploy-lambdas-dev-testnet;
101-
make push-daemon;
102-
fi;
12+
deploy_hathor_network_account() {
13+
exit=false;
14+
15+
# Checks whether there is a file called "rollback_mainnet_production", which is used by our other CodeBuild to indicate that this is a mainnet-production rollback
16+
if [ -f "rollback_mainnet_production" ]; then
17+
# Gets all env vars with `mainnet_` prefix and re-exports them without the prefix
18+
for var in "${!mainnet_@}"; do
19+
export ${var#mainnet_}="${!var}"
20+
done
21+
make deploy-lambdas-mainnet;
22+
send_slack_message "Rollback performed on mainnet-production to: ${GIT_REF_TO_DEPLOY}";
23+
exit=true;
24+
fi;
25+
26+
# Checks whether there is a file called "rollback_testnet_production", which is used by our other CodeBuild to indicate that this is a testnet-production rollback
27+
if [ -f "rollback_testnet_production" ]; then
28+
# Gets all env vars with `testnet_` prefix and re-exports them without the prefix
29+
for var in "${!testnet_@}"; do
30+
export ${var#testnet_}="${!var}"
31+
done
32+
make deploy-lambdas-testnet;
33+
send_slack_message "Rollback performed on testnet-production to: ${GIT_REF_TO_DEPLOY}";
34+
exit=true;
35+
fi;
36+
37+
if [ "$exit" = true ]; then
38+
echo "Rollbacks performed successfully. Exiting now.";
39+
exit 0;
40+
fi
41+
42+
if expr "${GIT_REF_TO_DEPLOY}" : "master" >/dev/null; then
43+
# Gets all env vars with `dev_` prefix and re-exports them without the prefix
44+
for var in "${!dev_@}"; do
45+
export ${var#dev_}="${!var}"
46+
done
47+
48+
make migrate;
49+
make build-daemon;
50+
make deploy-lambdas-dev-testnet;
51+
# The idea here is that if the lambdas deploy fail, the built image won't be pushed:
52+
make push-daemon;
53+
54+
elif expr "${GIT_REF_TO_DEPLOY}" : "v[0-9]\+\.[0-9]\+\.[0-9]\+-rc\.[0-9]\+" >/dev/null; then
55+
# Gets all env vars with `mainnet_staging_` prefix and re-exports them without the prefix
56+
for var in "${!mainnet_staging_@}"; do
57+
export ${var#mainnet_staging_}="${!var}"
58+
done
59+
60+
echo $GIT_REF_TO_DEPLOY > /tmp/docker_image_tag
61+
make migrate;
62+
make build-daemon;
63+
make deploy-lambdas-mainnet-staging;
64+
# The idea here is that if the lambdas deploy fail, the built image won't be pushed:
65+
make push-daemon;
66+
send_slack_message "New version deployed to mainnet-staging: ${GIT_REF_TO_DEPLOY}"
67+
elif expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
68+
echo $GIT_REF_TO_DEPLOY > /tmp/docker_image_tag
69+
make build-daemon;
70+
71+
# --- Testnet ---
72+
# Gets all env vars with `testnet_` prefix and re-exports them without the prefix
73+
for var in "${!testnet_@}"; do
74+
export ${var#testnet_}="${!var}"
75+
done
76+
77+
make migrate;
78+
make deploy-lambdas-testnet;
79+
80+
# Unsets all the testnet env vars so we make sure they don't leak to other deploys
81+
for var in "${!testnet_@}"; do
82+
unset ${var#testnet_}
83+
done
84+
85+
# --- Mainnet ---
86+
# Gets all env vars with `mainnet_` prefix and re-exports them without the prefix
87+
for var in "${!mainnet_@}"; do
88+
export ${var#mainnet_}="${!var}"
89+
done
90+
make migrate;
91+
make deploy-lambdas-mainnet;
92+
93+
# Unsets all the mainnet env vars so we make sure they don't leak to other deploys
94+
for var in "${!mainnet_@}"; do
95+
unset ${var#mainnet_}
96+
done
97+
98+
# The idea here is that if the lambdas deploy fail, the built image won't be pushed:
99+
make push-daemon;
100+
send_slack_message "New version deployed to testnet-production and mainnet-production: ${GIT_REF_TO_DEPLOY}"
101+
else
102+
# Gets all env vars with `dev_` prefix and re-exports them without the prefix
103+
for var in "${!dev_@}"; do
104+
export ${var#dev_}="${!var}"
105+
done
106+
make migrate;
107+
make build-daemon;
108+
make deploy-lambdas-dev-testnet;
109+
# The idea here is that if the lambdas deploy fail, the built image won't be pushed:
110+
make push-daemon;
111+
fi;
112+
}
113+
114+
deploy_nano_testnet() {
115+
# Deploys the releases and release-candidates to our nano-testnet environment
116+
117+
# We deploy only the Lambdas here, because the daemon used in nano-testnet is the same as
118+
# the one built in the hathor-network account, since it runs there as well
119+
120+
echo "Building git ref ${GIT_REF_TO_DEPLOY}..."
121+
122+
# This will match both releases and release-candidates
123+
if expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
124+
make migrate;
125+
make deploy-lambdas-nano-testnet;
126+
127+
send_slack_message "New version deployed to nano-testnet: ${GIT_REF_TO_DEPLOY}"
128+
elif expr "${MANUAL_DEPLOY}" : "true" >/dev/null; then
129+
make migrate;
130+
make deploy-lambdas-nano-testnet;
131+
132+
send_slack_message "Branch manually deployed to nano-testnet: ${GIT_REF_TO_DEPLOY}"
133+
elif expr "${ROLLBACK}" : "true" >/dev/null; then
134+
make migrate;
135+
make deploy-lambdas-nano-testnet;
136+
137+
send_slack_message "Rollback performed on nano-tesnet to: ${GIT_REF_TO_DEPLOY}";
138+
else
139+
echo "We don't deploy ${GIT_REF_TO_DEPLOY} to nano-testnet. Nothing to do.";
140+
fi;
141+
}
142+
143+
deploy_ekvilibro_mainnet() {
144+
# Deploys the releases to our ekvilibro-mainnet environment
145+
146+
# We deploy only the Lambdas here, because the daemon used in ekvilibro-testnet is the same as
147+
# the one built in the hathor-network account, since it runs there as well
148+
149+
echo "Building git ref ${GIT_REF_TO_DEPLOY}..."
150+
151+
# This will match release-candidates
152+
if expr "${GIT_REF_TO_DEPLOY}" : "v[0-9]\+\.[0-9]\+\.[0-9]\+-rc\.[0-9]\+" >/dev/null; then
153+
echo "We don't deploy ${GIT_REF_TO_DEPLOY} to ekvilibro-mainnet. Nothing to do.";
154+
# This will match releases only (since release-candidates are already matched above)
155+
elif expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
156+
make migrate;
157+
make deploy-lambdas-ekvilibro-mainnet;
158+
159+
send_slack_message "New version deployed to ekvilibro-mainnet: ${GIT_REF_TO_DEPLOY}"
160+
elif expr "${MANUAL_DEPLOY}" : "true" >/dev/null; then
161+
make migrate;
162+
make deploy-lambdas-ekvilibro-mainnet;
163+
164+
send_slack_message "Branch manually deployed to ekvilibro-mainnet: ${GIT_REF_TO_DEPLOY}"
165+
elif expr "${ROLLBACK}" : "true" >/dev/null; then
166+
make migrate;
167+
make deploy-lambdas-ekvilibro-mainnet;
168+
169+
send_slack_message "Rollback performed on ekvilibro-mainnet to: ${GIT_REF_TO_DEPLOY}";
170+
else
171+
echo "We don't deploy ${GIT_REF_TO_DEPLOY} to ekvilibro-mainnet. Nothing to do.";
172+
fi;
173+
174+
}
175+
176+
deploy_ekvilibro_testnet() {
177+
# Deploys the release-candidates and releases to our ekvilibro-testnet environment
178+
179+
# We deploy only the Lambdas here, because the daemon used in ekvilibro-testnet is the same as
180+
# the one built in the hathor-network account, since it runs there as well
181+
182+
echo "Building git ref ${GIT_REF_TO_DEPLOY}..."
183+
184+
# This will match release-candidates or releases
185+
if expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
186+
make migrate;
187+
make deploy-lambdas-ekvilibro-testnet;
188+
189+
send_slack_message "New version deployed to ekvilibro-testnet: ${GIT_REF_TO_DEPLOY}"
190+
elif expr "${MANUAL_DEPLOY}" : "true" >/dev/null; then
191+
make migrate;
192+
make deploy-lambdas-ekvilibro-testnet;
193+
194+
send_slack_message "Branch manually deployed to ekvilibro-testnet: ${GIT_REF_TO_DEPLOY}"
195+
elif expr "${ROLLBACK}" : "true" >/dev/null; then
196+
make migrate;
197+
make deploy-lambdas-ekvilibro-testnet;
198+
199+
send_slack_message "Rollback performed on ekvilibro-testnet to: ${GIT_REF_TO_DEPLOY}";
200+
else
201+
echo "We don't deploy ${GIT_REF_TO_DEPLOY} to ekvilibro-testnet. Nothing to do.";
202+
fi;
203+
}
204+
205+
206+
# Check the first argument for the desired deploy
207+
option=$1
208+
209+
case $option in
210+
# This will be triggered from /.codebuild/buildspec.yml in this repo
211+
hathor-network)
212+
deploy_hathor_network_account
213+
;;
214+
nano-testnet)
215+
deploy_nano_testnet
216+
;;
217+
ekvilibro-testnet)
218+
deploy_ekvilibro_testnet
219+
;;
220+
ekvilibro-mainnet)
221+
deploy_ekvilibro_mainnet
222+
;;
223+
*)
224+
echo "Invalid option: $option"
225+
exit 1
226+
;;
227+
esac

.codebuild/buildspec.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ env:
8989
dev_FIREBASE_CLIENT_X509_CERT_URL: "WalletService/dev:FIREBASE_CLIENT_X509_CERT_URL"
9090
dev_ALERT_MANAGER_REGION: "WalletService/dev:ALERT_MANAGER_REGION"
9191
dev_ALERT_MANAGER_TOPIC: "WalletService/dev:ALERT_MANAGER_TOPIC"
92+
dev_ALERT_MANAGER_ACCOUNT_ID: "WalletService/dev:ALERT_MANAGER_ACCOUNT_ID"
9293
# Testnet secrets
9394
testnet_ACCOUNT_ID: "WalletService/testnet:account_id"
9495
testnet_AUTH_SECRET: "WalletService/testnet:auth_secret"
@@ -114,6 +115,7 @@ env:
114115
testnet_FIREBASE_CLIENT_X509_CERT_URL: "WalletService/testnet:FIREBASE_CLIENT_X509_CERT_URL"
115116
testnet_ALERT_MANAGER_REGION: "WalletService/testnet:ALERT_MANAGER_REGION"
116117
testnet_ALERT_MANAGER_TOPIC: "WalletService/testnet:ALERT_MANAGER_TOPIC"
118+
testnet_ALERT_MANAGER_ACCOUNT_ID: "WalletService/testnet:ALERT_MANAGER_ACCOUNT_ID"
117119
# Mainnet Staging secrets
118120
mainnet_staging_ACCOUNT_ID: "WalletService/mainnet_staging:account_id"
119121
mainnet_staging_AUTH_SECRET: "WalletService/mainnet_staging:auth_secret"
@@ -139,6 +141,7 @@ env:
139141
mainnet_staging_FIREBASE_CLIENT_X509_CERT_URL: "WalletService/mainnet_staging:FIREBASE_CLIENT_X509_CERT_URL"
140142
mainnet_staging_ALERT_MANAGER_REGION: "WalletService/mainnet_staging:ALERT_MANAGER_REGION"
141143
mainnet_staging_ALERT_MANAGER_TOPIC: "WalletService/mainnet_staging:ALERT_MANAGER_TOPIC"
144+
mainnet_staging_ALERT_MANAGER_ACCOUNT_ID: "WalletService/mainnet_staging:ALERT_MANAGER_ACCOUNT_ID"
142145
# Mainnet secrets
143146
mainnet_ACCOUNT_ID: "WalletService/mainnet:account_id"
144147
mainnet_AUTH_SECRET: "WalletService/mainnet:auth_secret"
@@ -164,6 +167,7 @@ env:
164167
mainnet_FIREBASE_CLIENT_X509_CERT_URL: "WalletService/mainnet:FIREBASE_CLIENT_X509_CERT_URL"
165168
mainnet_ALERT_MANAGER_REGION: "WalletService/mainnet:ALERT_MANAGER_REGION"
166169
mainnet_ALERT_MANAGER_TOPIC: "WalletService/mainnet:ALERT_MANAGER_TOPIC"
170+
mainnet_ALERT_MANAGER_ACCOUNT_ID: "WalletService/mainnet:ALERT_MANAGER_ACCOUNT_ID"
167171
phases:
168172
install:
169173
#If you use the Ubuntu standard image 2.0 or later, you must specify runtime-versions.
@@ -182,4 +186,4 @@ phases:
182186
- export GIT_REF_TO_DEPLOY=$(cat git_ref_to_deploy)
183187
build:
184188
commands:
185-
- bash .codebuild/build.sh
189+
- bash .codebuild/build.sh hathor-network

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ build-daemon:
1010
push-daemon:
1111
bash scripts/push-daemon.sh
1212

13+
.PHONY: deploy-lambdas-nano-testnet
14+
deploy-lambdas-nano-testnet:
15+
AWS_SDK_LOAD_CONFIG=1 yarn workspace wallet-service run serverless deploy --stage nano --region eu-central-1 --aws-profile nano-testnet
16+
17+
.PHONY: deploy-lambdas-ekvilibro-testnet
18+
deploy-lambdas-ekvilibro-testnet:
19+
AWS_SDK_LOAD_CONFIG=1 yarn workspace wallet-service run serverless deploy --stage ekvilibro --region eu-central-1 --aws-profile ekvilibro
20+
21+
.PHONY: deploy-lambdas-ekvilibro-mainnet
22+
deploy-lambdas-ekvilibro-mainnet:
23+
AWS_SDK_LOAD_CONFIG=1 yarn workspace wallet-service run serverless deploy --stage ekvi-main --region eu-central-1 --aws-profile ekvilibro
24+
1325
.PHONY: deploy-lambdas-dev-testnet
1426
deploy-lambdas-dev-testnet:
1527
AWS_SDK_LOAD_CONFIG=1 yarn workspace wallet-service run serverless deploy --stage dev-testnet --region eu-central-1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
/** @type {import('sequelize-cli').Migration} */
4+
module.exports = {
5+
async up(queryInterface) {
6+
await queryInterface.addIndex(
7+
'address',
8+
['wallet_id', 'index'],
9+
{
10+
name: 'idx_wallet_address_index',
11+
}
12+
);
13+
},
14+
15+
async down(queryInterface) {
16+
await queryInterface.removeIndex('address', 'idx_wallet_address_index');
17+
}
18+
};

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
nixpkgs-fmt
3737
nodejs_20
3838
yarn
39+
docker-compose
3940
];
4041
};
4142
});

0 commit comments

Comments
 (0)