Perform uniswap app deployment in the urbit container

This commit is contained in:
Prathamesh Musale 2023-11-30 15:39:07 +05:30
parent 3a65794f93
commit 39fc536562
6 changed files with 96 additions and 26 deletions

View File

@ -8,16 +8,8 @@ services:
- REACT_APP_INFURA_KEY=${CERC_INFURA_KEY}
command: ["./build-app.sh"]
volumes:
- uniswap_build:/app/build
- app_builds:/app-builds
- ../config/uniswap-interface/build-app.sh:/app/build-app.sh
ports:
- "3000"
healthcheck:
test: ["CMD", "nc", "-vz", "localhost", "3000"]
interval: 20s
timeout: 5s
retries: 15
start_period: 5s
uniswap-urbit-deployment:
image: cerc/uniswap-urbit-deployment:local
@ -29,10 +21,10 @@ services:
# - REACT_APP_INFURA_KEY=${CERC_INFURA_KEY}
command: ["./deploy-to-urbit.sh"]
volumes:
- uniswap_build:/app/build
- app_builds:/app-builds
- urbit_data:/urbit
- ../config/uniswap-interface/deploy-to-urbit.sh:/app/deploy-to-urbit.sh
volumes:
uniswap_build:
app_builds:
urbit_data:

View File

@ -4,10 +4,12 @@ services:
urbit-fake-ship:
restart: unless-stopped
image: tloncorp/vere
entrypoint: ["bash", "-c", "./run-urbit-ship.sh"]
entrypoint: ["bash", "-c", "./run-urbit-ship.sh && deploy-uniswap-app.sh"]
volumes:
- urbit_data:/urbit
- ../config/uniswap-interface/run-urbit-ship.sh:/urbit/run-urbit-ship.sh
- app_builds:/app-builds
- ../config/urbit/run-urbit-ship.sh:/urbit/run-urbit-ship.sh
- ../config/uniswap-interface/deploy-uniswap-app.sh:/urbit/deploy-uniswap-app.sh
ports:
- "8080:80"
- "12321:12321"
@ -20,3 +22,4 @@ services:
volumes:
urbit_data:
app_builds:

View File

@ -6,15 +6,13 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
fi
# Check and exit if a deployment already exists (on restarts)
if [ -f ./build ]; then
echo "build already exists, remove volume to rebuild"
if [ -d /app-builds/uniswap/build ]; then
echo "Build already exists, remove volume to rebuild"
exit 0
fi
yarn build
# Create symlink to host built files with correct URL path
# mkdir -p /app/urbit/apps
# ln -s /app/build /app/urbit/apps/uniswap
# node_modules/.bin/serve urbit -s -l 3000
# Move build to app-builds so urbit can deploy it
mkdir /app-builds/uniswap
cp -r ./build /app-builds/uniswap/

View File

@ -8,7 +8,4 @@ fi
tail -f /dev/null
# TODO:
# Take urbit endpoint from env
# Check if urbit endpoint is up
# Fire curl requests to create/mount a uniswap desk
# Copy over build to desk data dir
# Wait for glob to exist, copy it over and host it

View File

@ -0,0 +1,79 @@
#!/bin/bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
uniswap_desk_dir='/urbit/zod/uniswap'
dojo () {
curl -s --data '{"source":{"dojo":"'"$1"'"},"sink":{"stdout":null}}' http://localhost:12321
}
hood () {
curl -s --data '{"source":{"dojo":"+hood/'"$1"'"},"sink":{"app":"hood"}}' http://localhost:12321
}
# Fire curl requests to create/mount a uniswap desk
curl -s --data '{"source":{"dojo":"+hood/merge %uniswap our %landscape"},"sink":{"app":"hood"}}' http://localhost:12321
hood "mount %uniswap"
tail -f /dev/null
# Wait for uniswap build to appear
# Copy over build to desk data dir
# cat << EOF > file.txt
# ::
# :::: /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
# --
# EOF
# cp ~/zod/uniswap/mar/woff2.hoon ~/zod/uniswap/mar/woff.hoon and edit the only line that has woff2 to woff
# cp ~/zod/uniswap/mar/woff2.hoon ~/zod/uniswap/mar/ttf.hoon and edit woff2 to ttf
# rm ~/zod/uniswap/desk.bill
# rm ~/zod/uniswap/desk.ship
# |commit %uniswap
# -landscape!make-glob %uniswap /build
# Curl and wait for the glob to be hosted
# From landscape CI:
# $1: the folder of files to glob
# $2: the location of the docket file
# hash=$(ls -1 -c zod/.urb/put | head -1 | sed "s/glob-\([a-z0-9\.]*\).glob/\1/")
# sed -i "s/glob\-[a-z0-9\.]*glob' *[a-z0-9\.]*\]/glob-$hash.glob' $hash]/g" $2
# :~ title+'Uniswap'
# info+'Self-hosted uniswap frontend.'
# color+0xcd.75df
# image+'https://logowik.com/content/uploads/images/uniswap-uni7403.jpg'
# base+'uniswap'
# glob-http+['https://urbit-uniswap-laconic.nyc3.digitaloceanspaces.com/glob-0v3.5in3n.an2ft.c89g2.b6nu6.qek41.glob' 0v3.5in3n.an2ft.c89g2.b6nu6.qek41]
# version+[0 0 1]
# website+'https://uniswap.org/'
# license+'MIT'
# ==
# |commit %uniswap
# |install our %uniswap

View File

@ -7,11 +7,12 @@ fi
pier_dir="/urbit/zod"
# Run urbit ship in daemon mode
# Check if the directory exists
if [ -d "$pier_dir" ]; then
echo "Pier directory already exists, rebooting..."
urbit -t zod
urbit -d zod
else
echo "Creating a new fake ship..."
urbit -t -F zod
urbit -d -F zod
fi