From c0e3e31a8138f4b8118b03b059aef05f3357019d 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 | 17 ++++++----------- readme.md | 28 +++++++++++++++++++++++++++- run-webapp.sh | 4 ++-- 5 files changed, 55 insertions(+), 22 deletions(-) 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 index 5d61b56..6081fb1 100755 --- a/build-webapp.sh +++ b/build-webapp.sh @@ -3,19 +3,14 @@ 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 index 182b527..ee708b8 100755 --- a/run-webapp.sh +++ b/run-webapp.sh @@ -16,7 +16,7 @@ EOF # For debugging # cat .env.local -# TODO: Need production build in .next. Check build-webapp.sh +# Needs production build in .next. Check build-webapp.sh pnpm start -p ${CERC_LISTEN_PORT:-80} -#pnpm dev -p ${CERC_LISTEN_PORT:-80} \ No newline at end of file +# pnpm dev -p ${CERC_LISTEN_PORT:-80}