Merge pull request 'Add steps in readme to setup and run app locally' (#5) from deep-stack/laconic-deployer-frontend:ng-local-setup into nas/fix-filter-and-components
Reviewed-on: NasSharaf/laconic-deployer-frontend#5
This commit is contained in:
commit
685f8a8793
@ -3,4 +3,4 @@ CLERK_SECRET_KEY=
|
||||
NEXT_PUBLIC_WALLET_IFRAME_URL= # wherever your wallet is running
|
||||
NEXT_PUBLIC_LACONICD_CHAIN_ID= # the appropriate chain ID for your network
|
||||
NEXT_PUBLIC_API_URL=
|
||||
NEXT_PUBLIC_GITHUB_FALLBACK_TOKEN=
|
||||
NEXT_PUBLIC_GITHUB_BACKEND_CLIENT_ID= # Client ID of your GitHub OAuth App
|
||||
246
readme.md
246
readme.md
@ -6,13 +6,13 @@ Ensure you have the following installed:
|
||||
- [Node.js](https://nodejs.org/) (v18+)
|
||||
- [pnpm](https://pnpm.io/) (v8+)
|
||||
- [Git](https://git-scm.com/)
|
||||
- [ngrok](https://ngrok.com/docs/getting-started/#2-install-the-ngrok-agent-cli)
|
||||
|
||||
## Project Structure
|
||||
|
||||
This monorepo contains several packages:
|
||||
|
||||
- `apps/deploy-fe`: Frontend Next.js application
|
||||
- `apps/backend`: Express.js backend API
|
||||
- `apps/deployer`: Deployment service
|
||||
- `services/gql-client`: GraphQL client library
|
||||
- `services/ui`: Shared UI components
|
||||
@ -20,48 +20,232 @@ This monorepo contains several packages:
|
||||
|
||||
## Getting Started
|
||||
|
||||
### 1. Clone the repository
|
||||
The following steps are for running the deploy app locally (using [laconicd mainnet chain](https://laconicd-mainnet-1.laconic.com/status)):
|
||||
|
||||
```bash
|
||||
git clone https://github.com/yourusername/qwrk-laconic-core-develop.git
|
||||
cd qwrk-laconic-core-develop
|
||||
```
|
||||
- Clone laconic-wallet-web repo
|
||||
```bash
|
||||
git clone https://git.vdb.to/LaconicNetwork/laconic-wallet-web.git
|
||||
cd laconic-wallet-web
|
||||
```
|
||||
|
||||
### 2. Install dependencies
|
||||
- Create .env
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
- Update values in `.env`
|
||||
```
|
||||
# Not required since WalletConnect is not used in iframe integration
|
||||
REACT_APP_WALLET_CONNECT_PROJECT_ID=
|
||||
|
||||
### 3. Configure environment variables
|
||||
REACT_APP_DEFAULT_GAS_PRICE=0.025
|
||||
|
||||
# Reference: https://github.com/cosmos/cosmos-sdk/issues/16020
|
||||
REACT_APP_GAS_ADJUSTMENT=2
|
||||
REACT_APP_LACONICD_RPC_URL=https://laconicd-mainnet-1.laconic.com
|
||||
|
||||
Create a `.env.local` file in the `apps/deploy-fe` directory:
|
||||
# URL of Deploy app frontend app that will run locally
|
||||
REACT_APP_ALLOWED_URLS=http://localhost:3000
|
||||
```
|
||||
|
||||
```
|
||||
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_key
|
||||
CLERK_SECRET_KEY=your_clerk_secret
|
||||
NEXT_PUBLIC_WALLET_IFRAME_URL=http://localhost:4000
|
||||
NEXT_PUBLIC_LACONICD_CHAIN_ID=laconic-mainnet
|
||||
NEXT_PUBLIC_API_URL=http://localhost:8000
|
||||
NEXT_PUBLIC_GITHUB_FALLBACK_TOKEN=your_github_token
|
||||
```
|
||||
- Install dependencies
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
Create a `local.toml` file in `apps/backend/environments/` (based on the example file).
|
||||
- Build app
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
|
||||
### 4. Start the development servers
|
||||
- Set env values in build
|
||||
```bash
|
||||
yarn set-env
|
||||
```
|
||||
|
||||
#### Frontend:
|
||||
```bash
|
||||
cd apps/deploy-fe
|
||||
pnpm dev
|
||||
```
|
||||
- Serve the build
|
||||
```
|
||||
# Install package serve globally
|
||||
npm install -g serve
|
||||
|
||||
### 5. Connect Your Wallet
|
||||
# Serve the wallet build
|
||||
serve -s -l 4000 ./build
|
||||
```
|
||||
|
||||
The application requires a Laconic wallet for certain operations. You need to set up:
|
||||
Wallet will run at http://localhost:4000
|
||||
|
||||
- In a new terminal, clone repo for backend
|
||||
```bash
|
||||
git clone https://git.vdb.to/cerc-io/snowballtools-base.git
|
||||
cd snowballtools-base
|
||||
```
|
||||
|
||||
- Install deps and build
|
||||
```bash
|
||||
yarn && yarn build --ignore frontend
|
||||
```
|
||||
|
||||
- Create `packages/backend/environments/local.toml`
|
||||
```bash
|
||||
cp packages/backend/environments/local.toml.example packages/backend/environments/local.toml
|
||||
```
|
||||
|
||||
- Update values in `packages/backend/environments/local.toml`
|
||||
```toml
|
||||
[server]
|
||||
host = "127.0.0.1"
|
||||
port = 8000
|
||||
gqlPath = "/graphql"
|
||||
[server.session]
|
||||
# Can be set to any random string
|
||||
secret = "RpwqcvFkLZ"
|
||||
# Frontend webapp URL origin
|
||||
appOriginUrl = "http://localhost:3000"
|
||||
# Set to true if server running behind proxy
|
||||
trustProxy = false
|
||||
# Backend URL hostname
|
||||
domain = "localhost"
|
||||
|
||||
[database]
|
||||
dbPath = "db/snowball"
|
||||
|
||||
[gitHub]
|
||||
webhookUrl = ""
|
||||
[gitHub.oAuth]
|
||||
clientId = "Ov23lihCWQvOORNxtebD"
|
||||
clientSecret = "139de35bdd610628289adcd99bb2c7c962a11c99"
|
||||
|
||||
[registryConfig]
|
||||
fetchDeploymentRecordDelay = 5000
|
||||
checkAuctionStatusDelay = 5000
|
||||
restEndpoint = "https://laconicd-mainnet-1.laconic.com"
|
||||
gqlEndpoint = "https://laconicd-mainnet-1.laconic.com/api"
|
||||
chainId = "laconic-mainnet"
|
||||
# Set private key of account laconic13maulvmjxnyx3g855vk0lsv5aptf3rpxskynef
|
||||
# This account owns the bond and authority configured below
|
||||
privateKey = ""
|
||||
bondId = "230cfedda15e78edc8986dfcb870e1b618f65c56e38d2735476d2a8cb3f25e38"
|
||||
authority = "laconic"
|
||||
[registryConfig.fee]
|
||||
gasPrice = "0.001alnt"
|
||||
|
||||
[auction]
|
||||
commitFee = "1000"
|
||||
commitsDuration = "60s"
|
||||
revealFee = "1000"
|
||||
revealsDuration = "60s"
|
||||
denom = "alnt"
|
||||
```
|
||||
|
||||
- Run ngrok
|
||||
```bash
|
||||
ngrok http 8000
|
||||
```
|
||||
|
||||
- Set ngrok URL to `gitHub.webhookUrl` in config `packages/backend/environments/local.toml`
|
||||
- Example
|
||||
```toml
|
||||
...
|
||||
[gitHub]
|
||||
webhookUrl = "https://<ngrok-url>.ngrok-free.app"
|
||||
...
|
||||
```
|
||||
|
||||
- Run backend server
|
||||
```bash
|
||||
cd packages/backend
|
||||
yarn start
|
||||
```
|
||||
|
||||
- In a new terminal, clone repo for frontend (laconic-deployer-frontend)
|
||||
```bash
|
||||
git clone https://git.vdb.to/NasSharaf/laconic-deployer-frontend.git
|
||||
cd laconic-deployer-frontend
|
||||
```
|
||||
|
||||
- Install dependencies
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
- Build dependecies for frontend app
|
||||
```bash
|
||||
pnpm build:fe-compile
|
||||
```
|
||||
|
||||
- Create a `.env.local` file in the `apps/deploy-fe` directory to configure environment variables:
|
||||
```
|
||||
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_key
|
||||
CLERK_SECRET_KEY=your_clerk_secret
|
||||
NEXT_PUBLIC_WALLET_IFRAME_URL=http://localhost:4000
|
||||
NEXT_PUBLIC_LACONICD_CHAIN_ID=laconic-mainnet
|
||||
NEXT_PUBLIC_API_URL=http://localhost:8000
|
||||
NEXT_PUBLIC_GITHUB_BACKEND_CLIENT_ID=Ov23lihCWQvOORNxtebD
|
||||
```
|
||||
Replace `your_clerk_key` and `your_clerk_secret` with actual values (<https://clerk.com/docs/quickstarts/nextjs-pages-router#set-your-clerk-api-keys>)
|
||||
|
||||
- Start the development server
|
||||
```bash
|
||||
cd apps/deploy-fe
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
- The deploy frontend app will be now available at <http://localhost:3000>
|
||||
|
||||
### Fund wallet account
|
||||
|
||||
- Change directory to deployer package
|
||||
```bash
|
||||
cd apps/deployer/
|
||||
```
|
||||
|
||||
- Setup config for laconic-registry-cli in `packages/deployer/config.yml`
|
||||
```yaml
|
||||
services:
|
||||
registry:
|
||||
rpcEndpoint: https://laconicd-mainnet-1.laconic.com
|
||||
gqlEndpoint: https://laconicd-mainnet-1.laconic.com/api
|
||||
# Set to private key of an account with funds
|
||||
# Private key of account laconic13maulvmjxnyx3g855vk0lsv5aptf3rpxskynef set in deployer backend can be used
|
||||
userKey:
|
||||
chainId: laconic-testnet-2
|
||||
gasPrice: 0.001alnt
|
||||
```
|
||||
|
||||
- Get wallet account address at <http://localhost:4000> for `laconicd mainnet` network
|
||||
|
||||
- Run command to send tokens
|
||||
```bash
|
||||
pnpm laconic registry tokens send --address <ACCOUNT_ADDRESS_FROM_WALLET> --type alnt --quantity 12960
|
||||
```
|
||||
|
||||
- To check balance visit <https://explorer.laconic.com/laconic-mainnet/account/ACCOUNT_ADDRESS_FROM_WALLET>
|
||||
|
||||
### Misc
|
||||
|
||||
- To check for deployments in vaasl : <https://webapp-deployer-ui.apps.vaasl.io/>
|
||||
|
||||
- If deployment fails due to low bond balance
|
||||
- Change directory to deployer package
|
||||
```bash
|
||||
cd apps/deployer/
|
||||
```
|
||||
|
||||
- Check balances
|
||||
```bash
|
||||
# Account balance
|
||||
yarn laconic registry account get --address laconic13maulvmjxnyx3g855vk0lsv5aptf3rpxskynef
|
||||
|
||||
# Bond balance
|
||||
yarn laconic registry bond get --id 230cfedda15e78edc8986dfcb870e1b618f65c56e38d2735476d2a8cb3f25e38
|
||||
```
|
||||
|
||||
- Command to refill bond
|
||||
|
||||
```bash
|
||||
yarn laconic registry bond refill --id 230cfedda15e78edc8986dfcb870e1b618f65c56e38d2735476d2a8cb3f25e38 --type alnt --quantity 10000000
|
||||
```
|
||||
|
||||
1. A running wallet instance (follow the setup in the laconic-wallet-web repository)
|
||||
2. Configure the `NEXT_PUBLIC_WALLET_IFRAME_URL` to point to your wallet instance
|
||||
|
||||
## Architecture
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user