Add a stack for running uniswap frontend on urbit #670

Merged
nikugogoi merged 25 commits from ng-uniswap-frontend into main 2023-12-04 13:09:20 +00:00
3 changed files with 76 additions and 10 deletions
Showing only changes of commit 77c911c03b - Show all commits

View File

@ -8,7 +8,7 @@ fi
yarn build
# Create symlink to host built files with correct URL path
mkdir ./urbit/apps
ln -s ./build/ ./urbit/apps/uniswap
mkdir -p /app/urbit/apps
ln -s /app/build /app/urbit/apps/uniswap
yarn serve build -s -l 3000
node_modules/.bin/serve urbit -s -l 3000

View File

@ -1,15 +1,81 @@
# self-hosted uniswap frontend
Instructions to setup and deploy uniswap app on urbit
Build and deploy:
- Uniswap front end
- Urbit
- Uniswap app
<!-- TODO: Use laconic-so deployment command -->
```
## Setup
Clone required repositories:
```bash
laconic-so --stack uniswap-frontend setup-repositories
laconic-so --stack uniswap-frontend build-containers
laconic-so --stack uniswap-frontend deploy up
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
```
Build the container images:
```bash
laconic-so --stack uniswap-frontend build-containers
```
## Create a deployment
First, create a spec file for the deployment, which will map the stack's ports and volumes to the host:
```bash
laconic-so --stack uniswap-frontend deploy init --output uniswap-frontend-spec.yml
```
### Ports
Edit `network` in spec file to map container ports to same ports in host
<!-- TODO: Provide example -->
### Data volumes
Container data volumes are bind-mounted to specified paths in the host filesystem.
The default setup (generated by `laconic-so deploy init`) places the volumes in the `./data` subdirectory of the deployment directory. The default mappings can be customized by editing the "spec" file generated by `laconic-so deploy init`.
---
Once you've made any needed changes to the spec file, create a deployment from it:
```bash
laconic-so --stack uniswap-frontend deploy create --spec-file uniswap-frontend-spec.yml --deployment-dir uniswap-frontend-deployment
```
## Set env variables
Inside the deployment directory, open the file `config.env` and add variable for infura key :
```bash
# External RPC endpoints
# https://docs.infura.io/getting-started#2-create-an-api-key
CERC_INFURA_KEY=
```
## Start the stack
Start the deployment:
```bash
laconic-so deployment --dir uniswap-frontend-deployment start
```
* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
## Clean up
To stop all azimuth services running in the background, while preserving chain data:
```bash
laconic-so deployment --dir uniswap-frontend-deployment stop
```
To stop all azimuth services and also delete data:
```bash
laconic-so deployment --dir uniswap-frontend-deployment stop --delete-volumes
```

View File

@ -1,5 +1,5 @@
version: "0.1"
name: urbit-frontend
name: uniswap-frontend
repos:
# Uniswap interface
# TODO: Use release