stack-orchestrator/stack_orchestrator/data/stacks/osmosis
2023-12-12 13:54:00 +05:30
..
README.md Update instructions in osmosis stack (#684) 2023-12-12 13:54:00 +05:30
stack.yml Update instructions in osmosis stack (#684) 2023-12-12 13:54:00 +05:30

self-hosted osmosis

Instructions to build and deploy:

  • self-hosted gitea
  • an ipfs node
  • the osmosis front end
  • a laconicd chain

Setup

Clone required repositories:

laconic-so --stack osmosis setup-repositories

# 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:
    proxy-server:
      - '4000:4000'
    nginx:
      - '3000:80'

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)

# 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 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

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 be healthy

  • The web app can be accessed at http://localhost:3000

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