diff --git a/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml index f4a25b54..0b779cf2 100644 --- a/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml +++ b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml @@ -10,7 +10,10 @@ services: command: ["./build-app.sh"] volumes: - ../config/osmosis/build-app.sh:/app/packages/web/build-app.sh - - app_builds:/app-builds + - urbit_app_builds:/app-builds + # TODO: Refactor common mar files + - ../config/osmosis/urbit-files/mar:/app/packages/web/mar + - ../config/osmosis/urbit-files/desk.docket-0:/app/packages/web/desk.docket-0 nginx: image: nginx:1.23-alpine @@ -20,7 +23,7 @@ services: condition: service_completed_successfully volumes: - ../config/osmosis/nginx:/etc/nginx/conf.d - - app_builds:/usr/share/nginx + - urbit_app_builds:/app-builds ports: - "80" healthcheck: @@ -31,4 +34,4 @@ services: start_period: 5s volumes: - app_builds: + urbit_app_builds: diff --git a/stack_orchestrator/data/config/osmosis/build-app.sh b/stack_orchestrator/data/config/osmosis/build-app.sh index 2f3cfd01..f18e99c9 100755 --- a/stack_orchestrator/data/config/osmosis/build-app.sh +++ b/stack_orchestrator/data/config/osmosis/build-app.sh @@ -16,3 +16,6 @@ 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/ diff --git a/stack_orchestrator/data/config/osmosis/urbit-files/desk.docket-0 b/stack_orchestrator/data/config/osmosis/urbit-files/desk.docket-0 new file mode 100644 index 00000000..969d6349 --- /dev/null +++ b/stack_orchestrator/data/config/osmosis/urbit-files/desk.docket-0 @@ -0,0 +1,10 @@ +:~ title+'Osmosis' + info+'Self-hosted osmosis frontend.' + color+0xcd.75df + image+'https://logowik.com/content/uploads/images/osmosis8548.logowik.com.webp' + base+'osmosis' + glob-http+['REPLACE_WITH_GLOB_URL' REPLACE_WITH_GLOB_HASH] + version+[0 0 1] + website+'https://osmosis.zone/' + license+'MIT' +== diff --git a/stack_orchestrator/data/config/osmosis/urbit-files/mar/map.hoon b/stack_orchestrator/data/config/osmosis/urbit-files/mar/map.hoon new file mode 100644 index 00000000..e5d61eee --- /dev/null +++ b/stack_orchestrator/data/config/osmosis/urbit-files/mar/map.hoon @@ -0,0 +1,18 @@ +:: +:::: /hoon/map/mar + :: Mark for js source maps +/? 310 +:: +=, eyre +|_ mud=@ +++ grow + |% + ++ mime [/application/octet-stream (as-octs:mimes:html (@t mud))] + -- +++ grab + |% :: convert from + ++ mime |=([p=mite q=octs] (@t q.q)) + ++ noun cord :: clam from %noun + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/osmosis/urbit-files/mar/ttf.hoon b/stack_orchestrator/data/config/osmosis/urbit-files/mar/ttf.hoon new file mode 100644 index 00000000..2d29193e --- /dev/null +++ b/stack_orchestrator/data/config/osmosis/urbit-files/mar/ttf.hoon @@ -0,0 +1,12 @@ +|_ dat=octs +++ grow + |% + ++ mime [/font/ttf dat] + -- +++ grab + |% + ++ mime |=([=mite =octs] octs) + ++ noun octs + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/osmosis/urbit-files/mar/woff.hoon b/stack_orchestrator/data/config/osmosis/urbit-files/mar/woff.hoon new file mode 100644 index 00000000..2933aea7 --- /dev/null +++ b/stack_orchestrator/data/config/osmosis/urbit-files/mar/woff.hoon @@ -0,0 +1,12 @@ +|_ dat=octs +++ grow + |% + ++ mime [/font/woff dat] + -- +++ grab + |% + ++ mime |=([=mite =octs] octs) + ++ noun octs + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index ef5504ae..be9cf1f6 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -1,17 +1,20 @@ # self-hosted osmosis Instructions to build and deploy: -- self-hosted gitea -- an ipfs node -- the osmosis front end -- a laconicd chain +- 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: ```bash -laconic-so --stack osmosis setup-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 ``` @@ -40,10 +43,15 @@ 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 @@ -65,6 +73,9 @@ Inside the deployment directory, open the file `config.env` and set the followin (Note: Following config can be used as is if the stack is being run 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) @@ -73,6 +84,10 @@ Inside the deployment directory, open the file `config.env` and set the followin # 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= @@ -82,6 +97,16 @@ Inside the deployment directory, open the file `config.env` and set the followin # 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 @@ -102,6 +127,27 @@ laconic-so deployment --dir osmosis-deployment start * The web app can be accessed at http://localhost:3000 +* Run the following to get login password for Urbit web interface: + + ```bash + laconic-so deployment --dir osmosis-deployment exec urbit-fake-ship "curl -s --data '{\"source\":{\"dojo\":\"+code\"},\"sink\":{\"stdout\":null}}' http://localhost:12321" + + # Expected output: "\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 + ``` + laconic-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: diff --git a/stack_orchestrator/data/stacks/osmosis/stack.yml b/stack_orchestrator/data/stacks/osmosis/stack.yml index b0e51a1d..75dd1b61 100644 --- a/stack_orchestrator/data/stacks/osmosis/stack.yml +++ b/stack_orchestrator/data/stacks/osmosis/stack.yml @@ -12,10 +12,13 @@ containers: # - cerc/act-runner-task-executor - cerc/watcher-ts - cerc/osmosis-front-end + - cerc/urbit-globs-host pods: - - kubo - proxy-server - osmosis-front-end + - fixturenet-urbit + # TODO: Use kubo instead of ipfs in fixturenet-urbit pod + # - kubo # TODO: Fix pod config for deployment command # TODO: mirroring all of osmosis repos: https://git.vdb.to/cerc-io/hosting/pulls/42 # - name: gitea