Add a stack for running Osmosis frontend app on Urbit #683
@ -0,0 +1,18 @@
|
||||
version: "3.2"
|
||||
|
||||
services:
|
||||
osmosis-front-end:
|
||||
image: cerc/osmosis-front-end-urbit:local
|
||||
restart: on-failure
|
||||
environment:
|
||||
- NEXT_PUBLIC_WEB_API_BASE_URL=${CERC_WEB_API_BASE_URL}
|
||||
working_dir: /app/packages/web
|
||||
command: ["./build-app-for-urbit.sh"]
|
||||
volumes:
|
||||
- ../config/osmosis/build-app-for-urbit.sh:/app/packages/web/build-app-for-urbit.sh
|
||||
- urbit_app_builds:/app-builds
|
||||
- ../config/osmosis/urbit-files/mar:/app/packages/web/mar
|
||||
- ../config/osmosis/urbit-files/desk.docket-0:/app/packages/web/desk.docket-0
|
||||
|
||||
volumes:
|
||||
urbit_app_builds:
|
21
stack_orchestrator/data/config/osmosis/build-app-for-urbit.sh
Executable file
21
stack_orchestrator/data/config/osmosis/build-app-for-urbit.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Check and exit if a deployment already exists (on restarts)
|
||||
if [ -d /app-builds/osmosis/build ]; then
|
||||
echo "Build already exists, remove volume to rebuild"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
yarn build:static
|
||||
|
||||
# Move build to app-builds
|
||||
mkdir -p /app-builds/osmosis
|
||||
cp -r ./out /app-builds/osmosis/build
|
||||
|
||||
cp -r mar /app-builds/osmosis/
|
||||
cp desk.docket-0 /app-builds/osmosis/
|
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the osmosis front end image
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/osmosis-front-end-urbit:local -f ${CERC_REPO_BASE_DIR}/osmosis-frontend/docker/Dockerfile.static ${build_command_args} ${CERC_REPO_BASE_DIR}/osmosis-frontend
|
158
stack_orchestrator/data/stacks/osmosis-urbit-app/README.md
Normal file
158
stack_orchestrator/data/stacks/osmosis-urbit-app/README.md
Normal file
@ -0,0 +1,158 @@
|
||||
# Self-hosted Osmosis Front End On Urbit
|
||||
|
||||
Instructions to build and deploy:
|
||||
- Urbit
|
||||
- An ipfs node
|
||||
- The osmosis front end
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack osmosis-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 and re-run the command
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack osmosis-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:
|
||||
|
||||
```bash
|
||||
laconic-so --stack osmosis-urbit-app deploy init --output osmosis-urbit-app-spec.yml
|
||||
```
|
||||
|
||||
### Ports
|
||||
|
||||
Edit `network` in spec file to map container ports to same ports in host:
|
||||
|
||||
```yml
|
||||
...
|
||||
network:
|
||||
ports:
|
||||
urbit-fake-ship:
|
||||
- '8080:80'
|
||||
proxy-server:
|
||||
- '4000:4000'
|
||||
ipfs:
|
||||
- '8081:8080'
|
||||
- '5001:5001'
|
||||
```
|
||||
|
||||
Note: Skip the `ipfs` ports if need to use an externally running IPFS node
|
||||
|
||||
### 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 osmosis-urbit-app deploy create --spec-file osmosis-urbit-app-spec.yml --deployment-dir osmosis-urbit-app-deployment
|
||||
```
|
||||
|
||||
## Set env variables
|
||||
|
||||
Inside the deployment directory, open the file `config.env` and set the following env variables:
|
||||
|
||||
(Note: Use the following config as is if running the stack locally)
|
||||
|
||||
```bash
|
||||
# App to be installed (Do not change)
|
||||
CERC_URBIT_APP=osmosis
|
||||
|
||||
# Osmosis API base URL
|
||||
# Set this to proxy server endpoint for osmosis app
|
||||
# (Eg. http://localhost:4000 - in case stack is being run locally with proxy enabled)
|
||||
# (Eg. https://abc.xyz.com - in case https://abc.xyz.com is pointed to the proxy endpoint)
|
||||
CERC_WEB_API_BASE_URL=http://localhost:4000
|
||||
|
||||
# Optional
|
||||
|
||||
# Whether to enable app installation on Urbit
|
||||
# (just builds and uploads the glob file if disabled) (Default: true)
|
||||
CERC_ENABLE_APP_INSTALL=
|
||||
|
||||
# Whether to run the proxy server
|
||||
# (Disable only if proxy not required to be run) (Default: true)
|
||||
CERC_ENABLE_PROXY=
|
||||
|
||||
# Proxy server configuration
|
||||
# Used only if proxy is enabled
|
||||
|
||||
# Upstream API URL
|
||||
CERC_PROXY_UPSTREAM=https://app.osmosis.zone
|
||||
|
||||
# IPFS configuration
|
||||
|
||||
# IFPS endpoint to host the glob file on
|
||||
# (Default: http://ipfs:5001 pointing to in-stack IPFS node)
|
||||
CERC_IPFS_GLOB_HOST_ENDPOINT=
|
||||
|
||||
# IFPS endpoint to fetch the glob file from
|
||||
# (Default: http://ipfs:8080 pointing to in-stack IPFS node)
|
||||
CERC_IPFS_SERVER_ENDPOINT=
|
||||
```
|
||||
|
||||
## Start the stack
|
||||
|
||||
Start the deployment:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir osmosis-urbit-app-deployment start
|
||||
```
|
||||
|
||||
* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
|
||||
|
||||
* Run the following to get login password for Urbit web interface:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir osmosis-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 osmosis app is not available when starting stack for the first time. Check `urbit-fake-ship` logs to see that app has installed:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir osmosis-urbit-app-deployment logs -f
|
||||
|
||||
# Expected output:
|
||||
# laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | docket: fetching %http glob for %osmosis desk
|
||||
# laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | ">="">="osmosis app installed
|
||||
```
|
||||
|
||||
* The osmosis app will be now visible at http://localhost:8080
|
||||
|
||||
## Clean up
|
||||
|
||||
To stop all osmosis-urbit-app services running in the background, while preserving data:
|
||||
|
||||
```bash
|
||||
# Only stop the docker containers
|
||||
laconic-so deployment --dir osmosis-urbit-app-deployment stop
|
||||
|
||||
# Run 'start' to restart the deployment
|
||||
```
|
||||
|
||||
To stop all osmosis-urbit-app services and also delete data:
|
||||
|
||||
```bash
|
||||
# Stop the docker containers
|
||||
laconic-so deployment --dir osmosis-urbit-app-deployment stop --delete-volumes
|
||||
|
||||
# Remove deployment directory (deployment will have to be recreated for a re-run)
|
||||
rm -r osmosis-urbit-app-deployment
|
||||
```
|
13
stack_orchestrator/data/stacks/osmosis-urbit-app/stack.yml
Normal file
13
stack_orchestrator/data/stacks/osmosis-urbit-app/stack.yml
Normal file
@ -0,0 +1,13 @@
|
||||
version: "0.1"
|
||||
name: osmosis-urbit-app
|
||||
repos:
|
||||
- github.com/cerc-io/osmosis-frontend@pm-urbit-compat # TODO: Use release
|
||||
- github.com/cerc-io/watcher-ts@v0.2.78
|
||||
containers:
|
||||
- cerc/osmosis-front-end-urbit
|
||||
- cerc/watcher-ts
|
||||
pods:
|
||||
- osmosis-front-end-urbit
|
||||
- proxy-server
|
||||
- fixturenet-urbit
|
||||
- kubo
|
@ -14,7 +14,7 @@ Clone required repositories:
|
||||
```bash
|
||||
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
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
@ -35,7 +35,7 @@ laconic-so --stack uniswap-urbit-app deploy init --output uniswap-urbit-app-spec
|
||||
|
||||
Edit `network` in spec file to map container ports to same ports in host:
|
||||
|
||||
```
|
||||
```yml
|
||||
...
|
||||
network:
|
||||
ports:
|
||||
@ -134,13 +134,14 @@ laconic-so deployment --dir uniswap-urbit-app-deployment start
|
||||
|
||||
* 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 installed
|
||||
```
|
||||
* The uniswap app is not available when starting stack for the first time. Check `urbit-fake-ship` logs to see that app has installed:
|
||||
|
||||
```bash
|
||||
laconic-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
|
||||
# laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | ">="">="uniswap app installed
|
||||
```
|
||||
|
||||
* The uniswap app will be now visible at http://localhost:8080
|
||||
|
Loading…
Reference in New Issue
Block a user