Add build and run scripts to be used by webapp-deployer

This commit is contained in:
Nabarun 2025-07-03 16:47:13 +05:30
parent 9aa34090ba
commit c0e3e31a81
5 changed files with 55 additions and 22 deletions

View File

@ -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

View File

@ -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

View File

@ -3,19 +3,14 @@
PKG_DIR="./apps/deploy-fe"
cat > $PKG_DIR/.env <<EOF
NEXT_PUBLIC_WALLET_IFRAME_URL=https://wallet.laconic.com
NEXT_PUBLIC_LACONICD_CHAIN_ID=laconic-mainnet
NEXT_PUBLIC_API_URL=https://deploy-backend.apps.vaasl.io
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_d2VsbC1tYW5hdGVlLTQxLmNsZXJrLmFjY291bnRzLmRldiQ
CLERK_SECRET_KEY=sk_test_KjVFQ8zzVN7GMtxIgVWTne2YN0FD63gvB5hsfpLiRZ
NEXT_PUBLIC_GITHUB_FALLBACK_TOKEN=your_github_token
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=CERC_RUNTIME_ENV_NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
CLERK_SECRET_KEY=CERC_RUNTIME_ENV_CLERK_SECRET_KEY
NEXT_PUBLIC_WALLET_IFRAME_URL=CERC_RUNTIME_ENV_NEXT_PUBLIC_WALLET_IFRAME_URL
NEXT_PUBLIC_LACONICD_CHAIN_ID=CERC_RUNTIME_ENV_NEXT_PUBLIC_LACONICD_CHAIN_ID
NEXT_PUBLIC_API_URL=CERC_RUNTIME_ENV_NEXT_PUBLIC_API_URL
NEXT_PUBLIC_GITHUB_FALLBACK_TOKEN=CERC_RUNTIME_ENV_NEXT_PUBLIC_GITHUB_FALLBACK_TOKEN
EOF
cat $PKG_DIR/.env
pnpm install || exit 1
# TODO: Fix build script to run
pnpm build --filter deploy-fe || exit 1
#pnpm build --filter @workspace/gql-client || exit 1

View File

@ -92,4 +92,30 @@ The frontend is built with:
Make sure you have:
1. Connected your GitHub account in Clerk
2. Provided the necessary permissions for repository access
3. Set a fallback GitHub token in `.env.local` if needed for development
3. Set a fallback GitHub token in `.env.local` if needed for development
## Test deployment
- Follow the dev install steps for stack-orchestrator from <https://git.vdb.to/cerc-io/stack-orchestrator/src/branch/main/docs/CONTRIBUTING.md#install>
<!-- TODO: Remove after SO PR https://git.vdb.to/cerc-io/stack-orchestrator/pulls/969 is merged -->
- Change branch
```bash
git checkout ng-support-custom-nextjs
```
- Build the container for app
```bash
laconic-so build-webapp --source-repo <path-to-app-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 <path-to-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)

View File

@ -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}
# pnpm dev -p ${CERC_LISTEN_PORT:-80}