From 7f0452cd73d0dc69854093a020d30e70b673db60 Mon Sep 17 00:00:00 2001 From: Alessio Date: Fri, 29 Mar 2024 21:50:32 -0700 Subject: [PATCH] Add vega stack --- .../docker-compose-fixturenet-urbit.yml | 4 +- .../compose/docker-compose-vega-interface.yml | 19 ++ .../data/config/urbit/deploy-app.sh | 24 +- .../data/config/vega-interface/build-app.sh | 32 ++ .../vega-interface/urbit-files/desk.docket-0 | 10 + .../urbit-files/lib/docket.hoon | 223 ++++++++++++++ .../vega-interface/urbit-files/mar/bill.hoon | 34 +++ .../vega-interface/urbit-files/mar/css.hoon | 25 ++ .../urbit-files/mar/docket-0.hoon | 25 ++ .../vega-interface/urbit-files/mar/hoon.hoon | 36 +++ .../vega-interface/urbit-files/mar/html.hoon | 22 ++ .../vega-interface/urbit-files/mar/ico.hoon | 12 + .../vega-interface/urbit-files/mar/jpg.hoon | 12 + .../vega-interface/urbit-files/mar/js.hoon | 25 ++ .../vega-interface/urbit-files/mar/json.hoon | 26 ++ .../urbit-files/mar/json/rpc/response.hoon | 42 +++ .../urbit-files/mar/kelvin.hoon | 28 ++ .../vega-interface/urbit-files/mar/mime.hoon | 32 ++ .../vega-interface/urbit-files/mar/noun.hoon | 22 ++ .../vega-interface/urbit-files/mar/png.hoon | 12 + .../vega-interface/urbit-files/mar/ship.hoon | 20 ++ .../urbit-files/mar/txt-diff.hoon | 16 + .../vega-interface/urbit-files/mar/txt.hoon | 274 ++++++++++++++++++ .../vega-interface/urbit-files/mar/woff.hoon | 12 + .../vega-interface/urbit-files/mar/woff2.hoon | 12 + .../vega-interface/urbit-files/mar/xhtml.hoon | 5 + .../urbit-files/sur/docket.hoon | 82 ++++++ .../vega-interface/urbit-files/sys.kelvin | 1 + .../cerc-vega-interface/Dockerfile | 12 + .../cerc-vega-interface/build.sh | 12 + .../data/container-image-list.txt | 1 + stack_orchestrator/data/pod-list.txt | 1 + stack_orchestrator/data/repository-list.txt | 1 + .../data/stacks/vega-urbit-app/README.md | 131 +++++++++ .../data/stacks/vega-urbit-app/stack.yml | 10 + 35 files changed, 1239 insertions(+), 16 deletions(-) create mode 100644 stack_orchestrator/data/compose/docker-compose-vega-interface.yml create mode 100755 stack_orchestrator/data/config/vega-interface/build-app.sh create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/desk.docket-0 create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/lib/docket.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/bill.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/css.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/docket-0.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/hoon.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/html.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/ico.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/jpg.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/js.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/json.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/json/rpc/response.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/kelvin.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/mime.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/noun.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/png.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/ship.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/txt-diff.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/txt.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/woff.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/woff2.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/mar/xhtml.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/sur/docket.hoon create mode 100644 stack_orchestrator/data/config/vega-interface/urbit-files/sys.kelvin create mode 100644 stack_orchestrator/data/container-build/cerc-vega-interface/Dockerfile create mode 100755 stack_orchestrator/data/container-build/cerc-vega-interface/build.sh create mode 100644 stack_orchestrator/data/stacks/vega-urbit-app/README.md create mode 100755 stack_orchestrator/data/stacks/vega-urbit-app/stack.yml diff --git a/stack_orchestrator/data/compose/docker-compose-fixturenet-urbit.yml b/stack_orchestrator/data/compose/docker-compose-fixturenet-urbit.yml index bc64cd90..5aa4c12a 100644 --- a/stack_orchestrator/data/compose/docker-compose-fixturenet-urbit.yml +++ b/stack_orchestrator/data/compose/docker-compose-fixturenet-urbit.yml @@ -26,9 +26,9 @@ services: - "80" healthcheck: test: ["CMD", "nc", "-v", "localhost", "80"] - interval: 20s + interval: 10s timeout: 5s - retries: 15 + retries: 30 start_period: 10s volumes: diff --git a/stack_orchestrator/data/compose/docker-compose-vega-interface.yml b/stack_orchestrator/data/compose/docker-compose-vega-interface.yml new file mode 100644 index 00000000..5a33ada0 --- /dev/null +++ b/stack_orchestrator/data/compose/docker-compose-vega-interface.yml @@ -0,0 +1,19 @@ +version: "3.2" + +# This is a short-lived container. It runs the Vega build and then copies the output to the +# `urbit_app_builds` volume. +services: + vega-interface: + image: cerc/vega-interface:local + restart: on-failure + # environment: + # - REACT_APP_INFURA_KEY=${CERC_INFURA_KEY} + # - REACT_APP_AWS_API_ENDPOINT=${CERC_UNISWAP_GQL} + entrypoint: ["./build-app.sh"] + volumes: + - ../config/vega-interface/urbit-files:/app/urbit-files + - ../config/vega-interface/build-app.sh:/app/build-app.sh + - urbit_app_builds:/app-builds + +volumes: + urbit_app_builds: diff --git a/stack_orchestrator/data/config/urbit/deploy-app.sh b/stack_orchestrator/data/config/urbit/deploy-app.sh index bde6cd6f..512843cf 100755 --- a/stack_orchestrator/data/config/urbit/deploy-app.sh +++ b/stack_orchestrator/data/config/urbit/deploy-app.sh @@ -17,16 +17,10 @@ if [ -d ${app_desk_dir} ]; then exit 0 fi -app_build=/app-builds/${CERC_URBIT_APP}/build -app_mark_files=/app-builds/${CERC_URBIT_APP}/mar -app_docket_file=/app-builds/${CERC_URBIT_APP}/desk.docket-0 - -echo "Reading app build from ${app_build}" -echo "Reading additional mark files from ${app_mark_files}" -echo "Reading docket file ${app_docket_file}" +app_files=/app-builds/${CERC_URBIT_APP} # Loop until the app's build appears -while [ ! -d ${app_build} ]; do +while [ ! -d "${app_files}/build" ]; do echo "${CERC_URBIT_APP} app build not found, retrying in 5s..." sleep 5 done @@ -50,12 +44,14 @@ hood () { hood "merge %${CERC_URBIT_APP} our %landscape" hood "mount %${CERC_URBIT_APP}" + +echo "Copying files from ${app_files}" + # Copy over build to desk data dir -cp -r ${app_build} ${app_desk_dir} - -# Copy over the additional mark files -cp ${app_mark_files}/* ${app_desk_dir}/mar/ +cp -r ${app_files}/* ${app_desk_dir} +rm ${app_desk_dir}/desk.docket-0 # Remove until we have a valid glob path; it's added back again below +# TODO: why? => rm "${app_desk_dir}/desk.bill" rm "${app_desk_dir}/desk.ship" @@ -99,8 +95,8 @@ while true; do done # Replace the docket file for app -# Substitue the glob URL and hash -cp ${app_docket_file} ${app_desk_dir}/ +# Substitute the glob URL and hash +cp ${app_files}/desk.docket-0 ${app_desk_dir}/ sed -i "s|REPLACE_WITH_GLOB_URL|${glob_url}|g; s|REPLACE_WITH_GLOB_HASH|${glob_hash}|g" ${app_desk_dir}/desk.docket-0 # Commit changes and install the app diff --git a/stack_orchestrator/data/config/vega-interface/build-app.sh b/stack_orchestrator/data/config/vega-interface/build-app.sh new file mode 100755 index 00000000..b1a7a6fa --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/build-app.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +# Check and exit if a deployment already exists (on restarts) +if [ -d /app-builds/vega/build ]; then + echo "Build already exists, remove volume to rebuild" + exit 0 +fi + +./docker/prepare-dist.sh + +# Post-process the output: rename files, e.g., `AlphaLyrae.woff2` => `alphalyrae.woff2` +while read filepath; do + filename=$(basename "$filepath") + dir=$(dirname "$filepath") + if echo "$filename" | grep -q "[A-Z]"; then + newfilename=$(tr '[:upper:]' '[:lower:]' <<< "$filename") + echo "Translating '$filepath' => $dir/$newfilename'" + mv "$filepath" "$dir/$newfilename" + find dist-result -type f | xargs sed -i "s/$filename/$newfilename/g" + fi +done < <(find dist-result/ -type f) + + +# Copy over dist-result and other files to `app-builds` volume for urbit deployment +mkdir -p /app-builds/vega +cp -r ./dist-result /app-builds/vega/build +cp -r urbit-files/* /app-builds/vega/ diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/desk.docket-0 b/stack_orchestrator/data/config/vega-interface/urbit-files/desk.docket-0 new file mode 100644 index 00000000..fdb12eea --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/desk.docket-0 @@ -0,0 +1,10 @@ +:~ title+'Vegas' + info+'vegas' + color+0xcd.75df + image+'https://vegaprotocol.eth.limo/favicon.ico' + base+'vegas' + glob-http+['REPLACE_WITH_GLOB_URL' REPLACE_WITH_GLOB_HASH] + version+[0 0 1] + website+'https://vega.xyz/' + license+'MIT' +== diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/lib/docket.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/lib/docket.hoon new file mode 100644 index 00000000..ef39b7fb --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/lib/docket.hoon @@ -0,0 +1,223 @@ +/- *docket +|% +:: +++ mime + |% + +$ draft + $: title=(unit @t) + info=(unit @t) + color=(unit @ux) + glob-http=(unit [=url hash=@uvH]) + glob-ames=(unit [=ship hash=@uvH]) + base=(unit term) + site=(unit path) + image=(unit url) + version=(unit version) + website=(unit url) + license=(unit cord) + == + :: + ++ finalize + |= =draft + ^- (unit docket) + ?~ title.draft ~ + ?~ info.draft ~ + ?~ color.draft ~ + ?~ version.draft ~ + ?~ website.draft ~ + ?~ license.draft ~ + =/ href=(unit href) + ?^ site.draft `[%site u.site.draft] + ?~ base.draft ~ + ?^ glob-http.draft + `[%glob u.base hash.u.glob-http %http url.u.glob-http]:draft + ?~ glob-ames.draft + ~ + `[%glob u.base hash.u.glob-ames %ames ship.u.glob-ames]:draft + ?~ href ~ + =, draft + :- ~ + :* %1 + u.title + u.info + u.color + u.href + image + u.version + u.website + u.license + == + :: + ++ from-clauses + =| =draft + |= cls=(list clause) + ^- (unit docket) + =* loop $ + ?~ cls (finalize draft) + =* clause i.cls + =. draft + ?- -.clause + %title draft(title `title.clause) + %info draft(info `info.clause) + %color draft(color `color.clause) + %glob-http draft(glob-http `[url hash]:clause) + %glob-ames draft(glob-ames `[ship hash]:clause) + %base draft(base `base.clause) + %site draft(site `path.clause) + %image draft(image `url.clause) + %version draft(version `version.clause) + %website draft(website `website.clause) + %license draft(license `license.clause) + == + loop(cls t.cls) + :: + ++ to-clauses + |= d=docket + ^- (list clause) + %- zing + :~ :~ title+title.d + info+info.d + color+color.d + version+version.d + website+website.d + license+license.d + == + ?~ image.d ~ ~[image+u.image.d] + ?: ?=(%site -.href.d) ~[site+path.href.d] + =/ ref=glob-reference glob-reference.href.d + :~ base+base.href.d + ?- -.location.ref + %http [%glob-http url.location.ref hash.ref] + %ames [%glob-ames ship.location.ref hash.ref] + == == == + :: + ++ spit-clause + |= =clause + ^- tape + %+ weld " {(trip -.clause)}+" + ?+ -.clause "'{(trip +.clause)}'" + %color (scow %ux color.clause) + %site (spud path.clause) + :: + %glob-http + "['{(trip url.clause)}' {(scow %uv hash.clause)}]" + :: + %glob-ames + "[{(scow %p ship.clause)} {(scow %uv hash.clause)}]" + :: + %version + =, version.clause + "[{(scow %ud major)} {(scow %ud minor)} {(scow %ud patch)}]" + == + :: + ++ spit-docket + |= dock=docket + ^- tape + ;: welp + ":~\0a" + `tape`(zing (join "\0a" (turn (to-clauses dock) spit-clause))) + "\0a==" + == + -- +:: +++ enjs + =, enjs:format + |% + :: + ++ charge-update + |= u=^charge-update + ^- json + %+ frond -.u + ^- json + ?- -.u + %del-charge s+desk.u + :: + %initial + %- pairs + %+ turn ~(tap by initial.u) + |=([=desk c=^charge] [desk (charge c)]) + :: + %add-charge + %- pairs + :~ desk+s+desk.u + charge+(charge charge.u) + == + == + :: + ++ num + |= a=@u + ^- ^tape + =/ p=json (numb a) + ?> ?=(%n -.p) + (trip p.p) + :: + ++ version + |= v=^version + ^- json + :- %s + %- crip + "{(num major.v)}.{(num minor.v)}.{(num patch.v)}" + :: + ++ merge + |= [a=json b=json] + ^- json + ?> &(?=(%o -.a) ?=(%o -.b)) + [%o (~(uni by p.a) p.b)] + :: + ++ href + |= h=^href + %+ frond -.h + ?- -.h + %site s+(spat path.h) + %glob + %- pairs + :~ base+s+base.h + glob-reference+(glob-reference glob-reference.h) + == + == + :: + ++ glob-reference + |= ref=^glob-reference + %- pairs + :~ hash+s+(scot %uv hash.ref) + location+(glob-location location.ref) + == + :: + ++ glob-location + |= loc=^glob-location + ^- json + %+ frond -.loc + ?- -.loc + %http s+url.loc + %ames s+(scot %p ship.loc) + == + :: + ++ charge + |= c=^charge + %+ merge (docket docket.c) + %- pairs + :~ chad+(chad chad.c) + == + :: + ++ docket + |= d=^docket + ^- json + %- pairs + :~ title+s+title.d + info+s+info.d + color+s+(scot %ux color.d) + href+(href href.d) + image+?~(image.d ~ s+u.image.d) + version+(version version.d) + license+s+license.d + website+s+website.d + == + :: + ++ chad + |= c=^chad + %+ frond -.c + ?+ -.c ~ + %hung s+err.c + == + -- +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/bill.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/bill.hoon new file mode 100644 index 00000000..76cef343 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/bill.hoon @@ -0,0 +1,34 @@ +|_ bil=(list dude:gall) +++ grow + |% + ++ mime `^mime`[/text/x-bill (as-octs:mimes:html hoon)] + ++ noun bil + ++ hoon + ^- @t + |^ (crip (of-wall:format (wrap-lines (spit-duz bil)))) + :: + ++ wrap-lines + |= taz=wall + ^- wall + ?~ taz ["~"]~ + :- (weld ":~ " i.taz) + %- snoc :_ "==" + (turn t.taz |=(t=tape (weld " " t))) + :: + ++ spit-duz + |= duz=(list dude:gall) + ^- wall + (turn duz |=(=dude:gall ['%' (trip dude)])) + -- + ++ txt (to-wain:format hoon) + -- +++ grab + |% + ++ noun (list dude:gall) + ++ mime + |= [=mite len=@ud tex=@] + ~_ tex + !<((list dude:gall) (slap !>(~) (ream tex))) + -- +++ grad %noun +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/css.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/css.hoon new file mode 100644 index 00000000..1a870811 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/css.hoon @@ -0,0 +1,25 @@ +:: +:::: /hoon/css/mar + :: +/? 310 +=, eyre +=, mimes:html +|_ mud=@t +++ grow :: convert to + |% + ++ mime [/text/css (as-octs mud)] :: convert to %mime + ++ hymn :: convert to %hymn + |^ html + ++ style ;style + ;- (trip mud) + == + ++ html ;html:(head:"{style}" body) + -- + -- +++ grab + |% :: convert from + ++ mime |=([p=mite q=octs] (@t q.q)) + ++ noun @t :: clam from %noun + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/docket-0.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/docket-0.hoon new file mode 100644 index 00000000..c3b253b3 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/docket-0.hoon @@ -0,0 +1,25 @@ +/+ dock=docket +|_ =docket:dock +++ grow + |% + ++ mime + ^- ^mime + [/text/x-docket (as-octt:mimes:html (spit-docket:mime:dock docket))] + ++ noun docket + ++ json (docket:enjs:dock docket) + -- +++ grab + |% + :: + ++ mime + |= [=mite len=@ud tex=@] + ^- docket:dock + %- need + %- from-clauses:mime:dock + !<((list clause:dock) (slap !>(~) (ream tex))) + + :: + ++ noun docket:dock + -- +++ grad %noun +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/hoon.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/hoon.hoon new file mode 100644 index 00000000..428e1056 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/hoon.hoon @@ -0,0 +1,36 @@ +:::: /hoon/hoon/mar + :: +/? 310 +:: +=, eyre +|_ own=@t +:: +++ grow :: convert to + |% + ++ mime `^mime`[/text/x-hoon (as-octs:mimes:html own)] :: convert to %mime + ++ hymn + ;html + ;head + ;title:"Source" + ;script@"//cdnjs.cloudflare.com/ajax/libs/codemirror/4.3.0/codemirror.js"; + ;script@"/lib/syntax/hoon.js"; + ;link(rel "stylesheet", href "//cdnjs.cloudflare.com/ajax/libs/". + "codemirror/4.3.0/codemirror.min.css"); + ;link/"/lib/syntax/codemirror.css"(rel "stylesheet"); + == + ;body + ;textarea#src:"{(trip own)}" + ;script:'CodeMirror.fromTextArea(src, {lineNumbers:true, readOnly:true})' + == + == + ++ txt + (to-wain:format own) + -- +++ grab + |% :: convert from + ++ mime |=([p=mite q=octs] q.q) + ++ noun @t :: clam from %noun + ++ txt of-wain:format + -- +++ grad %txt +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/html.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/html.hoon new file mode 100644 index 00000000..203d75f6 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/html.hoon @@ -0,0 +1,22 @@ +:: +:::: /hoon/html/mar + :: +/? 310 + :: +:::: compute + :: +=, html +|_ htm=@t +++ grow :: convert to + ^? + |% :: + ++ mime [/text/html (met 3 htm) htm] :: to %mime + ++ hymn (need (de-xml htm)) :: to %hymn + -- :: +++ grab ^? + |% :: convert from + ++ noun @t :: clam from %noun + ++ mime |=([p=mite q=octs] q.q) :: retrieve form %mime + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/ico.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/ico.hoon new file mode 100644 index 00000000..e862b9b9 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/ico.hoon @@ -0,0 +1,12 @@ +|_ dat=@ +++ grow + |% + ++ mime [/image/x-icon (as-octs:mimes:html dat)] + -- +++ grab + |% + ++ mime |=([p=mite q=octs] q.q) + ++ noun @ + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/jpg.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/jpg.hoon new file mode 100644 index 00000000..81a77d46 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/jpg.hoon @@ -0,0 +1,12 @@ +|_ dat=@ +++ grow + |% + ++ mime [/image/jpeg (as-octs:mimes:html dat)] + -- +++ grab + |% + ++ mime |=([p=mite q=octs] q.q) + ++ noun @ + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/js.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/js.hoon new file mode 100644 index 00000000..fe010d99 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/js.hoon @@ -0,0 +1,25 @@ +:: +:::: /hoon/js/mar + :: +/? 310 +:: +=, eyre +|_ mud=@ +++ grow + |% + ++ mime [/application/javascript (as-octs:mimes:html (@t mud))] + ++ hymn :: convert to %hymn + |^ html + ++ script ;script + ;- (trip (@t mud)) + == + ++ html ;html:(head:"{script}" body) + -- + -- +++ 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/vega-interface/urbit-files/mar/json.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/json.hoon new file mode 100644 index 00000000..7d6fcbf8 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/json.hoon @@ -0,0 +1,26 @@ +:: +:::: /hoon/json/mar + :: +/? 310 + :: +:::: compute + :: +=, eyre +=, format +=, html +|_ jon=^json +:: +++ grow :: convert to + |% + ++ mime [/application/json (as-octs:mimes -:txt)] :: convert to %mime + ++ txt [(en:json jon)]~ + -- +++ grab + |% :: convert from + ++ mime |=([p=mite q=octs] (fall (de:json (@t q.q)) *^json)) + ++ noun ^json :: clam from %noun + ++ numb numb:enjs + ++ time time:enjs + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/json/rpc/response.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/json/rpc/response.hoon new file mode 100644 index 00000000..a1cf33de --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/json/rpc/response.hoon @@ -0,0 +1,42 @@ +:: +/- *json-rpc +:: +|_ res=response +:: +++ grad %noun +++ grow + |% + ++ noun res + -- +++ grab :: convert from + |% + ++ noun response :: from noun + ++ httr :: from httr + |= hit=httr:eyre + ^- response + ~| hit + ?: ?=(%2 (div p.hit 100)) + %- json + ?~ r.hit + a+~ + (need (de:json:html q:u.r.hit)) + fail+hit + ++ json :: from json + =, dejs-soft:format + |= a=json + ^- response + =; dere + =+ res=((ar dere) a) + ?~ res (need (dere a)) + [%batch u.res] + |= a=json + ^- (unit response) + =/ res=(unit [@t json]) + ::TODO breaks when no id present + ((ot id+so result+some ~) a) + ?^ res `[%result u.res] + ~| a + :+ ~ %error %- need + ((ot id+so error+(ot code+no message+so ~) ~) a) + -- +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/kelvin.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/kelvin.hoon new file mode 100644 index 00000000..7f1b409c --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/kelvin.hoon @@ -0,0 +1,28 @@ +|_ kal=waft:clay +++ grow + |% + ++ mime `^mime`[/text/x-kelvin (as-octs:mimes:html hoon)] + ++ noun kal + ++ hoon + %+ rap 3 + %+ turn + %+ sort + ~(tap in (waft-to-wefts:clay kal)) + |= [a=weft b=weft] + ?: =(lal.a lal.b) + (gte num.a num.b) + (gte lal.a lal.b) + |= =weft + (rap 3 '[%' (scot %tas lal.weft) ' ' (scot %ud num.weft) ']\0a' ~) + :: + ++ txt (to-wain:format hoon) + -- +++ grab + |% + ++ noun waft:clay + ++ mime + |= [=mite len=@ud tex=@] + (cord-to-waft:clay tex) + -- +++ grad %noun +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/mime.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/mime.hoon new file mode 100644 index 00000000..83b4daeb --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/mime.hoon @@ -0,0 +1,32 @@ +:: +:::: /hoon/mime/mar + :: +/? 310 +:: +|_ own=mime +++ grow + ^? + |% + ++ jam `@`q.q.own + -- +:: +++ grab :: convert from + ^? + |% + ++ noun mime :: clam from %noun + ++ tape + |=(a=_"" [/application/x-urb-unknown (as-octt:mimes:html a)]) + -- +++ grad + ^? + |% + ++ form %mime + ++ diff |=(mime +<) + ++ pact |=(mime +<) + ++ join |=([mime mime] `(unit mime)`~) + ++ mash + |= [[ship desk mime] [ship desk mime]] + ^- mime + ~|(%mime-mash !!) + -- +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/noun.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/noun.hoon new file mode 100644 index 00000000..ff5443ec --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/noun.hoon @@ -0,0 +1,22 @@ +:: +:::: /hoon/noun/mar + :: +/? 310 +!: +:::: A minimal noun mark +|_ non=* +++ grab |% + ++ noun * + -- +++ grow |% + ++ mime [/application/x-urb-jam (as-octs:mimes:html (jam non))] + -- +++ grad + |% + ++ form %noun + ++ diff |=(* +<) + ++ pact |=(* +<) + ++ join |=([* *] *(unit *)) + ++ mash |=([[ship desk *] [ship desk *]] `*`~|(%noun-mash !!)) + -- +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/png.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/png.hoon new file mode 100644 index 00000000..6a60a6a2 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/png.hoon @@ -0,0 +1,12 @@ +|_ dat=@ +++ grow + |% + ++ mime [/image/png (as-octs:mimes:html dat)] + -- +++ grab + |% + ++ mime |=([p=mite q=octs] q.q) + ++ noun @ + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/ship.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/ship.hoon new file mode 100644 index 00000000..176bcade --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/ship.hoon @@ -0,0 +1,20 @@ +|_ s=ship +++ grad %noun +++ grow + |% + ++ noun s + ++ json s+(scot %p s) + ++ mime + ^- ^mime + [/text/x-ship (as-octt:mimes:html (scow %p s))] + + -- +++ grab + |% + ++ noun ship + ++ json (su:dejs:format ;~(pfix sig fed:ag)) + ++ mime + |= [=mite len=@ tex=@] + (slav %p (snag 0 (to-wain:format tex))) + -- +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/txt-diff.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/txt-diff.hoon new file mode 100644 index 00000000..2c9a500d --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/txt-diff.hoon @@ -0,0 +1,16 @@ +:: +:::: /hoon/txt-diff/mar + :: +/? 310 +|_ txt-diff=(urge:clay cord) +:: +++ grad %noun +++ grow + |% + ++ noun txt-diff + -- +++ grab :: convert from + |% + ++ noun (urge:clay cord) :: make from %noun + -- +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/txt.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/txt.hoon new file mode 100644 index 00000000..982dce97 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/txt.hoon @@ -0,0 +1,274 @@ +:: +:::: /hoon/txt/mar + :: +/? 310 +:: +=, clay +=, differ +=, format +=, mimes:html +|_ txt=wain +:: +++ grab :: convert from + |% + ++ mime |=((pair mite octs) (to-wain q.q)) + ++ noun wain :: clam from %noun + -- +++ grow + => v=. + |% + ++ mime => v [/text/plain (as-octs (of-wain txt))] + -- +++ grad + |% + ++ form %txt-diff + ++ diff + |= tyt=wain + ^- (urge cord) + (lusk txt tyt (loss txt tyt)) + :: + ++ pact + |= dif=(urge cord) + ~| [%pacting dif] + ^- wain + (lurk txt dif) + :: + ++ join + |= [ali=(urge cord) bob=(urge cord)] + ^- (unit (urge cord)) + |^ + =. ali (clean ali) + =. bob (clean bob) + |- ^- (unit (urge cord)) + ?~ ali `bob + ?~ bob `ali + ?- -.i.ali + %& + ?- -.i.bob + %& + ?: =(p.i.ali p.i.bob) + %+ bind $(ali t.ali, bob t.bob) + |=(cud=(urge cord) [i.ali cud]) + ?: (gth p.i.ali p.i.bob) + %+ bind $(p.i.ali (sub p.i.ali p.i.bob), bob t.bob) + |=(cud=(urge cord) [i.bob cud]) + %+ bind $(ali t.ali, p.i.bob (sub p.i.bob p.i.ali)) + |=(cud=(urge cord) [i.ali cud]) + :: + %| + ?: =(p.i.ali (lent p.i.bob)) + %+ bind $(ali t.ali, bob t.bob) + |=(cud=(urge cord) [i.bob cud]) + ?: (gth p.i.ali (lent p.i.bob)) + %+ bind $(p.i.ali (sub p.i.ali (lent p.i.bob)), bob t.bob) + |=(cud=(urge cord) [i.bob cud]) + ~ + == + :: + %| + ?- -.i.bob + %| + ?. =(i.ali i.bob) + ~ + %+ bind $(ali t.ali, bob t.bob) + |=(cud=(urge cord) [i.ali cud]) + :: + %& + ?: =(p.i.bob (lent p.i.ali)) + %+ bind $(ali t.ali, bob t.bob) + |=(cud=(urge cord) [i.ali cud]) + ?: (gth p.i.bob (lent p.i.ali)) + %+ bind $(ali t.ali, p.i.bob (sub p.i.bob (lent p.i.ali))) + |=(cud=(urge cord) [i.ali cud]) + ~ + == + == + ++ clean :: clean + |= wig=(urge cord) + ^- (urge cord) + ?~ wig ~ + ?~ t.wig wig + ?: ?=(%& -.i.wig) + ?: ?=(%& -.i.t.wig) + $(wig [[%& (add p.i.wig p.i.t.wig)] t.t.wig]) + [i.wig $(wig t.wig)] + ?: ?=(%| -.i.t.wig) + $(wig [[%| (welp p.i.wig p.i.t.wig) (welp q.i.wig q.i.t.wig)] t.t.wig]) + [i.wig $(wig t.wig)] + -- + :: + ++ mash + |= $: [als=ship ald=desk ali=(urge cord)] + [bos=ship bod=desk bob=(urge cord)] + == + ^- (urge cord) + |^ + =. ali (clean ali) + =. bob (clean bob) + |- ^- (urge cord) + ?~ ali bob + ?~ bob ali + ?- -.i.ali + %& + ?- -.i.bob + %& + ?: =(p.i.ali p.i.bob) + [i.ali $(ali t.ali, bob t.bob)] + ?: (gth p.i.ali p.i.bob) + [i.bob $(p.i.ali (sub p.i.ali p.i.bob), bob t.bob)] + [i.ali $(ali t.ali, p.i.bob (sub p.i.bob p.i.ali))] + :: + %| + ?: =(p.i.ali (lent p.i.bob)) + [i.bob $(ali t.ali, bob t.bob)] + ?: (gth p.i.ali (lent p.i.bob)) + [i.bob $(p.i.ali (sub p.i.ali (lent p.i.bob)), bob t.bob)] + =/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)] + (resolve ali bob) + [fic $(ali ali, bob bob)] + :: ~ :: here, alice is good for a while, but not for the whole + == :: length of bob's changes + :: + %| + ?- -.i.bob + %| + =/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)] + (resolve ali bob) + [fic $(ali ali, bob bob)] + :: + %& + ?: =(p.i.bob (lent p.i.ali)) + [i.ali $(ali t.ali, bob t.bob)] + ?: (gth p.i.bob (lent p.i.ali)) + [i.ali $(ali t.ali, p.i.bob (sub p.i.bob (lent p.i.ali)))] + =/ [fic=(unce cord) ali=(urge cord) bob=(urge cord)] + (resolve ali bob) + [fic $(ali ali, bob bob)] + == + == + :: + ++ annotate :: annotate conflict + |= $: ali=(list @t) + bob=(list @t) + bas=(list @t) + == + ^- (list @t) + %- zing + ^- (list (list @t)) + %- flop + ^- (list (list @t)) + :- :_ ~ + %^ cat 3 '<<<<<<<<<<<<' + %^ cat 3 ' ' + %^ cat 3 `@t`(scot %p bos) + %^ cat 3 '/' + bod + + :- bob + :- ~['------------'] + :- bas + :- ~['++++++++++++'] + :- ali + :- :_ ~ + %^ cat 3 '>>>>>>>>>>>>' + %^ cat 3 ' ' + %^ cat 3 `@t`(scot %p als) + %^ cat 3 '/' + ald + ~ + :: + ++ clean :: clean + |= wig=(urge cord) + ^- (urge cord) + ?~ wig ~ + ?~ t.wig wig + ?: ?=(%& -.i.wig) + ?: ?=(%& -.i.t.wig) + $(wig [[%& (add p.i.wig p.i.t.wig)] t.t.wig]) + [i.wig $(wig t.wig)] + ?: ?=(%| -.i.t.wig) + $(wig [[%| (welp p.i.wig p.i.t.wig) (welp q.i.wig q.i.t.wig)] t.t.wig]) + [i.wig $(wig t.wig)] + :: + ++ resolve + |= [ali=(urge cord) bob=(urge cord)] + ^- [fic=[%| p=(list cord) q=(list cord)] ali=(urge cord) bob=(urge cord)] + =- [[%| bac (annotate alc boc bac)] ali bob] + |- ^- $: $: bac=(list cord) + alc=(list cord) + boc=(list cord) + == + ali=(urge cord) + bob=(urge cord) + == + ?~ ali [[~ ~ ~] ali bob] + ?~ bob [[~ ~ ~] ali bob] + ?- -.i.ali + %& + ?- -.i.bob + %& [[~ ~ ~] ali bob] :: no conflict + %| + =+ lob=(lent p.i.bob) + ?: =(lob p.i.ali) + [[p.i.bob p.i.bob q.i.bob] t.ali t.bob] + ?: (lth lob p.i.ali) + [[p.i.bob p.i.bob q.i.bob] [[%& (sub p.i.ali lob)] t.ali] t.bob] + =+ wat=(scag (sub lob p.i.ali) p.i.bob) + =+ ^= res + %= $ + ali t.ali + bob [[%| (scag (sub lob p.i.ali) p.i.bob) ~] t.bob] + == + :* :* (welp bac.res wat) + (welp alc.res wat) + (welp boc.res q.i.bob) + == + ali.res + bob.res + == + == + :: + %| + ?- -.i.bob + %& + =+ loa=(lent p.i.ali) + ?: =(loa p.i.bob) + [[p.i.ali q.i.ali p.i.ali] t.ali t.bob] + ?: (lth loa p.i.bob) + [[p.i.ali q.i.ali p.i.ali] t.ali [[%& (sub p.i.bob loa)] t.bob]] + =+ wat=(slag (sub loa p.i.bob) p.i.ali) + =+ ^= res + %= $ + ali [[%| (scag (sub loa p.i.bob) p.i.ali) ~] t.ali] + bob t.bob + == + :* :* (welp bac.res wat) + (welp alc.res q.i.ali) + (welp boc.res wat) + == + ali.res + bob.res + == + :: + %| + =+ loa=(lent p.i.ali) + =+ lob=(lent p.i.bob) + ?: =(loa lob) + [[p.i.ali q.i.ali q.i.bob] t.ali t.bob] + =+ ^= res + ?: (gth loa lob) + $(ali [[%| (scag (sub loa lob) p.i.ali) ~] t.ali], bob t.bob) + ~& [%scagging loa=loa pibob=p.i.bob slag=(scag loa p.i.bob)] + $(ali t.ali, bob [[%| (scag (sub lob loa) p.i.bob) ~] t.bob]) + :* :* (welp bac.res ?:((gth loa lob) p.i.bob p.i.ali)) + (welp alc.res q.i.ali) + (welp boc.res q.i.bob) + == + ali.res + bob.res + == + == + == + -- + -- +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/woff.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/woff.hoon new file mode 100644 index 00000000..c1d0d1c8 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/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/config/vega-interface/urbit-files/mar/woff2.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/woff2.hoon new file mode 100644 index 00000000..7e724290 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/woff2.hoon @@ -0,0 +1,12 @@ +|_ dat=octs +++ grow + |% + ++ mime [/font/woff2 dat] + -- +++ grab + |% + ++ mime |=([=mite =octs] octs) + ++ noun octs + -- +++ grad %mime +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/mar/xhtml.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/xhtml.hoon new file mode 100644 index 00000000..b9ec0020 --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/mar/xhtml.hoon @@ -0,0 +1,5 @@ +:: +:::: /hoon/xhtml/mar + :: +/= xhtml /mar/html +xhtml diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/sur/docket.hoon b/stack_orchestrator/data/config/vega-interface/urbit-files/sur/docket.hoon new file mode 100644 index 00000000..091c8c9f --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/sur/docket.hoon @@ -0,0 +1,82 @@ +|% +:: ++$ version + [major=@ud minor=@ud patch=@ud] +:: ++$ glob (map path mime) +:: ++$ url cord +:: $glob-location: How to retrieve a glob +:: ++$ glob-reference + [hash=@uvH location=glob-location] +:: ++$ glob-location + $% [%http =url] + [%ames =ship] + == +:: $href: Where a tile links to +:: ++$ href + $% [%glob base=term =glob-reference] + [%site =path] + == +:: $chad: State of a docket +:: ++$ chad + $~ [%install ~] + $% :: Done + [%glob =glob] + [%site ~] + :: Waiting + [%install ~] + [%suspend glob=(unit glob)] + :: Error + [%hung err=cord] + == +:: +:: $charge: A realized $docket +:: ++$ charge + $: =docket + =chad + == +:: +:: $clause: A key and value, as part of a docket +:: +:: Only used to parse $docket +:: ++$ clause + $% [%title title=@t] + [%info info=@t] + [%color color=@ux] + [%glob-http url=cord hash=@uvH] + [%glob-ames =ship hash=@uvH] + [%image =url] + [%site =path] + [%base base=term] + [%version =version] + [%website website=url] + [%license license=cord] + == +:: +:: $docket: A description of JS bundles for a desk +:: ++$ docket + $: %1 + title=@t + info=@t + color=@ux + =href + image=(unit url) + =version + website=url + license=cord + == +:: ++$ charge-update + $% [%initial initial=(map desk charge)] + [%add-charge =desk =charge] + [%del-charge =desk] + == +-- diff --git a/stack_orchestrator/data/config/vega-interface/urbit-files/sys.kelvin b/stack_orchestrator/data/config/vega-interface/urbit-files/sys.kelvin new file mode 100644 index 00000000..5d8a35da --- /dev/null +++ b/stack_orchestrator/data/config/vega-interface/urbit-files/sys.kelvin @@ -0,0 +1 @@ +[%zuse 412] diff --git a/stack_orchestrator/data/container-build/cerc-vega-interface/Dockerfile b/stack_orchestrator/data/container-build/cerc-vega-interface/Dockerfile new file mode 100644 index 00000000..a08374fc --- /dev/null +++ b/stack_orchestrator/data/container-build/cerc-vega-interface/Dockerfile @@ -0,0 +1,12 @@ +from node:20.9.0 + +# RUN apk --update --no-cache add git make alpine-sdk bash + +WORKDIR /app + +# Copy the Vega monorepo fork into `/app` +COPY . . + +RUN yarn +# RUN ./docker/prepare-dist.sh + diff --git a/stack_orchestrator/data/container-build/cerc-vega-interface/build.sh b/stack_orchestrator/data/container-build/cerc-vega-interface/build.sh new file mode 100755 index 00000000..f73985df --- /dev/null +++ b/stack_orchestrator/data/container-build/cerc-vega-interface/build.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Build the vega-interface image +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh + +# See: https://stackoverflow.com/a/246128/1701505 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +docker build \ + -t cerc/vega-interface:local \ + -f ${SCRIPT_DIR}/Dockerfile \ + ${build_command_args} \ + ${CERC_REPO_BASE_DIR}/vega-frontend-monorepo diff --git a/stack_orchestrator/data/container-image-list.txt b/stack_orchestrator/data/container-image-list.txt index fd295be5..1523390b 100644 --- a/stack_orchestrator/data/container-image-list.txt +++ b/stack_orchestrator/data/container-image-list.txt @@ -60,3 +60,4 @@ cerc/nitro-rpc-client cerc/watcher-merkl-sushiswap-v3 cerc/watcher-sushiswap-v3 cerc/uniswap-interface +cerc/vega-interface diff --git a/stack_orchestrator/data/pod-list.txt b/stack_orchestrator/data/pod-list.txt index 9ad000c7..fa2501a3 100644 --- a/stack_orchestrator/data/pod-list.txt +++ b/stack_orchestrator/data/pod-list.txt @@ -45,3 +45,4 @@ ponder ipld-eth-server-payments merkl-sushiswap-v3 sushiswap-v3 +vega-interface diff --git a/stack_orchestrator/data/repository-list.txt b/stack_orchestrator/data/repository-list.txt index cddaccce..d56a6c5a 100644 --- a/stack_orchestrator/data/repository-list.txt +++ b/stack_orchestrator/data/repository-list.txt @@ -50,3 +50,4 @@ github.com/cerc-io/ponder github.com/cerc-io/merkl-sushiswap-v3-watcher-ts github.com/cerc-io/sushiswap-v3-watcher-ts github.com/cerc-io/uniswap-interface +git.vdb.to/LaconicNetwork/vega-frontend-monorepo diff --git a/stack_orchestrator/data/stacks/vega-urbit-app/README.md b/stack_orchestrator/data/stacks/vega-urbit-app/README.md new file mode 100644 index 00000000..bd426eeb --- /dev/null +++ b/stack_orchestrator/data/stacks/vega-urbit-app/README.md @@ -0,0 +1,131 @@ +# Self-hosted Vega Frontend + +Instructions to setup and deploy Vega app on Urbit + +Build and deploy: + +- Urbit +- Vega app + +## Setup + +Clone required repositories: + +```bash +laconic-so --stack vega-urbit-app 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 +``` + +Build the container images: + +```bash +laconic-so --stack vega-urbit-app 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: + +```bash +laconic-so --stack vega-urbit-app deploy init --output vega-urbit-app-spec.yml +``` + +### Ports + +Edit `vega-urbit-app-spec.yml` such that it looks like: + +```yml +stack: vega-urbit-app +deploy-to: compose +network: + ports: + urbit-fake-ship: + - '8080:80' + ipfs: + - '4001' + - '8081:8080' + - 0.0.0.0:5001:5001 +volumes: + urbit_app_builds: ./data/urbit_app_builds + urbit_data: ./data/urbit_data + ipfs-import: ./data/ipfs-import + ipfs-data: ./data/ipfs-data +``` + +Note: Skip the `ipfs` ports if using an externally running IPFS node, set via `config.env`, below. + +### 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: + +```bash +laconic-so --stack vega-urbit-app deploy create --spec-file vega-urbit-app-spec.yml --deployment-dir vega-urbit-app-deployment +``` + +## Set env variables + +Inside the deployment directory, open the file `config.env` and set the following env variables: + + ```bash + # App to be installed (Do not change) + CERC_URBIT_APP=vega + ``` + +## Start the stack + +Start the deployment: + +```bash +laconic-so deployment --dir vega-urbit-app-deployment start +``` + +* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy` + +* Run the following to get login password for Urbit web interface: + + ```bash + laconic-so deployment --dir vega-urbit-app-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 vega app is not available when starting stack for the first time. Check `urbit-fake-ship` logs to see that app has installed: + + ```bash + laconic-so deployment --dir vega-urbit-app-deployment logs -f + + # Expected output: + # laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | docket: fetching %http glob for %vega desk + # laconic-3ccf7ee79bdae874-urbit-fake-ship-1 | ">="">="vega app installed + ``` + +* The vega app will be now visible at http://localhost:8080 + +## Clean up + +To stop all vega-urbit-app services running in the background, while preserving data: + +```bash +# Only stop the docker containers +laconic-so deployment --dir vega-urbit-app-deployment stop + +# Run 'start' to restart the deployment +``` + +To stop all vega-urbit-app services and also delete data: + +```bash +# Stop the docker containers +laconic-so deployment --dir vega-urbit-app-deployment stop --delete-volumes + +# Remove deployment directory (deployment will have to be recreated for a re-run) +rm -r vega-urbit-app-deployment +``` diff --git a/stack_orchestrator/data/stacks/vega-urbit-app/stack.yml b/stack_orchestrator/data/stacks/vega-urbit-app/stack.yml new file mode 100755 index 00000000..e39002a6 --- /dev/null +++ b/stack_orchestrator/data/stacks/vega-urbit-app/stack.yml @@ -0,0 +1,10 @@ +version: "0.1" +name: vega-urbit-app +repos: + - git.vdb.to/LaconicNetwork/vega-frontend-monorepo@urbit-build +containers: + - cerc/vega-interface +pods: + - vega-interface + - fixturenet-urbit + - kubo