From e79b8d41105072108eac48ab4eb449025fb11789 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Thu, 3 Jul 2025 16:47:13 +0530 Subject: [PATCH] Add build and run scripts to be used by webapp-deployer --- apps/deployer/README.md | 7 +++++++ apps/deployer/deploy-frontend.sh | 21 +++++++++++++-------- build-webapp.sh | 19 +++++++++++++++++++ readme.md | 28 +++++++++++++++++++++++++++- run-webapp.sh | 22 ++++++++++++++++++++++ 5 files changed, 88 insertions(+), 9 deletions(-) create mode 100755 build-webapp.sh create mode 100755 run-webapp.sh diff --git a/apps/deployer/README.md b/apps/deployer/README.md index 8f64a98..5f3d8ed 100644 --- a/apps/deployer/README.md +++ b/apps/deployer/README.md @@ -33,6 +33,13 @@ Note: The `bondId` should be created by the `userKey` account +- Set the actual values for env in [deploy-frontend.sh](./deploy-frontend.sh) for the following: + ```sh + NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_key + CLERK_SECRET_KEY=your_clerk_secret + NEXT_PUBLIC_GITHUB_FALLBACK_TOKEN=your_github_token + ``` + - Run script to deploy app to `deploy.laconic.com` ```bash diff --git a/apps/deployer/deploy-frontend.sh b/apps/deployer/deploy-frontend.sh index 50350b7..87d85cb 100755 --- a/apps/deployer/deploy-frontend.sh +++ b/apps/deployer/deploy-frontend.sh @@ -39,7 +39,7 @@ record: version: $NEW_APPLICATION_VERSION repository_ref: $LATEST_HASH repository: ["$REPO_URL"] - app_type: webapp + app_type: webapp/next name: laconic-deployer-frontend app_version: $PACKAGE_VERSION EOF @@ -128,13 +128,12 @@ record: dns: deploy-staging.laconic.com config: env: - LACONIC_HOSTED_CONFIG_server_url: https://deploy-backend.laconic.com - LACONIC_HOSTED_CONFIG_github_clientid: Ov23li4NtYybQlF6u5Dk - LACONIC_HOSTED_CONFIG_github_pwa_templaterepo: laconic-templates/test-progressive-web-app - LACONIC_HOSTED_CONFIG_github_image_upload_templaterepo: laconic-templates/image-upload-pwa-example - LACONIC_HOSTED_CONFIG_github_next_app_templaterepo: laconic-templates/starter.nextjs-react-tailwind - LACONIC_HOSTED_CONFIG_laconicd_chain_id: laconic-testnet-2 - LACONIC_HOSTED_CONFIG_wallet_iframe_url: https://wallet.laconic.com + NEXT_PUBLIC_WALLET_IFRAME_URL=https://wallet.laconic.com + NEXT_PUBLIC_LACONICD_CHAIN_ID=laconic-mainnet + NEXT_PUBLIC_API_URL=https://deploy-backend.laconic.com + NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_key + CLERK_SECRET_KEY=your_clerk_secret + NEXT_PUBLIC_GITHUB_FALLBACK_TOKEN=your_github_token meta: note: Added @ $CURRENT_DATE_TIME repository: "$REPO_URL" @@ -142,6 +141,12 @@ record: payment: $txHash EOF +# Old env values for frontend app +# LACONIC_HOSTED_CONFIG_github_clientid: Ov23li4NtYybQlF6u5Dk +# LACONIC_HOSTED_CONFIG_github_pwa_templaterepo: laconic-templates/test-progressive-web-app +# LACONIC_HOSTED_CONFIG_github_image_upload_templaterepo: laconic-templates/image-upload-pwa-example +# LACONIC_HOSTED_CONFIG_github_next_app_templaterepo: laconic-templates/starter.nextjs-react-tailwind + RECORD_FILE=records/application-deployment-request.yml sleep 2 diff --git a/build-webapp.sh b/build-webapp.sh new file mode 100755 index 0000000..d550c3f --- /dev/null +++ b/build-webapp.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +PKG_DIR="./apps/deploy-fe" + +cat > $PKG_DIR/.env < + + +- Change branch + ```bash + git checkout ng-support-custom-nextjs + ``` + +- Build the container for app + ```bash + laconic-so build-webapp --source-repo /laconic-deployer-frontend --base-container cerc/nextjs-base + ``` + +- Create an env file as described in [previous steps](#3-configure-environment-variables) + +- Run the webapp container locally + ```bash + docker run -p 3000:3000 --env-file cerc/laconic-deployer-frontend:local + ``` + +- Scripts used for deployment + - App container build : [build-webapp.sh](./build-webapp.sh) + - Run app container : [run-webapp.sh](./run-webapp.sh) diff --git a/run-webapp.sh b/run-webapp.sh new file mode 100755 index 0000000..83e4516 --- /dev/null +++ b/run-webapp.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +PKG_DIR="./apps/deploy-fe" + +cd $PKG_DIR + +cat > .env.local <