From c2be02a06bd26968f66e9224a397f15a4ddfbd02 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 30 Nov 2023 16:10:06 +0530 Subject: [PATCH] Add steps to create glob for the app --- .../docker-compose-uniswap-interface.yml | 2 - .../data/compose/docker-compose-urbit.yml | 2 +- .../uniswap-interface/deploy-uniswap-app.sh | 103 ++++++++++++------ 3 files changed, 73 insertions(+), 34 deletions(-) diff --git a/stack_orchestrator/data/compose/docker-compose-uniswap-interface.yml b/stack_orchestrator/data/compose/docker-compose-uniswap-interface.yml index b41bb865..e04255d4 100644 --- a/stack_orchestrator/data/compose/docker-compose-uniswap-interface.yml +++ b/stack_orchestrator/data/compose/docker-compose-uniswap-interface.yml @@ -22,9 +22,7 @@ services: command: ["./deploy-to-urbit.sh"] volumes: - app_builds:/app-builds - - urbit_data:/urbit - ../config/uniswap-interface/deploy-to-urbit.sh:/app/deploy-to-urbit.sh volumes: app_builds: - urbit_data: diff --git a/stack_orchestrator/data/compose/docker-compose-urbit.yml b/stack_orchestrator/data/compose/docker-compose-urbit.yml index 6b12e31c..9a52d96d 100644 --- a/stack_orchestrator/data/compose/docker-compose-urbit.yml +++ b/stack_orchestrator/data/compose/docker-compose-urbit.yml @@ -4,7 +4,7 @@ services: urbit-fake-ship: restart: unless-stopped image: tloncorp/vere - entrypoint: ["bash", "-c", "./run-urbit-ship.sh && deploy-uniswap-app.sh"] + entrypoint: ["bash", "-c", "./run-urbit-ship.sh && ./deploy-uniswap-app.sh"] volumes: - urbit_data:/urbit - app_builds:/app-builds diff --git a/stack_orchestrator/data/config/uniswap-interface/deploy-uniswap-app.sh b/stack_orchestrator/data/config/uniswap-interface/deploy-uniswap-app.sh index acbc755c..53a61eb7 100755 --- a/stack_orchestrator/data/config/uniswap-interface/deploy-uniswap-app.sh +++ b/stack_orchestrator/data/config/uniswap-interface/deploy-uniswap-app.sh @@ -5,8 +5,15 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +uniswap_app_build='/app-builds/uniswap/build' uniswap_desk_dir='/urbit/zod/uniswap' +if [ -d ${uniswap_desk_dir} ]; then + echo "Uniswap desk dir already exists, exiting" + exit 0 +fi + +# Fire curl requests to perform operations on the ship dojo () { curl -s --data '{"source":{"dojo":"'"$1"'"},"sink":{"stdout":null}}' http://localhost:12321 } @@ -15,46 +22,80 @@ 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 +# Create/mount a uniswap desk +hood "merge %uniswap our %landscape" hood "mount %uniswap" -tail -f /dev/null +# Loop until the uniswap build appears +while [ ! -d ${uniswap_app_build} ]; do + echo "Uniswap app build not found, retrying in 5s..." + sleep 5 +done +echo "Build found..." - -# Wait for uniswap build to appear # Copy over build to desk data dir +cp -r ${uniswap_app_build} ${uniswap_desk_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 +# Create a mark file for .map file type +cat << EOF > "${uniswap_desk_dir}/mar/map.hoon" +:: +:::: /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 +# Create a mark file for .woff file type +cat << EOF > "${uniswap_desk_dir}/mar/woff.hoon" +|_ dat=octs +++ grow + |% + ++ mime [/font/woff dat] + -- +++ grab + |% + ++ mime |=([=mite =octs] octs) + ++ noun octs + -- +++ grad %mime +-- +EOF -# rm ~/zod/uniswap/desk.bill -# rm ~/zod/uniswap/desk.ship +# Create a mark file for .ttf file type +cat << EOF > "${uniswap_desk_dir}/mar/ttf.hoon" +|_ dat=octs +++ grow + |% + ++ mime [/font/ttf dat] + -- +++ grab + |% + ++ mime |=([=mite =octs] octs) + ++ noun octs + -- +++ grad %mime +-- +EOF -# |commit %uniswap +rm "${uniswap_desk_dir}/desk.bill" +rm "${uniswap_desk_dir}/desk.ship" -# -landscape!make-glob %uniswap /build +# Commit changes and create a glob +hood "commit %uniswap" +dojo "-landscape!make-glob %uniswap /build" # Curl and wait for the glob to be hosted