Update deployer script for new frontend app
This commit is contained in:
parent
ad292ef1fa
commit
0b883c322c
3
apps/deployer/.env.example
Normal file
3
apps/deployer/.env.example
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
REGISTRY_BOND_ID=
|
||||||
|
DEPLOYER_LRN=
|
||||||
|
AUTHORITY=
|
@ -7,22 +7,37 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install jq # if you do not have jq installed already
|
# if you do not have jq installed already
|
||||||
|
brew install jq
|
||||||
|
# OR
|
||||||
|
sudo apt-get install jq
|
||||||
```
|
```
|
||||||
|
|
||||||
- Run script to deploy app
|
- Copy and update `.env`
|
||||||
|
|
||||||
- To deploy frontend app to `dashboard.staging.apps.snowballtools.com`
|
```
|
||||||
|
cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
Set the required variables:
|
||||||
./deploy-frontend.staging.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
- To deploy frontend app to `dashboard.apps.snowballtools.com`
|
```
|
||||||
|
REGISTRY_BOND_ID=<bond-id>
|
||||||
|
DEPLOYER_LRN=lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io
|
||||||
|
AUTHORITY=vaasl
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
Note: The bond id should be set to the `vaasl` authority
|
||||||
./deploy-frontend.sh
|
|
||||||
```
|
- Set the `userKey` and `bondId` in [config.yml](./config.yml)
|
||||||
|
|
||||||
|
Note: The `bondId` should be created by the `userKey` account
|
||||||
|
|
||||||
|
- Run script to deploy app to `deploy.laconic.com`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./deploy-frontend.sh
|
||||||
|
```
|
||||||
|
|
||||||
- Commit the updated [ApplicationRecord](records/application-record.yml) and [ApplicationDeploymentRequest](records/application-deployment-request.yml) files to the repository
|
- Commit the updated [ApplicationRecord](records/application-record.yml) and [ApplicationDeploymentRequest](records/application-deployment-request.yml) files to the repository
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
services:
|
services:
|
||||||
registry:
|
registry:
|
||||||
rpcEndpoint: https://laconicd-sapo.laconic.com
|
rpcEndpoint: https://laconicd-mainnet-1.laconic.com/
|
||||||
gqlEndpoint: https://laconicd-sapo.laconic.com/api
|
gqlEndpoint: https://laconicd-mainnet-1.laconic.com/api
|
||||||
userKey:
|
userKey:
|
||||||
bondId:
|
bondId:
|
||||||
chainId: laconic-testnet-2
|
chainId: laconic-mainnet
|
||||||
gasPrice: 0.001alnt
|
gasPrice: 0.001alnt
|
||||||
|
@ -6,7 +6,7 @@ echo "Using DEPLOYER_LRN: $DEPLOYER_LRN"
|
|||||||
echo "Using AUTHORITY: $AUTHORITY"
|
echo "Using AUTHORITY: $AUTHORITY"
|
||||||
|
|
||||||
# Repository URL
|
# Repository URL
|
||||||
REPO_URL="https://git.vdb.to/cerc-io/snowballtools-base"
|
REPO_URL="https://git.vdb.to/NasSharaf/laconic-deployer-frontend"
|
||||||
|
|
||||||
# Get the latest commit hash for a branch
|
# Get the latest commit hash for a branch
|
||||||
BRANCH_NAME="main"
|
BRANCH_NAME="main"
|
||||||
@ -25,7 +25,7 @@ CONFIG_FILE=config.yml
|
|||||||
# Reference: https://git.vdb.to/cerc-io/test-progressive-web-app/src/branch/main/scripts
|
# Reference: https://git.vdb.to/cerc-io/test-progressive-web-app/src/branch/main/scripts
|
||||||
|
|
||||||
# Get latest version from registry and increment application-record version
|
# Get latest version from registry and increment application-record version
|
||||||
NEW_APPLICATION_VERSION=$(pnpm --silent laconic -c $CONFIG_FILE registry record list --type ApplicationRecord --all --name "deploy-frontend" 2>/dev/null | jq -r -s ".[] | sort_by(.createTime) | reverse | [ .[] | select(.bondId == \"$REGISTRY_BOND_ID\") ] | .[0].attributes.version" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
NEW_APPLICATION_VERSION=$(pnpm --silent laconic -c $CONFIG_FILE registry record list --type ApplicationRecord --all --name "laconic-deployer-frontend" 2>/dev/null | jq -r -s ".[] | sort_by(.createTime) | reverse | [ .[] | select(.bondId == \"$REGISTRY_BOND_ID\") ] | .[0].attributes.version" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
||||||
|
|
||||||
if [ -z "$NEW_APPLICATION_VERSION" ] || [ "1" == "$NEW_APPLICATION_VERSION" ]; then
|
if [ -z "$NEW_APPLICATION_VERSION" ] || [ "1" == "$NEW_APPLICATION_VERSION" ]; then
|
||||||
# Set application-record version if no previous records were found
|
# Set application-record version if no previous records were found
|
||||||
@ -40,7 +40,7 @@ record:
|
|||||||
repository_ref: $LATEST_HASH
|
repository_ref: $LATEST_HASH
|
||||||
repository: ["$REPO_URL"]
|
repository: ["$REPO_URL"]
|
||||||
app_type: webapp
|
app_type: webapp
|
||||||
name: deploy-frontend
|
name: laconic-deployer-frontend
|
||||||
app_version: $PACKAGE_VERSION
|
app_version: $PACKAGE_VERSION
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ echo "ApplicationRecord published"
|
|||||||
echo $RECORD_ID
|
echo $RECORD_ID
|
||||||
|
|
||||||
# Set name to record
|
# Set name to record
|
||||||
REGISTRY_APP_LRN="lrn://$AUTHORITY/applications/deploy-frontend"
|
REGISTRY_APP_LRN="lrn://$AUTHORITY/applications/laconic-deployer-frontend"
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
pnpm --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${PACKAGE_VERSION}" "$RECORD_ID"
|
pnpm --silent laconic -c $CONFIG_FILE registry name set "$REGISTRY_APP_LRN@${PACKAGE_VERSION}" "$RECORD_ID"
|
||||||
@ -122,10 +122,10 @@ cat >./records/application-deployment-request.yml <<EOF
|
|||||||
record:
|
record:
|
||||||
type: ApplicationDeploymentRequest
|
type: ApplicationDeploymentRequest
|
||||||
version: '1.0.0'
|
version: '1.0.0'
|
||||||
name: deploy-frontend@$PACKAGE_VERSION
|
name: laconic-deployer-frontend@$PACKAGE_VERSION
|
||||||
application: lrn://$AUTHORITY/applications/deploy-frontend@$PACKAGE_VERSION
|
application: lrn://$AUTHORITY/applications/laconic-deployer-frontend@$PACKAGE_VERSION
|
||||||
deployer: $DEPLOYER_LRN
|
deployer: $DEPLOYER_LRN
|
||||||
dns: deploy.laconic.com
|
dns: deploy-staging.laconic.com
|
||||||
config:
|
config:
|
||||||
env:
|
env:
|
||||||
LACONIC_HOSTED_CONFIG_server_url: https://deploy-backend.laconic.com
|
LACONIC_HOSTED_CONFIG_server_url: https://deploy-backend.laconic.com
|
||||||
|
Loading…
Reference in New Issue
Block a user