Skip to content

Commit db2e26c

Browse files
authored
ci: fix error on binary installation in deployment script (#882)
* ci: update sui binary version * ci: update * ci: update keyname * ci: fix archwayd installation * ci: add script to add secret to aws secret manager * ci: fix cargo installation * ci: cargo installation * ci: fix cargo installation * ci: add path and increase machine size * ci: update avm installation * ci: fix cargo install error
1 parent 79a8178 commit db2e26c

File tree

2 files changed

+68
-11
lines changed

2 files changed

+68
-11
lines changed

.github/deployer/ec2_deployer.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ data "template_file" "init_script" {
4141
}
4242

4343
resource "aws_key_pair" "deployer_root_key" {
44-
key_name = "deployer_root_key"
44+
key_name = "deployer_root_key_mainnet"
4545
public_key = file("./id_rsa.pub")
4646

4747
}
@@ -66,8 +66,8 @@ locals {
6666

6767
resource "aws_instance" "ibc-deployer" {
6868
ami = data.aws_ami.ubuntu.id
69-
instance_type = "t2.micro"
70-
key_name = "deployer_root_key"
69+
instance_type = "t3.medium"
70+
key_name = "deployer_root_key_mainnet"
7171

7272
subnet_id = var.subnet_id
7373
vpc_security_group_ids = local.parsed_security_groups
@@ -78,7 +78,7 @@ resource "aws_instance" "ibc-deployer" {
7878
}
7979

8080
tags = {
81-
Name = "ibc-contract-deployer"
81+
Name = "ibc-contract-deployer-mainnet"
8282
Project = "IBC"
8383
}
8484

.github/deployer/init_script.sh

+64-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ JAVA_VERS="11.0.18_10"
1616
ARCHWAY_VERS="7.0.0"
1717
INJECTIVE_VERS="1.12.1-1705909076"
1818
NEUTRON_VERS="3.0.2"
19-
SUI_VERS="mainnet-v1.25.1"
19+
SUI_VERS="mainnet-v1.30.1"
2020

2121
set -x
2222
export GOROOT=/usr/local/go
@@ -64,6 +64,7 @@ systemctl enable auditd
6464
systemctl start auditd
6565

6666

67+
6768
# Configure auditd
6869
echo '-a always,exit -F arch=b64 -S execve -k command-exec
6970
-a always,exit -F arch=b32 -S execve -k command-exec' >> /etc/audit/audit.rules
@@ -98,9 +99,9 @@ EOF
9899
chmod +x clone.expect
99100
git config --global credential.helper "cache --timeout=604800"
100101
./clone.expect "$CI_USER" "$GITHUB_ACCESS_TOKEN"
101-
CI_USER_ESCAPED="$${CI_USER//@/%40}"
102-
echo -e "[credential]\n\thelper = store" >> ~/.gitconfig
103-
echo "https://$${CI_USER_ESCAPED}.com:$${GITHUB_ACCESS_TOKEN}@gihub.com" > ~/.git-credentials
102+
# CI_USER_ESCAPED="$${CI_USER//@/%40}"
103+
# echo -e "[credential]\n\thelper = store" >> ~/.gitconfig
104+
# echo "https://$${CI_USER_ESCAPED}:$${GITHUB_ACCESS_TOKEN}@gihub.com" > ~/.git-credentials
104105

105106
cd /opt/deployer/root/ibc-devops
106107
git checkout $${DEPLOY_SCRIPT_BRANCH}
@@ -136,8 +137,8 @@ tar xf OpenJDK11U-jdk_x64_linux_hotspot_$${JAVA_VERS}.tar.gz -C /opt/java
136137
go install github.com/icon-project/goloop/cmd/goloop@latest
137138

138139
# Install archway
139-
wget -q https://github.com/archway-network/archway/releases/download/v$${ARCHWAY_VERS}/archwayd_$${ARCHWAY_VERS}_linux_amd64.zip
140-
unzip archwayd_$${ARCHWAY_VERS}_linux_amd64.zip
140+
wget -q https://github.com/archway-network/archway/releases/download/v$${ARCHWAY_VERS}/archwayd_v$${ARCHWAY_VERS}_linux_amd64.zip
141+
unzip archwayd_v$${ARCHWAY_VERS}_linux_amd64.zip
141142
sudo cp archwayd /usr/local/bin
142143

143144
# Install injectived
@@ -164,13 +165,57 @@ sudo chmod a+x /usr/local/bin/dasel
164165

165166
# Install boto3, yq, and jq
166167
apt-get install python3-pip -y
167-
pip3 install boto3
168+
pip3 install boto3 pwinput
168169
apt-get install jq -y
169170
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
170171
chmod +x /usr/local/bin/yq
171172

173+
## Install rust
174+
echo "Installing cargo"
175+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init.sh
176+
177+
cat << 'EOF' > cargo.expect
178+
#!/usr/bin/expect
179+
set timeout -1
180+
spawn sh rustup-init.sh
181+
expect "1) Proceed with standard installation (default - just press enter)"
182+
send "\r"
183+
expect {
184+
"2) Customize installation" {
185+
send "\r"
186+
exp_continue
187+
}
188+
"3) Cancel installation" {
189+
send "\r"
190+
exp_continue
191+
}
192+
eof
193+
}
194+
EOF
195+
196+
chmod +x cargo.expect
197+
./cargo.expect
198+
172199
cd -
173200

201+
# Create sui client config
202+
mkdir -p /root/.sui/sui_config
203+
cat <<EOF > /root/.sui/sui_config/sui.keystore
204+
keystore:
205+
File: /root/.sui/sui_config/sui.keystore
206+
envs:
207+
- alias: testnet
208+
rpc: "https://fullnode.testnet.sui.io:443"
209+
ws: ~
210+
basic_auth: ~
211+
- alias: mainnet
212+
rpc: "https://fullnode.mainnet.sui.io:443"
213+
ws: ~
214+
basic_auth: ~
215+
active_env: mainnet
216+
active_address: "0x539c665cd9899d040c56756df8f7ed34649ab6aeae28da5cb07d3274dc9f9d36"
217+
EOF
218+
174219
# Configure sudo
175220
echo 'deployr ALL=(ALL) NOPASSWD: /opt/deployer/bin/run.sh
176221
deployr ALL=(ALL) NOPASSWD: /opt/deployer/bin/fetch_keys.sh
@@ -188,5 +233,17 @@ alias pull-deploy-script='sudo /opt/deployer/bin/update_git.sh'
188233
alias check-env='sudo /opt/deployer/bin/check-parameter.sh'
189234
alias make='sudo /opt/deployer/bin/deploy.sh'" >> $${DEPLOYR_HOME}/.bashrc
190235

236+
chmod +x /opt/deployer/root/keyutils/add_secret.sh
237+
echo "## Aliases
238+
alias add-secrets='/opt/deployer/root/keyutils/add_secret.sh'" >> /root/.bashrc
239+
240+
## Install solana
241+
source "/root/.cargo/env"
242+
243+
export PATH=$${PATH}:/root/.cargo/bin
244+
245+
sudo apt-get install -y pkg-config build-essential libudev-dev libssl-dev
246+
/root/.cargo/bin/cargo install --git https://github.com/coral-xyz/anchor avm --locked --force || true
247+
avm install 0.30.1 ||
191248
chmod 400 /tmp/user_data_log.out || true
192249

0 commit comments

Comments
 (0)