Nabarun Gogoi
c319e90ddd
* Create uniswap-frontend stack * Add stack for building uniswap frontend app * Add a container for Urbit fake ship * Update with deployment command * Add a service for uniswap app deployment to urbit * Use a script to start urbit ship to handle restarts * Rename stack name to uniswap-urbit-app * Rename build.sh to build-app.sh and check if build already exists * Rename stack directory name * Update uniswap build restart on failure * Perform uniswap app deployment in the urbit container * Add steps to create glob for the app * Tail /dev/null after deployment * Add steps to install the app to desk * Host glob files for uniswap * Update repo branch * Update readme with command to get urbit password * Update readme * Update readme to open urbit web UI * Expose the port on glob hosting container * Avoid exposing urbit http port * Add scripts for installing uniswap on remote urbit instance * Configure GQL proxy for uniswap app * Use laconic branch for app repo * Rename urbit pod for uniswap app deployment --------- Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> |
||
---|---|---|
.. | ||
README.md | ||
stack.yml |
Self-hosted Uniswap Frontend
Instructions to setup and deploy Uniswap app on Urbit
Build and deploy:
- Urbit
- Uniswap app
Setup
Clone required repositories:
laconic-so --stack uniswap-urbit-app setup-repositories --pull
# 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:
laconic-so --stack uniswap-urbit-app 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:
laconic-so --stack uniswap-urbit-app deploy init --output uniswap-urbit-app-spec.yml
Ports
Edit network
in spec file to map container ports to same ports in host
...
network:
ports:
urbit-fake-ship:
- '8080:80'
uniswap-glob-host:
- '3000:3000'
uniswap-gql-proxy:
- '4000:4000'
...
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:
laconic-so --stack uniswap-urbit-app deploy create --spec-file uniswap-urbit-app-spec.yml --deployment-dir uniswap-urbit-app-deployment
Set env variables
Inside the deployment directory, open the file config.env
and add variable for infura key :
# External RPC endpoints
# https://docs.infura.io/getting-started#2-create-an-api-key
CERC_INFURA_KEY=
# Uniswap API GQL Endpoint
# Set this to GQL proxy server endpoint for uniswap app
# (Eg. http://localhost:4000/graphql)
CERC_UNISWAP_GQL=
Start the stack
Start the deployment:
laconic-so deployment --dir uniswap-urbit-app-deployment start
-
List and check the health status of all the containers using
docker ps
and wait for them to behealthy
-
Run the following to get login password for Urbit web interface:
laconic-so deployment --dir uniswap-urbit-app-deployment exec urbit-fake-ship "curl -s --data '{\"source\":{\"dojo\":\"+code\"},\"sink\":{\"stdout\":null}}' http://localhost:12321" # Expected output: "<PASSWORD>\n"%
-
Open the Urbit web UI at http://localhost:8080 and use the
PASSWORD
from previous step to login -
The uniswap app is not available when starting stack for the first time. Check
urbit-fake-ship
logs to see that app has installedlaconic-so deployment --dir uniswap-urbit-app-deployment logs -f # Expected output: # laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | docket: fetching %http glob for %uniswap desk # laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | ">="">="Uniswap app installed
-
The uniswap app will be now visible at http://localhost:8080
Clean up
To stop all uniswap-urbit-app services running in the background, while preserving chain data:
laconic-so deployment --dir uniswap-urbit-app-deployment stop
To stop all uniswap-urbit-app services and also delete data:
laconic-so deployment --dir uniswap-urbit-app-deployment stop --delete-volumes