.. | ||
README.md | ||
stack.yml |
self-hosted osmosis
Instructions to build and deploy:
- Self-hosted gitea
- An ipfs node
- Urbit
- The osmosis front end
- Hosted on python server
- Deployed on urbit
- A laconicd chain
Setup
Clone required repositories:
laconic-so --stack osmosis 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:
# TODO: support image for the gitea package registry
# laconic-so --stack build-support build-containers
laconic-so --stack osmosis 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 osmosis deploy init --output osmosis-spec.yml
Ports
Edit network
in spec file to map container ports to same ports in host
...
network:
ports:
urbit-fake-ship:
- '8080:80'
proxy-server:
- '4000:4000'
nginx:
- '3000:80'
ipfs-glob-host:
- '8081:8080'
- '5001:5001'
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 osmosis deploy create --spec-file osmosis-spec.yml --deployment-dir osmosis-deployment
Set env variables
Inside the deployment directory, open the file config.env
and set the following env variables:
(Note: Following config can be used as is if the stack is being run locally)
# 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-glob-host:5001 pointing to in-stack IPFS node)
CERC_IPFS_GLOB_HOST_ENDPOINT=
# IFPS endpoint to fetch the glob file from
# (Default: http://ipfs-glob-host:8080 pointing to in-stack IPFS node)
CERC_IPFS_SERVER_ENDPOINT=
Start the stack
Start the deployment:
laconic-so deployment --dir osmosis-deployment start
-
The
osmosis-front-end
container will take some time to run to completion as it builds the front-end app with given configuration; same can be tracked in the logs:laconic-so deployment --dir osmosis-deployment logs -f osmosis-front-end
-
List and check the health status of all the containers using
docker ps
and wait for them to behealthy
-
The web app can be accessed at http://localhost:3000
-
Run the following to get login password for Urbit web interface:
laconic-so deployment --dir osmosis-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 installedlaconic-so deployment --dir osmosis-deployment logs -f # Expected output: # laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | docket: fetching %http glob for %uniswap desk # laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | ">="">="Osmosis app installed
-
The osmosis app will be now visible at http://localhost:8080
Laconic registry
Setup a test chain:
export CERC_NPM_REGISTRY_URL=https://git.vdb.to/api/packages/cerc-io/npm/
laconic-so --stack fixturenet-laconic-loaded setup-repositories --include git.vdb.to/cerc-io/laconicd,git.vdb.to/cerc-io/laconic-sdk,git.vdb.to/cerc-io/laconic-registry-cli,git.vdb.to/cerc-io/laconic-console
laconic-so --stack fixturenet-laconic-loaded build-containers
export LACONIC_HOSTED_ENDPOINT=http://<your-IP>
laconic-so --stack fixturenet-laconic-loaded deploy up
then docker exec
into the laconicd
container and either export the private key or create a new one and send funds to it. Use that private key for LACONIC_HOTWALLET_KEY
.
Clean up
To stop all osmosis services running in the background, while preserving data:
# Only stop the docker containers
laconic-so deployment --dir osmosis-deployment stop
# Run 'start' to restart the deployment
To stop all osmosis services and also delete data:
# Stop the docker containers
laconic-so deployment --dir osmosis-deployment stop --delete-volumes
# Remove deployment directory (deployment will have to be recreated for a re-run)
rm -r osmosis-deployment
To stop stack running Laconic registry
laconic-so --stack fixturenet-laconic-loaded deploy down
# Delete volumes
laconic-so --stack fixturenet-laconic-loaded deploy down --delete-volumes