-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from bandprotocol/deployment
Falcon deployment
- Loading branch information
Showing
4 changed files
with
129 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
steps: | ||
# git authentication | ||
- name: "gcr.io/cloud-builders/git" | ||
id: git ssh authentication | ||
secretEnv: ["SSH_KEY"] | ||
entrypoint: "bash" | ||
args: | ||
- -c | ||
- | | ||
echo "$$SSH_KEY" >> /root/.ssh/id_rsa | ||
chmod 400 /root/.ssh/id_rsa | ||
cp known_hosts.github /root/.ssh/known_hosts | ||
volumes: | ||
- name: "ssh" | ||
path: /root/.ssh | ||
|
||
# build docker image | ||
- name: "gcr.io/cloud-builders/docker" | ||
id: build-docker-iamge | ||
args: ["build", "-t", "asia-southeast1-docker.pkg.dev/${PROJECT_ID}/band-feeder/$_SERVICE_NAME:$SHORT_SHA", "."] | ||
|
||
# push docker image in GCR | ||
- name: "gcr.io/cloud-builders/docker" | ||
id: push-docker-image-to-gcr | ||
args: ["push", "asia-southeast1-docker.pkg.dev/${PROJECT_ID}/band-feeder/$_SERVICE_NAME:$SHORT_SHA"] | ||
|
||
# install yq | ||
- name: gcr.io/cloud-builders/wget | ||
args: | ||
- "-qO" | ||
- /workspace/yq | ||
- "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64" | ||
|
||
# update image based on SHORT_SHA and push in manifest repo | ||
- name: "gcr.io/cloud-builders/gcloud" | ||
id: update-image | ||
entrypoint: /bin/sh | ||
secretEnv: ["SSH_KEY"] | ||
args: | ||
- "-c" | ||
- | | ||
chmod +x /workspace/yq | ||
git clone [email protected]:bandprotocol/band-feeder-gke-manifest-testnet.git -b ${_CD_BRANCH} | ||
cd band-feeder-gke-manifest-testnet/helm-values/playground | ||
sed -i -e "/^image:/,/tag:/{/^\([[:space:]]*tag: \).*/s//\1"\"${SHORT_SHA}\""/}" poc-falcon.yaml | ||
toml=`cat /workspace/config.toml` /workspace/yq -i '.configMap.json = strenv(toml) ' poc-falcon.yaml | ||
echo "Pushing changes to k8s manifest repo ..." | ||
git config --global user.name "cloudbuild-commit" | ||
git config --global user.email "[email protected]" | ||
git add -A | ||
git status | ||
git commit -m "Updated image tag based on ${SHORT_SHA} for ${_SERVICE_NAME}" | ||
git pull --rebase | ||
until git push [email protected]:bandprotocol/band-feeder-gke-manifest-testnet.git ${_CD_BRANCH} | ||
do | ||
git pull --rebase | ||
git push [email protected]:bandprotocol/band-feeder-gke-manifest-testnet.git ${_CD_BRANCH} | ||
done | ||
volumes: | ||
- name: "ssh" | ||
path: /root/.ssh | ||
|
||
substitutions: | ||
_SERVICE_NAME: poc-falcon | ||
_CD_BRANCH: poc-production | ||
|
||
options: | ||
logging: CLOUD_LOGGING_ONLY | ||
machineType: "E2_HIGHCPU_8" | ||
dynamic_substitutions: true | ||
|
||
availableSecrets: | ||
secretManager: | ||
- versionName: projects/${PROJECT_ID}/secrets/github-token/versions/latest | ||
env: "SSH_KEY" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[global] | ||
log_level = '' | ||
checking_packet_interval = 60000000000 | ||
sync_tunnels_interval = 60000000000 | ||
max_checking_packet_penalty_duration = 300000000000 | ||
penalty_exponential_factor = 1.1 | ||
|
||
[bandchain] | ||
rpc_endpoints = ['https://rpc.band-v3-testnet.bandchain.org/'] | ||
liveliness_checking_interval = 1800000000000 | ||
timeout = 5 | ||
|
||
[target_chains] | ||
|
||
[target_chains.holesky-testnet] | ||
endpoints = ['https://ethereum-holesky-rpc.publicnode.com'] | ||
chain_type = 'evm' | ||
max_retry = 3 | ||
query_timeout = 3000000000 | ||
execute_timeout = 0 | ||
chain_id = 17000 | ||
tunnel_router_address = '0xD3F452702484c9Fe7889F820B01BF7B0E20b221B' | ||
block_confirmation = 1 | ||
waiting_tx_duration = 90000000000 | ||
liveliness_checking_interval = 1800000000000 | ||
max_priority_fee = 100000000 | ||
max_base_fee = 100000000 | ||
checking_tx_interval = 3000000000 | ||
gas_type = 'eip1559' | ||
gas_multiplier = 1.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# Copy config from config map mount path | ||
falcon config init | ||
cp /config/config.toml /app/.falcon/config/config.toml | ||
|
||
# Add keys to key ring | ||
falcon keys add holesky-testnet testkey-1 --private-key $ETH_PRIV_KEY | ||
|
||
# Start Service | ||
falcon start |