Add a stack for running uniswap frontend on urbit #670
@ -8,16 +8,8 @@ services:
|
|||||||
- REACT_APP_INFURA_KEY=${CERC_INFURA_KEY}
|
- REACT_APP_INFURA_KEY=${CERC_INFURA_KEY}
|
||||||
command: ["./build-app.sh"]
|
command: ["./build-app.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
- uniswap_build:/app/build
|
- app_builds:/app-builds
|
||||||
- ../config/uniswap-interface/build-app.sh:/app/build-app.sh
|
- ../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:
|
uniswap-urbit-deployment:
|
||||||
image: cerc/uniswap-urbit-deployment:local
|
image: cerc/uniswap-urbit-deployment:local
|
||||||
@ -29,10 +21,10 @@ services:
|
|||||||
# - REACT_APP_INFURA_KEY=${CERC_INFURA_KEY}
|
# - REACT_APP_INFURA_KEY=${CERC_INFURA_KEY}
|
||||||
command: ["./deploy-to-urbit.sh"]
|
command: ["./deploy-to-urbit.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
- uniswap_build:/app/build
|
- app_builds:/app-builds
|
||||||
- urbit_data:/urbit
|
- urbit_data:/urbit
|
||||||
- ../config/uniswap-interface/deploy-to-urbit.sh:/app/deploy-to-urbit.sh
|
- ../config/uniswap-interface/deploy-to-urbit.sh:/app/deploy-to-urbit.sh
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
uniswap_build:
|
app_builds:
|
||||||
urbit_data:
|
urbit_data:
|
||||||
|
@ -4,10 +4,12 @@ services:
|
|||||||
urbit-fake-ship:
|
urbit-fake-ship:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: tloncorp/vere
|
image: tloncorp/vere
|
||||||
entrypoint: ["bash", "-c", "./run-urbit-ship.sh"]
|
entrypoint: ["bash", "-c", "./run-urbit-ship.sh && deploy-uniswap-app.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
- urbit_data:/urbit
|
- 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:
|
ports:
|
||||||
- "8080:80"
|
- "8080:80"
|
||||||
- "12321:12321"
|
- "12321:12321"
|
||||||
@ -20,3 +22,4 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
urbit_data:
|
urbit_data:
|
||||||
|
app_builds:
|
||||||
|
@ -6,15 +6,13 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Check and exit if a deployment already exists (on restarts)
|
# Check and exit if a deployment already exists (on restarts)
|
||||||
if [ -f ./build ]; then
|
if [ -d /app-builds/uniswap/build ]; then
|
||||||
echo "build already exists, remove volume to rebuild"
|
echo "Build already exists, remove volume to rebuild"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
yarn build
|
yarn build
|
||||||
|
|||||||
|
|
||||||
# Create symlink to host built files with correct URL path
|
# Move build to app-builds so urbit can deploy it
|
||||||
# mkdir -p /app/urbit/apps
|
mkdir /app-builds/uniswap
|
||||||
# ln -s /app/build /app/urbit/apps/uniswap
|
cp -r ./build /app-builds/uniswap/
|
||||||
|
|
||||||
# node_modules/.bin/serve urbit -s -l 3000
|
|
||||||
|
@ -8,7 +8,4 @@ fi
|
|||||||
tail -f /dev/null
|
tail -f /dev/null
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# Take urbit endpoint from env
|
# Wait for glob to exist, copy it over and host it
|
||||||
# Check if urbit endpoint is up
|
|
||||||
# Fire curl requests to create/mount a uniswap desk
|
|
||||||
# Copy over build to desk data dir
|
|
||||||
|
79
stack_orchestrator/data/config/uniswap-interface/deploy-uniswap-app.sh
Executable file
79
stack_orchestrator/data/config/uniswap-interface/deploy-uniswap-app.sh
Executable 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
|
@ -7,11 +7,12 @@ fi
|
|||||||
|
|
||||||
pier_dir="/urbit/zod"
|
pier_dir="/urbit/zod"
|
||||||
|
|
||||||
|
# Run urbit ship in daemon mode
|
||||||
# Check if the directory exists
|
# Check if the directory exists
|
||||||
if [ -d "$pier_dir" ]; then
|
if [ -d "$pier_dir" ]; then
|
||||||
echo "Pier directory already exists, rebooting..."
|
echo "Pier directory already exists, rebooting..."
|
||||||
urbit -t zod
|
urbit -d zod
|
||||||
else
|
else
|
||||||
echo "Creating a new fake ship..."
|
echo "Creating a new fake ship..."
|
||||||
urbit -t -F zod
|
urbit -d -F zod
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue
Block a user
ideally this would happen during a build step rather than at deploy time