forked from cerc-io/stack-orchestrator
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82785b6823 | ||
|
|
583774e32a | ||
|
|
f91329eef0 | ||
|
|
7f0b82b9a9 | ||
|
|
64b395f15a | ||
|
|
240db3ca4c | ||
|
|
d09fbc3ac4 | ||
|
|
3c7ff76a83 | ||
|
|
53b29ff69b | ||
|
|
4ec0e38b77 | ||
|
|
14ee4da1fc | ||
|
|
e81c95a920 |
@@ -26,9 +26,9 @@ services:
|
|||||||
- "80"
|
- "80"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "nc", "-v", "localhost", "80"]
|
test: ["CMD", "nc", "-v", "localhost", "80"]
|
||||||
interval: 10s
|
interval: 20s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 30
|
retries: 15
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- REACT_APP_INFURA_KEY=${CERC_INFURA_KEY}
|
- REACT_APP_INFURA_KEY=${CERC_INFURA_KEY}
|
||||||
- REACT_APP_AWS_API_ENDPOINT=${CERC_UNISWAP_GQL}
|
- REACT_APP_AWS_API_ENDPOINT=${CERC_UNISWAP_GQL}
|
||||||
- REACT_APP_UNISWAP_API_URL=${CERC_UNISWAP_API}
|
|
||||||
command: ["./build-app.sh"]
|
command: ["./build-app.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/uniswap-interface/build-app.sh:/app/build-app.sh
|
- ../config/uniswap-interface/build-app.sh:/app/build-app.sh
|
||||||
- urbit_app_builds:/app-builds
|
- urbit_app_builds:/app-builds
|
||||||
- ../config/uniswap-interface/urbit-files:/app/urbit-files
|
- ../config/uniswap-interface/urbit-files/mar:/app/mar
|
||||||
|
- ../config/uniswap-interface/urbit-files/desk.docket-0:/app/desk.docket-0
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
urbit_app_builds:
|
urbit_app_builds:
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
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:
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
version: '3.2'
|
|
||||||
|
|
||||||
services:
|
|
||||||
ajna-watcher-db:
|
|
||||||
restart: unless-stopped
|
|
||||||
image: postgres:14-alpine
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER=vdbm
|
|
||||||
- POSTGRES_MULTIPLE_DATABASES=ajna-watcher,ajna-watcher-job-queue
|
|
||||||
- POSTGRES_EXTENSION=ajna-watcher-job-queue:pgcrypto
|
|
||||||
- POSTGRES_PASSWORD=password
|
|
||||||
volumes:
|
|
||||||
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
|
|
||||||
- ajna_watcher_db_data:/var/lib/postgresql/data
|
|
||||||
ports:
|
|
||||||
- "5432"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
|
||||||
interval: 20s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 15
|
|
||||||
start_period: 10s
|
|
||||||
|
|
||||||
ajna-watcher-job-runner:
|
|
||||||
restart: unless-stopped
|
|
||||||
depends_on:
|
|
||||||
ajna-watcher-db:
|
|
||||||
condition: service_healthy
|
|
||||||
image: cerc/watcher-ajna:local
|
|
||||||
environment:
|
|
||||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
|
||||||
CERC_ETH_RPC_ENDPOINT: ${CERC_ETH_RPC_ENDPOINT}
|
|
||||||
command: ["bash", "./start-job-runner.sh"]
|
|
||||||
volumes:
|
|
||||||
- ../config/watcher-ajna/watcher-config-template.toml:/app/environments/watcher-config-template.toml
|
|
||||||
- ../config/watcher-ajna/start-job-runner.sh:/app/start-job-runner.sh
|
|
||||||
ports:
|
|
||||||
- "9000"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "nc", "-v", "localhost", "9000"]
|
|
||||||
interval: 20s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 15
|
|
||||||
start_period: 5s
|
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
|
|
||||||
ajna-watcher-server:
|
|
||||||
restart: unless-stopped
|
|
||||||
depends_on:
|
|
||||||
ajna-watcher-db:
|
|
||||||
condition: service_healthy
|
|
||||||
ajna-watcher-job-runner:
|
|
||||||
condition: service_healthy
|
|
||||||
image: cerc/watcher-ajna:local
|
|
||||||
environment:
|
|
||||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
|
||||||
CERC_ETH_RPC_ENDPOINT: ${CERC_ETH_RPC_ENDPOINT}
|
|
||||||
command: ["bash", "./start-server.sh"]
|
|
||||||
volumes:
|
|
||||||
- ../config/watcher-ajna/watcher-config-template.toml:/app/environments/watcher-config-template.toml
|
|
||||||
- ../config/watcher-ajna/start-server.sh:/app/start-server.sh
|
|
||||||
ports:
|
|
||||||
- "3008"
|
|
||||||
- "9001"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "nc", "-v", "localhost", "3008"]
|
|
||||||
interval: 20s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 15
|
|
||||||
start_period: 5s
|
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
ajna_watcher_db_data:
|
|
||||||
@@ -50,6 +50,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="azimuth", instance="azimuth", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -126,6 +142,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="azimuth", instance="censures", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -202,6 +234,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="azimuth", instance="claims", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -278,6 +326,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="azimuth", instance="conditional_star_release", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -354,6 +418,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="azimuth", instance="delegated_sending", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -430,6 +510,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="azimuth", instance="ecliptic", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -506,6 +602,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="azimuth", instance="azimuth", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -582,6 +694,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="azimuth", instance="polls", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -660,6 +788,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="sushi", instance="sushiswap", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
@@ -736,6 +880,22 @@ groups:
|
|||||||
legendFormat: __auto
|
legendFormat: __auto
|
||||||
range: false
|
range: false
|
||||||
refId: latest_external
|
refId: latest_external
|
||||||
|
- refId: latest_indexed
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: PBFA97CFB590B2093
|
||||||
|
model:
|
||||||
|
datasource:
|
||||||
|
type: prometheus
|
||||||
|
uid: PBFA97CFB590B2093
|
||||||
|
editorMode: code
|
||||||
|
expr: sync_status_block_number{job="sushi", instance="merkl_sushiswap", kind="latest_indexed"}
|
||||||
|
hide: false
|
||||||
|
instant: true
|
||||||
|
legendFormat: __auto
|
||||||
|
range: false
|
||||||
|
refId: latest_indexed
|
||||||
- refId: condition
|
- refId: condition
|
||||||
relativeTimeRange:
|
relativeTimeRange:
|
||||||
from: 600
|
from: 600
|
||||||
|
|||||||
@@ -15,5 +15,7 @@ yarn build
|
|||||||
|
|
||||||
# Copy over build and other files to app-builds for urbit deployment
|
# Copy over build and other files to app-builds for urbit deployment
|
||||||
mkdir -p /app-builds/uniswap
|
mkdir -p /app-builds/uniswap
|
||||||
cp -r urbit-files /app-builds/uniswap/
|
cp -r ./build /app-builds/uniswap/
|
||||||
cp -r ./build /app-builds/uniswap/urbit-files
|
|
||||||
|
cp -r mar /app-builds/uniswap/
|
||||||
|
cp desk.docket-0 /app-builds/uniswap/
|
||||||
|
|||||||
@@ -1,225 +0,0 @@
|
|||||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
||||||
::
|
|
||||||
:: Proxy server
|
|
||||||
:: ------------
|
|
||||||
::
|
|
||||||
:: This is a simple agent which accepts requests at the path given in the `on-init` arm-- in this
|
|
||||||
:: case, "/apps/uniswap-proxy/"-- and proxies them to the upstream, in this case,
|
|
||||||
:: "https://api.uniswap.org/".
|
|
||||||
::
|
|
||||||
:: For example, assuming your ship is running on `localhost:8080`, a request to the url
|
|
||||||
::
|
|
||||||
:: `http://localhost:8080/apps/uniswap-proxy/v1/graphql`
|
|
||||||
::
|
|
||||||
:: will be proxied to
|
|
||||||
::
|
|
||||||
:: `https://api.uniswap.org/v1/graphql`
|
|
||||||
::
|
|
||||||
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
|
||||||
::
|
|
||||||
/+ dbug, server, default-agent
|
|
||||||
::
|
|
||||||
|%
|
|
||||||
+$ card card:agent:gall
|
|
||||||
+$ state
|
|
||||||
$% %0
|
|
||||||
==
|
|
||||||
--
|
|
||||||
::
|
|
||||||
:: Path config
|
|
||||||
|%
|
|
||||||
++ base-url-path /apps/uniswap-proxy :: HTTP path on the ship that this agent will bind to
|
|
||||||
++ upstream-api-url "https://api.uniswap.org/" :: Upstream HTTP api that requests should be proxied to
|
|
||||||
--
|
|
||||||
::
|
|
||||||
%- agent:dbug
|
|
||||||
::
|
|
||||||
=| state
|
|
||||||
=* state -
|
|
||||||
::
|
|
||||||
^- agent:gall
|
|
||||||
=<
|
|
||||||
|_ =bowl:gall
|
|
||||||
+* this .
|
|
||||||
default ~(. (default-agent this) bowl)
|
|
||||||
::
|
|
||||||
++ on-init
|
|
||||||
^- (quip card _this)
|
|
||||||
:_ this
|
|
||||||
:~
|
|
||||||
[%pass /eyre/connect %arvo %e %connect [~ base-url-path] %proxy]
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ on-poke
|
|
||||||
|= [=mark =vase]
|
|
||||||
^- (quip card _this)
|
|
||||||
:_ this :: We have no state
|
|
||||||
?+ mark (on-poke:default mark vase)
|
|
||||||
%handle-http-request
|
|
||||||
=/ [eyre-id=@ta inbound-req=inbound-request:eyre] !<([@ta =inbound-request:eyre] vase)
|
|
||||||
~& "Eyre id: {<eyre-id>}"
|
|
||||||
=/ old-req request:inbound-req
|
|
||||||
=/ new-req=request:http
|
|
||||||
%= old-req
|
|
||||||
:: Remove path prefix from the url, replace with Uniswap domain and path prefix
|
|
||||||
url (rewrite-path url:old-req)
|
|
||||||
:: Change the "Origin" header to match the upstream (this is hacky as fuck and will break eventually)
|
|
||||||
header-list (rewrite-headers header-list:old-req)
|
|
||||||
==
|
|
||||||
~& "Proxying {<url.old-req>} to {<url.new-req>}"
|
|
||||||
~& "Outgoing headers: {<header-list:new-req>}"
|
|
||||||
:~
|
|
||||||
[%pass /response/[eyre-id] %arvo %i %request new-req *outbound-config:iris]
|
|
||||||
==
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ on-arvo
|
|
||||||
|= [=wire =sign-arvo]
|
|
||||||
^- (quip card _this)
|
|
||||||
:_ this :: We don't have any state
|
|
||||||
?+ sign-arvo (on-arvo:default wire sign-arvo)
|
|
||||||
::
|
|
||||||
:: Arvo will respond when we initially connect to Eyre in `on-init`. We will accept (and ignore)
|
|
||||||
:: that and reject any other communications.
|
|
||||||
[%eyre %bound *]
|
|
||||||
~& "Got eyre bound: {<sign-arvo>}"
|
|
||||||
~
|
|
||||||
[%iris %http-response %finished *]
|
|
||||||
?+ wire (on-arvo:default wire sign-arvo)
|
|
||||||
[%response @ ~]
|
|
||||||
=/ original-eyre-id=@ta (snag 1 `(list @ta)`wire)
|
|
||||||
=/ resp=client-response:iris +:+:sign-arvo
|
|
||||||
?> ?= %finished -.resp
|
|
||||||
=/ resp-header=response-header:http response-header:resp
|
|
||||||
=/ the-octs=octs data:(need full-file:resp)
|
|
||||||
::
|
|
||||||
=/ thedata=@t q.the-octs
|
|
||||||
~& resp-header
|
|
||||||
~& "Proxied HTTP {<status-code:resp-header>}: {<thedata>}"
|
|
||||||
%+ give-simple-payload:app:server
|
|
||||||
original-eyre-id
|
|
||||||
:- %_(resp-header headers [['Content-type'^'application/json'] ~])
|
|
||||||
`the-octs
|
|
||||||
==
|
|
||||||
==
|
|
||||||
::
|
|
||||||
:: Each time Eyre pokes a request to us, it will subscribe for the response. We will just accept
|
|
||||||
:: those connections (wire = /http-response/[eyre-id]) and reject any others.
|
|
||||||
:: See: https://docs.urbit.org/system/kernel/eyre/reference/tasks#connect
|
|
||||||
++ on-watch
|
|
||||||
|= =path
|
|
||||||
^- (quip card _this)
|
|
||||||
?+ path (on-watch:default path)
|
|
||||||
[%http-response *]
|
|
||||||
`this
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ on-save on-save:default
|
|
||||||
++ on-load on-load:default
|
|
||||||
++ on-leave on-leave:default
|
|
||||||
++ on-peek on-peek:default
|
|
||||||
++ on-agent on-agent:default
|
|
||||||
++ on-fail on-fail:default
|
|
||||||
--
|
|
||||||
::
|
|
||||||
:: Helpers core
|
|
||||||
|%
|
|
||||||
:: Rewrites a path like "/apps/uniswap-proxy/v1/graphql" to "https://api.uniswap.org/v1/graphql".
|
|
||||||
:: `url-path` is a path, not a full URL!
|
|
||||||
++ rewrite-path
|
|
||||||
|= [url-path=@t]
|
|
||||||
%+ rash
|
|
||||||
url-path
|
|
||||||
:: Prepend the `upstream-api-url` base url and convert back to a cord
|
|
||||||
%+ cook
|
|
||||||
|= [a=tape]
|
|
||||||
(crip (weld upstream-api-url a))
|
|
||||||
:: Strip the base path
|
|
||||||
;~ pfix
|
|
||||||
(ifix [(just '/') (just '/')] (jest (crip (join '/' `(list @t)`base-url-path))))
|
|
||||||
(star prn)
|
|
||||||
==
|
|
||||||
::
|
|
||||||
:: Change the 'Origin' http header to "https://api.uniswap.org".
|
|
||||||
:: I don't know why this makes the request work, but it does.
|
|
||||||
:: Also drop the "x-forwarded-for" header for Red Horizon; otherwise this breaks it.
|
|
||||||
++ rewrite-headers
|
|
||||||
|= [headers=header-list:http]
|
|
||||||
^- header-list:http
|
|
||||||
=/ ret *header-list:http
|
|
||||||
|-
|
|
||||||
?~ headers
|
|
||||||
ret
|
|
||||||
%= $
|
|
||||||
ret ?+ (crip (cass (trip key:(head headers))))
|
|
||||||
::
|
|
||||||
:: Default: use the header
|
|
||||||
(snoc ret (head headers))
|
|
||||||
::
|
|
||||||
:: Drop "x-forwarded-for" header
|
|
||||||
%'x-forwarded-for'
|
|
||||||
ret
|
|
||||||
::
|
|
||||||
:: Drop the "cookie" header, which contains the Urbit auth token (!)
|
|
||||||
%'cookie'
|
|
||||||
ret
|
|
||||||
::
|
|
||||||
:: Rewrite "origin" header
|
|
||||||
%'origin'
|
|
||||||
(snoc ret ['origin' 'https://api.uniswap.org'])
|
|
||||||
==
|
|
||||||
headers +.headers
|
|
||||||
==
|
|
||||||
::
|
|
||||||
:: Manually construct a card that can be passed to iris, simulating a Uniswap graphql request.
|
|
||||||
:: Can be useful for testing purposes.
|
|
||||||
++ iris-request-card
|
|
||||||
::
|
|
||||||
:: The resulting card produces an HTTP request equivalent to the following cURL command:
|
|
||||||
::
|
|
||||||
:: curl 'https://api.uniswap.org/v1/graphql' \
|
|
||||||
:: -H 'authority: interface.gateway.uniswap.org' \
|
|
||||||
:: -H 'accept: */*' \
|
|
||||||
:: -H 'accept-language: en-US,en;q=0.7' \
|
|
||||||
:: -H 'content-type: application/json' \
|
|
||||||
:: -H 'origin: https://app.uniswap.org' \
|
|
||||||
:: -H 'referer: https://app.uniswap.org/' \
|
|
||||||
:: -H 'sec-ch-ua: "Not A(Brand";v="99", "Brave";v="121", "Chromium";v="121"' \
|
|
||||||
:: -H 'sec-ch-ua-mobile: ?0' \
|
|
||||||
:: -H 'sec-ch-ua-platform: "Linux"' \
|
|
||||||
:: -H 'sec-fetch-dest: empty' \
|
|
||||||
:: -H 'sec-fetch-mode: cors' \
|
|
||||||
:: -H 'sec-fetch-site: same-site' \
|
|
||||||
:: -H 'sec-gpc: 1' \
|
|
||||||
:: -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36' \
|
|
||||||
:: --data-raw $'{"operationName":"TokenSpotPrice","variables":{"address":null,"chain":"ETHEREUM"},"query":"query TokenSpotPrice($chain: Chain\u0021, $address: String = null) {\\n token(chain: $chain, address: $address) {\\n id\\n address\\n chain\\n name\\n symbol\\n project {\\n id\\n markets(currencies: [USD]) {\\n id\\n price {\\n id\\n value\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n __typename\\n }\\n}"}' \
|
|
||||||
:: --compressed
|
|
||||||
::
|
|
||||||
=/ the-request=request:http
|
|
||||||
:* %'POST' 'https://api.uniswap.org/v1/graphql'
|
|
||||||
:~ ['Accept-Language' 'en-US,en']
|
|
||||||
['Cache-Control' 'no-cache']
|
|
||||||
['Connection' 'keep-alive']
|
|
||||||
['Origin' 'http://localhost:8080']
|
|
||||||
['Pragma' 'no-cache']
|
|
||||||
['Referer' 'http://localhost:8080/']
|
|
||||||
['Sec-Fetch-Dest' 'empty']
|
|
||||||
['Sec-Fetch-Mode' 'cors']
|
|
||||||
['Sec-Fetch-Site' 'same-site']
|
|
||||||
['Sec-GPC' '1']
|
|
||||||
['User-Agent' 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36']
|
|
||||||
['accept' '*/*']
|
|
||||||
['content-type' 'application/json']
|
|
||||||
['sec-ch-ua' '"Not A(Brand";v="99", "Brave";v="121", "Chromium";v="121"']
|
|
||||||
['sec-ch-ua-mobile' '?0']
|
|
||||||
['sec-ch-ua-platform' '"Linux"']
|
|
||||||
==
|
|
||||||
:- ~ %- as-octs:mimes:html
|
|
||||||
'''
|
|
||||||
{"operationName":"TokenSpotPrice","variables":{"address":null,"chain":"ETHEREUM"},"query":"query TokenSpotPrice($chain: Chain\u0021, $address: String = null) {\n token(chain: $chain, address: $address) {\n id\n address\n chain\n name\n symbol\n project {\n id\n markets(currencies: [USD]) {\n id\n price {\n id\n value\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}"}
|
|
||||||
'''
|
|
||||||
==
|
|
||||||
:~
|
|
||||||
[%pass /response/1 %arvo %i %request the-request *outbound-config:iris]
|
|
||||||
==
|
|
||||||
--
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
:~ %proxy
|
|
||||||
==
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
:: dbug: agent wrapper for generic debugging tools
|
|
||||||
::
|
|
||||||
:: usage: %-(agent:dbug your-agent)
|
|
||||||
::
|
|
||||||
|%
|
|
||||||
+$ poke
|
|
||||||
$% [%bowl ~]
|
|
||||||
[%state grab=cord]
|
|
||||||
[%incoming =about]
|
|
||||||
[%outgoing =about]
|
|
||||||
==
|
|
||||||
::
|
|
||||||
+$ about
|
|
||||||
$@ ~
|
|
||||||
$% [%ship =ship]
|
|
||||||
[%path =path]
|
|
||||||
[%wire =wire]
|
|
||||||
[%term =term]
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ agent
|
|
||||||
|= =agent:gall
|
|
||||||
^- agent:gall
|
|
||||||
!.
|
|
||||||
|_ =bowl:gall
|
|
||||||
+* this .
|
|
||||||
ag ~(. agent bowl)
|
|
||||||
::
|
|
||||||
++ on-poke
|
|
||||||
|= [=mark =vase]
|
|
||||||
^- (quip card:agent:gall agent:gall)
|
|
||||||
?. ?=(%dbug mark)
|
|
||||||
=^ cards agent (on-poke:ag mark vase)
|
|
||||||
[cards this]
|
|
||||||
=/ dbug
|
|
||||||
!<(poke vase)
|
|
||||||
=; =tang
|
|
||||||
((%*(. slog pri 1) tang) [~ this])
|
|
||||||
?- -.dbug
|
|
||||||
%bowl [(sell !>(bowl))]~
|
|
||||||
::
|
|
||||||
%state
|
|
||||||
=? grab.dbug =('' grab.dbug) '-'
|
|
||||||
=; product=^vase
|
|
||||||
[(sell product)]~
|
|
||||||
=/ state=^vase
|
|
||||||
:: if the underlying app has implemented a /dbug/state scry endpoint,
|
|
||||||
:: use that vase in place of +on-save's.
|
|
||||||
::
|
|
||||||
=/ result=(each ^vase tang)
|
|
||||||
(mule |.(q:(need (need (on-peek:ag /x/dbug/state)))))
|
|
||||||
?:(?=(%& -.result) p.result on-save:ag)
|
|
||||||
%+ slap
|
|
||||||
(slop state !>([bowl=bowl ..zuse]))
|
|
||||||
(ream grab.dbug)
|
|
||||||
::
|
|
||||||
%incoming
|
|
||||||
=; =tang
|
|
||||||
?^ tang tang
|
|
||||||
[%leaf "no matching subscriptions"]~
|
|
||||||
%+ murn
|
|
||||||
%+ sort ~(tap by sup.bowl)
|
|
||||||
|= [[* a=[=ship =path]] [* b=[=ship =path]]]
|
|
||||||
(aor [path ship]:a [path ship]:b)
|
|
||||||
|= [=duct [=ship =path]]
|
|
||||||
^- (unit tank)
|
|
||||||
=; relevant=?
|
|
||||||
?. relevant ~
|
|
||||||
`>[path=path from=ship duct=duct]<
|
|
||||||
?: ?=(~ about.dbug) &
|
|
||||||
?- -.about.dbug
|
|
||||||
%ship =(ship ship.about.dbug)
|
|
||||||
%path ?=(^ (find path.about.dbug path))
|
|
||||||
%wire %+ lien duct
|
|
||||||
|=(=wire ?=(^ (find wire.about.dbug wire)))
|
|
||||||
%term !!
|
|
||||||
==
|
|
||||||
::
|
|
||||||
%outgoing
|
|
||||||
=; =tang
|
|
||||||
?^ tang tang
|
|
||||||
[%leaf "no matching subscriptions"]~
|
|
||||||
%+ murn
|
|
||||||
%+ sort ~(tap by wex.bowl)
|
|
||||||
|= [[[a=wire *] *] [[b=wire *] *]]
|
|
||||||
(aor a b)
|
|
||||||
|= [[=wire =ship =term] [acked=? =path]]
|
|
||||||
^- (unit tank)
|
|
||||||
=; relevant=?
|
|
||||||
?. relevant ~
|
|
||||||
`>[wire=wire agnt=[ship term] path=path ackd=acked]<
|
|
||||||
?: ?=(~ about.dbug) &
|
|
||||||
?- -.about.dbug
|
|
||||||
%ship =(ship ship.about.dbug)
|
|
||||||
%path ?=(^ (find path.about.dbug path))
|
|
||||||
%wire ?=(^ (find wire.about.dbug wire))
|
|
||||||
%term =(term term.about.dbug)
|
|
||||||
==
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ on-peek
|
|
||||||
|= =path
|
|
||||||
^- (unit (unit cage))
|
|
||||||
?. ?=([@ %dbug *] path)
|
|
||||||
(on-peek:ag path)
|
|
||||||
?+ path [~ ~]
|
|
||||||
[%u %dbug ~] ``noun+!>(&)
|
|
||||||
[%x %dbug %state ~] ``noun+!>(on-save:ag)
|
|
||||||
[%x %dbug %subscriptions ~] ``noun+!>([wex sup]:bowl)
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ on-init
|
|
||||||
^- (quip card:agent:gall agent:gall)
|
|
||||||
=^ cards agent on-init:ag
|
|
||||||
[cards this]
|
|
||||||
::
|
|
||||||
++ on-save on-save:ag
|
|
||||||
::
|
|
||||||
++ on-load
|
|
||||||
|= old-state=vase
|
|
||||||
^- (quip card:agent:gall agent:gall)
|
|
||||||
=^ cards agent (on-load:ag old-state)
|
|
||||||
[cards this]
|
|
||||||
::
|
|
||||||
++ on-watch
|
|
||||||
|= =path
|
|
||||||
^- (quip card:agent:gall agent:gall)
|
|
||||||
=^ cards agent (on-watch:ag path)
|
|
||||||
[cards this]
|
|
||||||
::
|
|
||||||
++ on-leave
|
|
||||||
|= =path
|
|
||||||
^- (quip card:agent:gall agent:gall)
|
|
||||||
=^ cards agent (on-leave:ag path)
|
|
||||||
[cards this]
|
|
||||||
::
|
|
||||||
++ on-agent
|
|
||||||
|= [=wire =sign:agent:gall]
|
|
||||||
^- (quip card:agent:gall agent:gall)
|
|
||||||
=^ cards agent (on-agent:ag wire sign)
|
|
||||||
[cards this]
|
|
||||||
::
|
|
||||||
++ on-arvo
|
|
||||||
|= [=wire =sign-arvo]
|
|
||||||
^- (quip card:agent:gall agent:gall)
|
|
||||||
=^ cards agent (on-arvo:ag wire sign-arvo)
|
|
||||||
[cards this]
|
|
||||||
::
|
|
||||||
++ on-fail
|
|
||||||
|= [=term =tang]
|
|
||||||
^- (quip card:agent:gall agent:gall)
|
|
||||||
=^ cards agent (on-fail:ag term tang)
|
|
||||||
[cards this]
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
|= [agent=agent:gall]
|
|
||||||
|_ =bowl:gall
|
|
||||||
++ on-init
|
|
||||||
`agent
|
|
||||||
::
|
|
||||||
++ on-save
|
|
||||||
!>(~)
|
|
||||||
::
|
|
||||||
++ on-load
|
|
||||||
|= old-state=vase
|
|
||||||
`agent
|
|
||||||
::
|
|
||||||
++ on-poke
|
|
||||||
|= =cage
|
|
||||||
~| "unexpected poke to {<dap.bowl>} with mark {<p.cage>}"
|
|
||||||
!!
|
|
||||||
::
|
|
||||||
++ on-watch
|
|
||||||
|= =path
|
|
||||||
~| "unexpected subscription to {<dap.bowl>} on path {<path>}"
|
|
||||||
!!
|
|
||||||
::
|
|
||||||
++ on-leave
|
|
||||||
|= path
|
|
||||||
`agent
|
|
||||||
::
|
|
||||||
++ on-peek
|
|
||||||
|= =path
|
|
||||||
~| "unexpected scry into {<dap.bowl>} on path {<path>}"
|
|
||||||
!!
|
|
||||||
::
|
|
||||||
++ on-agent
|
|
||||||
|= [=wire =sign:agent:gall]
|
|
||||||
^- (quip card:agent:gall _agent)
|
|
||||||
?- -.sign
|
|
||||||
%poke-ack
|
|
||||||
?~ p.sign
|
|
||||||
`agent
|
|
||||||
%- (slog leaf+"poke failed from {<dap.bowl>} on wire {<wire>}" u.p.sign)
|
|
||||||
`agent
|
|
||||||
::
|
|
||||||
%watch-ack
|
|
||||||
?~ p.sign
|
|
||||||
`agent
|
|
||||||
=/ =tank leaf+"subscribe failed from {<dap.bowl>} on wire {<wire>}"
|
|
||||||
%- (slog tank u.p.sign)
|
|
||||||
`agent
|
|
||||||
::
|
|
||||||
%kick `agent
|
|
||||||
%fact
|
|
||||||
~| "unexpected subscription update to {<dap.bowl>} on wire {<wire>}"
|
|
||||||
~| "with mark {<p.cage.sign>}"
|
|
||||||
!!
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ on-arvo
|
|
||||||
|= [=wire =sign-arvo]
|
|
||||||
~| "unexpected system response {<sign-arvo>} to {<dap.bowl>} on wire {<wire>}"
|
|
||||||
!!
|
|
||||||
::
|
|
||||||
++ on-fail
|
|
||||||
|= [=term =tang]
|
|
||||||
%- (slog leaf+"error in {<dap.bowl>}" >term< tang)
|
|
||||||
`agent
|
|
||||||
--
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
=, eyre
|
|
||||||
|%
|
|
||||||
+$ request-line
|
|
||||||
$: [ext=(unit @ta) site=(list @t)]
|
|
||||||
args=(list [key=@t value=@t])
|
|
||||||
==
|
|
||||||
:: +parse-request-line: take a cord and parse out a url
|
|
||||||
::
|
|
||||||
++ parse-request-line
|
|
||||||
|= url=@t
|
|
||||||
^- request-line
|
|
||||||
(fall (rush url ;~(plug apat:de-purl:html yque:de-purl:html)) [[~ ~] ~])
|
|
||||||
::
|
|
||||||
++ manx-to-octs
|
|
||||||
|= man=manx
|
|
||||||
^- octs
|
|
||||||
(as-octt:mimes:html (en-xml:html man))
|
|
||||||
::
|
|
||||||
++ json-to-octs
|
|
||||||
|= jon=json
|
|
||||||
^- octs
|
|
||||||
(as-octs:mimes:html (en:json:html jon))
|
|
||||||
::
|
|
||||||
++ app
|
|
||||||
|%
|
|
||||||
::
|
|
||||||
:: +require-authorization:
|
|
||||||
:: redirect to the login page when unauthenticated
|
|
||||||
:: otherwise call handler on inbound request
|
|
||||||
::
|
|
||||||
++ require-authorization
|
|
||||||
|= $: =inbound-request:eyre
|
|
||||||
handler=$-(inbound-request:eyre simple-payload:http)
|
|
||||||
==
|
|
||||||
^- simple-payload:http
|
|
||||||
::
|
|
||||||
?: authenticated.inbound-request
|
|
||||||
~! this
|
|
||||||
~! +:*handler
|
|
||||||
(handler inbound-request)
|
|
||||||
::
|
|
||||||
=- [[307 ['location' -]~] ~]
|
|
||||||
%^ cat 3
|
|
||||||
'/~/login?redirect='
|
|
||||||
url.request.inbound-request
|
|
||||||
::
|
|
||||||
:: +require-authorization-simple:
|
|
||||||
:: redirect to the login page when unauthenticated
|
|
||||||
:: otherwise pass through simple-paylod
|
|
||||||
::
|
|
||||||
++ require-authorization-simple
|
|
||||||
|= [=inbound-request:eyre =simple-payload:http]
|
|
||||||
^- simple-payload:http
|
|
||||||
::
|
|
||||||
?: authenticated.inbound-request
|
|
||||||
~! this
|
|
||||||
simple-payload
|
|
||||||
::
|
|
||||||
=- [[307 ['location' -]~] ~]
|
|
||||||
%^ cat 3
|
|
||||||
'/~/login?redirect='
|
|
||||||
url.request.inbound-request
|
|
||||||
::
|
|
||||||
++ give-simple-payload
|
|
||||||
|= [eyre-id=@ta =simple-payload:http]
|
|
||||||
^- (list card:agent:gall)
|
|
||||||
=/ header-cage
|
|
||||||
[%http-response-header !>(response-header.simple-payload)]
|
|
||||||
=/ data-cage
|
|
||||||
[%http-response-data !>(data.simple-payload)]
|
|
||||||
:~ [%give %fact ~[/http-response/[eyre-id]] header-cage]
|
|
||||||
[%give %fact ~[/http-response/[eyre-id]] data-cage]
|
|
||||||
[%give %kick ~[/http-response/[eyre-id]] ~]
|
|
||||||
==
|
|
||||||
--
|
|
||||||
++ gen
|
|
||||||
|%
|
|
||||||
::
|
|
||||||
++ max-1-da ['cache-control' 'max-age=86400']
|
|
||||||
++ max-1-wk ['cache-control' 'max-age=604800']
|
|
||||||
::
|
|
||||||
++ html-response
|
|
||||||
=| cache=?
|
|
||||||
|= =octs
|
|
||||||
^- simple-payload:http
|
|
||||||
:_ `octs
|
|
||||||
[200 [['content-type' 'text/html'] ?:(cache [max-1-wk ~] ~)]]
|
|
||||||
::
|
|
||||||
++ css-response
|
|
||||||
=| cache=?
|
|
||||||
|= =octs
|
|
||||||
^- simple-payload:http
|
|
||||||
:_ `octs
|
|
||||||
[200 [['content-type' 'text/css'] ?:(cache [max-1-wk ~] ~)]]
|
|
||||||
::
|
|
||||||
++ js-response
|
|
||||||
=| cache=?
|
|
||||||
|= =octs
|
|
||||||
^- simple-payload:http
|
|
||||||
:_ `octs
|
|
||||||
[200 [['content-type' 'text/javascript'] ?:(cache [max-1-wk ~] ~)]]
|
|
||||||
::
|
|
||||||
++ png-response
|
|
||||||
=| cache=?
|
|
||||||
|= =octs
|
|
||||||
^- simple-payload:http
|
|
||||||
:_ `octs
|
|
||||||
[200 [['content-type' 'image/png'] ?:(cache [max-1-wk ~] ~)]]
|
|
||||||
::
|
|
||||||
++ svg-response
|
|
||||||
=| cache=?
|
|
||||||
|= =octs
|
|
||||||
^- simple-payload:http
|
|
||||||
:_ `octs
|
|
||||||
[200 [['content-type' 'image/svg+xml'] ?:(cache [max-1-wk ~] ~)]]
|
|
||||||
::
|
|
||||||
++ ico-response
|
|
||||||
|= =octs
|
|
||||||
^- simple-payload:http
|
|
||||||
[[200 [['content-type' 'image/x-icon'] max-1-wk ~]] `octs]
|
|
||||||
::
|
|
||||||
++ woff2-response
|
|
||||||
=| cache=?
|
|
||||||
|= =octs
|
|
||||||
^- simple-payload:http
|
|
||||||
[[200 [['content-type' 'font/woff2'] max-1-wk ~]] `octs]
|
|
||||||
::
|
|
||||||
++ json-response
|
|
||||||
=| cache=_|
|
|
||||||
|= =json
|
|
||||||
^- simple-payload:http
|
|
||||||
:_ `(json-to-octs json)
|
|
||||||
[200 [['content-type' 'application/json'] ?:(cache [max-1-da ~] ~)]]
|
|
||||||
::
|
|
||||||
++ manx-response
|
|
||||||
=| cache=_|
|
|
||||||
|= man=manx
|
|
||||||
^- simple-payload:http
|
|
||||||
:_ `(manx-to-octs man)
|
|
||||||
[200 [['content-type' 'text/html'] ?:(cache [max-1-da ~] ~)]]
|
|
||||||
::
|
|
||||||
++ not-found
|
|
||||||
^- simple-payload:http
|
|
||||||
[[404 ~] ~]
|
|
||||||
::
|
|
||||||
++ login-redirect
|
|
||||||
|= =request:http
|
|
||||||
^- simple-payload:http
|
|
||||||
=- [[307 ['location' -]~] ~]
|
|
||||||
%^ cat 3
|
|
||||||
'/~/login?redirect='
|
|
||||||
url.request
|
|
||||||
::
|
|
||||||
++ redirect
|
|
||||||
|= redirect=cord
|
|
||||||
^- simple-payload:http
|
|
||||||
[[307 ['location' redirect]~] ~]
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
|_ 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
|
|
||||||
--
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
:::: /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
|
|
||||||
--
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
|_ 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
|
|
||||||
--
|
|
||||||
@@ -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
|
||||||
|
--
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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 !!)
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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 !!))
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|_ dat=octs
|
||||||
|
++ grow
|
||||||
|
|%
|
||||||
|
++ mime [/font/ttf dat]
|
||||||
|
--
|
||||||
|
++ grab
|
||||||
|
|%
|
||||||
|
++ mime |=([=mite =octs] octs)
|
||||||
|
++ noun octs
|
||||||
|
--
|
||||||
|
++ grad %mime
|
||||||
|
--
|
||||||
@@ -1,274 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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
|
|
||||||
==
|
|
||||||
==
|
|
||||||
==
|
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|_ dat=octs
|
||||||
|
++ grow
|
||||||
|
|%
|
||||||
|
++ mime [/font/woff dat]
|
||||||
|
--
|
||||||
|
++ grab
|
||||||
|
|%
|
||||||
|
++ mime |=([=mite =octs] octs)
|
||||||
|
++ noun octs
|
||||||
|
--
|
||||||
|
++ grad %mime
|
||||||
|
--
|
||||||
@@ -17,10 +17,16 @@ if [ -d ${app_desk_dir} ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
app_files=/app-builds/${CERC_URBIT_APP}/urbit-files
|
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}"
|
||||||
|
|
||||||
# Loop until the app's build appears
|
# Loop until the app's build appears
|
||||||
while [ ! -d "${app_files}/build" ]; do
|
while [ ! -d ${app_build} ]; do
|
||||||
echo "${CERC_URBIT_APP} app build not found, retrying in 5s..."
|
echo "${CERC_URBIT_APP} app build not found, retrying in 5s..."
|
||||||
sleep 5
|
sleep 5
|
||||||
done
|
done
|
||||||
@@ -44,15 +50,14 @@ hood () {
|
|||||||
hood "merge %${CERC_URBIT_APP} our %landscape"
|
hood "merge %${CERC_URBIT_APP} our %landscape"
|
||||||
hood "mount %${CERC_URBIT_APP}"
|
hood "mount %${CERC_URBIT_APP}"
|
||||||
|
|
||||||
rm "${app_desk_dir}/desk.bill" # Don't install the landscape apps
|
|
||||||
rm "${app_desk_dir}/desk.ship"
|
|
||||||
|
|
||||||
|
|
||||||
echo "Copying files from ${app_files}"
|
|
||||||
|
|
||||||
# Copy over build to desk data dir
|
# Copy over build to desk data dir
|
||||||
cp -r ${app_files}/* ${app_desk_dir}
|
cp -r ${app_build} ${app_desk_dir}
|
||||||
rm ${app_desk_dir}/desk.docket-0 # Remove until we have a valid glob path; it's added back again below
|
|
||||||
|
# Copy over the additional mark files
|
||||||
|
cp ${app_mark_files}/* ${app_desk_dir}/mar/
|
||||||
|
|
||||||
|
rm "${app_desk_dir}/desk.bill"
|
||||||
|
rm "${app_desk_dir}/desk.ship"
|
||||||
|
|
||||||
# Commit changes and create a glob
|
# Commit changes and create a glob
|
||||||
hood "commit %${CERC_URBIT_APP}"
|
hood "commit %${CERC_URBIT_APP}"
|
||||||
@@ -94,8 +99,8 @@ while true; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Replace the docket file for app
|
# Replace the docket file for app
|
||||||
# Substitute the glob URL and hash
|
# Substitue the glob URL and hash
|
||||||
cp ${app_files}/desk.docket-0 ${app_desk_dir}/
|
cp ${app_docket_file} ${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
|
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
|
# Commit changes and install the app
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
#!/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/
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
:~ 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'
|
|
||||||
==
|
|
||||||
@@ -1,223 +0,0 @@
|
|||||||
/- *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
|
|
||||||
==
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
|_ 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
|
|
||||||
--
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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
|
|
||||||
--
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/+ 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
|
|
||||||
--
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
:::: /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
|
|
||||||
--
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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
|
|
||||||
--
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
|_ dat=@
|
|
||||||
++ grow
|
|
||||||
|%
|
|
||||||
++ mime [/image/x-icon (as-octs:mimes:html dat)]
|
|
||||||
--
|
|
||||||
++ grab
|
|
||||||
|%
|
|
||||||
++ mime |=([p=mite q=octs] q.q)
|
|
||||||
++ noun @
|
|
||||||
--
|
|
||||||
++ grad %mime
|
|
||||||
--
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
|_ dat=@
|
|
||||||
++ grow
|
|
||||||
|%
|
|
||||||
++ mime [/image/jpeg (as-octs:mimes:html dat)]
|
|
||||||
--
|
|
||||||
++ grab
|
|
||||||
|%
|
|
||||||
++ mime |=([p=mite q=octs] q.q)
|
|
||||||
++ noun @
|
|
||||||
--
|
|
||||||
++ grad %mime
|
|
||||||
--
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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
|
|
||||||
--
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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
|
|
||||||
--
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
::
|
|
||||||
/- *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)
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
|_ 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
|
|
||||||
--
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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 !!)
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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 !!))
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
|_ dat=@
|
|
||||||
++ grow
|
|
||||||
|%
|
|
||||||
++ mime [/image/png (as-octs:mimes:html dat)]
|
|
||||||
--
|
|
||||||
++ grab
|
|
||||||
|%
|
|
||||||
++ mime |=([p=mite q=octs] q.q)
|
|
||||||
++ noun @
|
|
||||||
--
|
|
||||||
++ grad %mime
|
|
||||||
--
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
|_ 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)))
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,274 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /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
|
|
||||||
==
|
|
||||||
==
|
|
||||||
==
|
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
|_ dat=octs
|
|
||||||
++ grow
|
|
||||||
|%
|
|
||||||
++ mime [/font/woff dat]
|
|
||||||
--
|
|
||||||
++ grab
|
|
||||||
|%
|
|
||||||
++ mime |=([=mite =octs] octs)
|
|
||||||
++ noun octs
|
|
||||||
--
|
|
||||||
++ grad %mime
|
|
||||||
--
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
|_ dat=octs
|
|
||||||
++ grow
|
|
||||||
|%
|
|
||||||
++ mime [/font/woff2 dat]
|
|
||||||
--
|
|
||||||
++ grab
|
|
||||||
|%
|
|
||||||
++ mime |=([=mite =octs] octs)
|
|
||||||
++ noun octs
|
|
||||||
--
|
|
||||||
++ grad %mime
|
|
||||||
--
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
::
|
|
||||||
:::: /hoon/xhtml/mar
|
|
||||||
::
|
|
||||||
/= xhtml /mar/html
|
|
||||||
xhtml
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
|%
|
|
||||||
::
|
|
||||||
+$ 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]
|
|
||||||
==
|
|
||||||
--
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
[%zuse 412]
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -u
|
|
||||||
|
|
||||||
echo "Using ETH RPC endpoint ${CERC_ETH_RPC_ENDPOINT}"
|
|
||||||
|
|
||||||
# Read in the config template TOML file and modify it
|
|
||||||
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
|
|
||||||
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
|
|
||||||
sed -E "s|REPLACE_WITH_CERC_ETH_RPC_ENDPOINT|${CERC_ETH_RPC_ENDPOINT}| ")
|
|
||||||
|
|
||||||
# Write the modified content to a new file
|
|
||||||
echo "$WATCHER_CONFIG" > environments/local.toml
|
|
||||||
|
|
||||||
echo "Running job-runner..."
|
|
||||||
DEBUG=vulcanize:* exec node --enable-source-maps dist/job-runner.js
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -u
|
|
||||||
|
|
||||||
echo "Using ETH RPC endpoint ${CERC_ETH_RPC_ENDPOINT}"
|
|
||||||
|
|
||||||
# Read in the config template TOML file and modify it
|
|
||||||
WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml)
|
|
||||||
WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
|
|
||||||
sed -E "s|REPLACE_WITH_CERC_ETH_RPC_ENDPOINT|${CERC_ETH_RPC_ENDPOINT}| ")
|
|
||||||
|
|
||||||
# Write the modified content to a new file
|
|
||||||
echo "$WATCHER_CONFIG" > environments/local.toml
|
|
||||||
|
|
||||||
echo "Running server..."
|
|
||||||
DEBUG=vulcanize:* exec node --enable-source-maps dist/server.js
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
[server]
|
|
||||||
host = "0.0.0.0"
|
|
||||||
port = 3008
|
|
||||||
kind = "active"
|
|
||||||
gqlPath = "/"
|
|
||||||
|
|
||||||
# Checkpointing state.
|
|
||||||
checkpointing = true
|
|
||||||
|
|
||||||
# Checkpoint interval in number of blocks.
|
|
||||||
checkpointInterval = 2000
|
|
||||||
|
|
||||||
# Enable state creation
|
|
||||||
# CAUTION: Disable only if state creation is not desired or can be filled subsequently
|
|
||||||
enableState = false
|
|
||||||
|
|
||||||
subgraphPath = "./subgraph-build"
|
|
||||||
|
|
||||||
# Interval to restart wasm instance periodically
|
|
||||||
wasmRestartBlocksInterval = 20
|
|
||||||
|
|
||||||
# Interval in number of blocks at which to clear entities cache.
|
|
||||||
clearEntitiesCacheInterval = 1000
|
|
||||||
|
|
||||||
# Max block range for which to return events in eventsInRange GQL query.
|
|
||||||
# Use -1 for skipping check on block range.
|
|
||||||
maxEventsBlockRange = 1000
|
|
||||||
|
|
||||||
# Flag to specify whether RPC endpoint supports block hash as block tag parameter
|
|
||||||
rpcSupportsBlockHashParam = false
|
|
||||||
|
|
||||||
# GQL cache settings
|
|
||||||
[server.gqlCache]
|
|
||||||
enabled = true
|
|
||||||
|
|
||||||
# Max in-memory cache size (in bytes) (default 8 MB)
|
|
||||||
# maxCacheSize
|
|
||||||
|
|
||||||
# GQL cache-control max-age settings (in seconds)
|
|
||||||
maxAge = 15
|
|
||||||
timeTravelMaxAge = 86400 # 1 day
|
|
||||||
|
|
||||||
[metrics]
|
|
||||||
host = "0.0.0.0"
|
|
||||||
port = 9000
|
|
||||||
[metrics.gql]
|
|
||||||
port = 9001
|
|
||||||
|
|
||||||
[database]
|
|
||||||
type = "postgres"
|
|
||||||
host = "ajna-watcher-db"
|
|
||||||
port = 5432
|
|
||||||
database = "ajna-watcher"
|
|
||||||
username = "vdbm"
|
|
||||||
password = "password"
|
|
||||||
synchronize = true
|
|
||||||
logging = false
|
|
||||||
|
|
||||||
[upstream]
|
|
||||||
[upstream.ethServer]
|
|
||||||
rpcProviderEndpoint = "REPLACE_WITH_CERC_ETH_RPC_ENDPOINT"
|
|
||||||
|
|
||||||
# Boolean flag to specify if rpc-eth-client should be used for RPC endpoint instead of ipld-eth-client (ipld-eth-server GQL client)
|
|
||||||
rpcClient = true
|
|
||||||
|
|
||||||
# Boolean flag to specify if rpcProviderEndpoint is an FEVM RPC endpoint
|
|
||||||
isFEVM = true
|
|
||||||
|
|
||||||
# Boolean flag to filter event logs by contracts
|
|
||||||
filterLogsByAddresses = true
|
|
||||||
# Boolean flag to filter event logs by topics
|
|
||||||
filterLogsByTopics = true
|
|
||||||
|
|
||||||
[upstream.cache]
|
|
||||||
name = "requests"
|
|
||||||
enabled = false
|
|
||||||
deleteOnStart = false
|
|
||||||
|
|
||||||
[jobQueue]
|
|
||||||
dbConnectionString = "postgres://vdbm:password@ajna-watcher-db/ajna-watcher-job-queue"
|
|
||||||
maxCompletionLagInSecs = 300
|
|
||||||
jobDelayInMilliSecs = 100
|
|
||||||
eventsInBatch = 50
|
|
||||||
subgraphEventsOrder = true
|
|
||||||
# Filecoin block time: https://docs.filecoin.io/basics/the-blockchain/blocks-and-tipsets#blocktime
|
|
||||||
blockDelayInMilliSecs = 30000
|
|
||||||
|
|
||||||
# Boolean to switch between modes of processing events when starting the server.
|
|
||||||
# Setting to true will fetch filtered events and required blocks in a range of blocks and then process them.
|
|
||||||
# Setting to false will fetch blocks consecutively with its events and then process them (Behaviour is followed in realtime processing near head).
|
|
||||||
useBlockRanges = true
|
|
||||||
|
|
||||||
# Block range in which logs are fetched during historical blocks processing
|
|
||||||
historicalLogsBlockRange = 2000
|
|
||||||
|
|
||||||
# Max block range of historical processing after which it waits for completion of events processing
|
|
||||||
# If set to -1 historical processing does not wait for events processing and completes till latest canonical block
|
|
||||||
historicalMaxFetchAhead = 10000
|
|
||||||
@@ -11,14 +11,8 @@ CERC_CONTAINER_BUILD_DOCKERFILE=${CERC_CONTAINER_BUILD_DOCKERFILE:-$SCRIPT_DIR/D
|
|||||||
CERC_CONTAINER_BUILD_TAG=${CERC_CONTAINER_BUILD_TAG:-cerc/nextjs-base:local}
|
CERC_CONTAINER_BUILD_TAG=${CERC_CONTAINER_BUILD_TAG:-cerc/nextjs-base:local}
|
||||||
|
|
||||||
docker build -t $CERC_CONTAINER_BUILD_TAG ${build_command_args} -f $CERC_CONTAINER_BUILD_DOCKERFILE $CERC_CONTAINER_BUILD_WORK_DIR
|
docker build -t $CERC_CONTAINER_BUILD_TAG ${build_command_args} -f $CERC_CONTAINER_BUILD_DOCKERFILE $CERC_CONTAINER_BUILD_WORK_DIR
|
||||||
rc=$?
|
|
||||||
|
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $? -eq 0 ] && [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/nextjs-base:local" ]; then
|
||||||
echo "BUILD FAILED" 1>&2
|
|
||||||
exit $rc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/nextjs-base:local" ]; then
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
FROM node:18.17.1-alpine3.18
|
|
||||||
|
|
||||||
RUN apk --update --no-cache add git python3 alpine-sdk bash curl jq
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN echo "Installing dependencies and building ajna-watcher-ts" && \
|
|
||||||
yarn && yarn build
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Build cerc/watcher-ajna
|
|
||||||
|
|
||||||
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/watcher-ajna:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/ajna-watcher-ts
|
|
||||||
@@ -11,14 +11,8 @@ CERC_CONTAINER_BUILD_DOCKERFILE=${CERC_CONTAINER_BUILD_DOCKERFILE:-$SCRIPT_DIR/D
|
|||||||
CERC_CONTAINER_BUILD_TAG=${CERC_CONTAINER_BUILD_TAG:-cerc/webapp-base:local}
|
CERC_CONTAINER_BUILD_TAG=${CERC_CONTAINER_BUILD_TAG:-cerc/webapp-base:local}
|
||||||
|
|
||||||
docker build -t $CERC_CONTAINER_BUILD_TAG ${build_command_args} -f $CERC_CONTAINER_BUILD_DOCKERFILE $CERC_CONTAINER_BUILD_WORK_DIR
|
docker build -t $CERC_CONTAINER_BUILD_TAG ${build_command_args} -f $CERC_CONTAINER_BUILD_DOCKERFILE $CERC_CONTAINER_BUILD_WORK_DIR
|
||||||
rc=$?
|
|
||||||
|
|
||||||
if [ $rc -ne 0 ]; then
|
if [ $? -eq 0 ] && [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/webapp-base:local" ]; then
|
||||||
echo "BUILD FAILED" 1>&2
|
|
||||||
exit $rc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CERC_CONTAINER_BUILD_TAG" != "cerc/webapp-base:local" ]; then
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|||||||
@@ -60,4 +60,3 @@ cerc/nitro-rpc-client
|
|||||||
cerc/watcher-merkl-sushiswap-v3
|
cerc/watcher-merkl-sushiswap-v3
|
||||||
cerc/watcher-sushiswap-v3
|
cerc/watcher-sushiswap-v3
|
||||||
cerc/uniswap-interface
|
cerc/uniswap-interface
|
||||||
cerc/vega-interface
|
|
||||||
|
|||||||
@@ -45,4 +45,3 @@ ponder
|
|||||||
ipld-eth-server-payments
|
ipld-eth-server-payments
|
||||||
merkl-sushiswap-v3
|
merkl-sushiswap-v3
|
||||||
sushiswap-v3
|
sushiswap-v3
|
||||||
vega-interface
|
|
||||||
|
|||||||
@@ -50,4 +50,3 @@ github.com/cerc-io/ponder
|
|||||||
github.com/cerc-io/merkl-sushiswap-v3-watcher-ts
|
github.com/cerc-io/merkl-sushiswap-v3-watcher-ts
|
||||||
github.com/cerc-io/sushiswap-v3-watcher-ts
|
github.com/cerc-io/sushiswap-v3-watcher-ts
|
||||||
github.com/cerc-io/uniswap-interface
|
github.com/cerc-io/uniswap-interface
|
||||||
git.vdb.to/LaconicNetwork/vega-frontend-monorepo
|
|
||||||
|
|||||||
@@ -1,118 +0,0 @@
|
|||||||
# Ajna Watcher
|
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
Clone required repositories:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack ajna setup-repositories --git-ssh --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
Build the container images:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack ajna build-containers
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deploy
|
|
||||||
|
|
||||||
Create a spec file for the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack ajna deploy init --output ajna-spec.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ports
|
|
||||||
|
|
||||||
Edit `network` in the spec file to map container ports to host ports as required:
|
|
||||||
|
|
||||||
```yml
|
|
||||||
...
|
|
||||||
network:
|
|
||||||
ports:
|
|
||||||
ajna-watcher-db:
|
|
||||||
- 15432:5432
|
|
||||||
ajna-watcher-job-runner:
|
|
||||||
- 9000:9000
|
|
||||||
ajna-watcher-server:
|
|
||||||
- 3008:3008
|
|
||||||
- 9001:9001
|
|
||||||
```
|
|
||||||
|
|
||||||
### Create a deployment
|
|
||||||
|
|
||||||
Create a deployment from the spec file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack ajna deploy create --spec-file ajna-spec.yml --deployment-dir ajna-deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuration
|
|
||||||
|
|
||||||
Inside deployment directory, open the `config.env` file and set following env variables:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# External Filecoin (ETH RPC) endpoint to point the watcher to
|
|
||||||
CERC_ETH_RPC_ENDPOINT=https://example-lotus-endpoint/rpc/v1
|
|
||||||
```
|
|
||||||
|
|
||||||
### Start the deployment
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir ajna-deployment start
|
|
||||||
```
|
|
||||||
|
|
||||||
* To list down and monitor the running containers:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# With status
|
|
||||||
docker ps -a
|
|
||||||
|
|
||||||
# Check logs for a container
|
|
||||||
docker logs -f <CONTAINER_ID>
|
|
||||||
```
|
|
||||||
|
|
||||||
* Open the GQL playground at <http://localhost:3008/graphql>
|
|
||||||
|
|
||||||
```graphql
|
|
||||||
# Example query
|
|
||||||
query {
|
|
||||||
_meta {
|
|
||||||
block {
|
|
||||||
hash
|
|
||||||
number
|
|
||||||
timestamp
|
|
||||||
}
|
|
||||||
deployment
|
|
||||||
hasIndexingErrors
|
|
||||||
}
|
|
||||||
|
|
||||||
accounts {
|
|
||||||
id
|
|
||||||
txCount
|
|
||||||
tokensDelegated
|
|
||||||
rewardsClaimed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Clean up
|
|
||||||
|
|
||||||
Stop all the ajna services running in background:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Only stop the docker containers
|
|
||||||
laconic-so deployment --dir ajna-deployment stop
|
|
||||||
|
|
||||||
# Run 'start' to restart the deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
To stop all the ajna services and also delete data:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Stop the docker containers
|
|
||||||
laconic-so deployment --dir ajna-deployment stop --delete-volumes
|
|
||||||
|
|
||||||
# Remove deployment directory (deployment will have to be recreated for a re-run)
|
|
||||||
rm -r ajna-deployment
|
|
||||||
```
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
version: "1.0"
|
|
||||||
name: ajna
|
|
||||||
description: "Ajna watcher stack"
|
|
||||||
repos:
|
|
||||||
- git.vdb.to/cerc-io/ajna-watcher-ts@v0.1.1
|
|
||||||
containers:
|
|
||||||
- cerc/watcher-ajna
|
|
||||||
pods:
|
|
||||||
- watcher-ajna
|
|
||||||
@@ -16,55 +16,26 @@ laconic-so --stack merkl-sushiswap-v3 build-containers
|
|||||||
|
|
||||||
## Deploy
|
## Deploy
|
||||||
|
|
||||||
Create a spec file for the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack merkl-sushiswap-v3 deploy init --output merkl-sushiswap-v3-spec.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ports
|
|
||||||
|
|
||||||
Edit `network` in the spec file to map container ports to host ports as required:
|
|
||||||
|
|
||||||
```
|
|
||||||
...
|
|
||||||
network:
|
|
||||||
ports:
|
|
||||||
merkl-sushiswap-v3-watcher-db:
|
|
||||||
- '5432'
|
|
||||||
merkl-sushiswap-v3-watcher-job-runner:
|
|
||||||
- 9002:9000
|
|
||||||
merkl-sushiswap-v3-watcher-server:
|
|
||||||
- 127.0.0.1:3007:3008
|
|
||||||
- 9003:9001
|
|
||||||
```
|
|
||||||
|
|
||||||
### Create a deployment
|
|
||||||
|
|
||||||
Create a deployment from the spec file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack merkl-sushiswap-v3 deploy create --spec-file merkl-sushiswap-v3-spec.yml --deployment-dir merkl-sushiswap-v3-deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
Inside deployment directory, open the `config.env` file and set following env variables:
|
Create and update an env file to be used in the next step:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# External Filecoin (ETH RPC) endpoint to point the watcher
|
||||||
|
CERC_ETH_RPC_ENDPOINT=
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deploy the stack
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# External Filecoin (ETH RPC) endpoint to point the watcher to
|
laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 --env-file <PATH_TO_ENV_FILE> up
|
||||||
CERC_ETH_RPC_ENDPOINT=https://example-lotus-endpoint/rpc/v1
|
|
||||||
```
|
|
||||||
|
|
||||||
### Start the deployment
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir merkl-sushiswap-v3-deployment start
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* To list down and monitor the running containers:
|
* To list down and monitor the running containers:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 ps
|
||||||
|
|
||||||
# With status
|
# With status
|
||||||
docker ps -a
|
docker ps -a
|
||||||
|
|
||||||
@@ -75,7 +46,6 @@ laconic-so deployment --dir merkl-sushiswap-v3-deployment start
|
|||||||
* Open the GQL playground at http://localhost:3007/graphql
|
* Open the GQL playground at http://localhost:3007/graphql
|
||||||
|
|
||||||
```graphql
|
```graphql
|
||||||
# Example query
|
|
||||||
{
|
{
|
||||||
_meta {
|
_meta {
|
||||||
block {
|
block {
|
||||||
@@ -94,21 +64,18 @@ laconic-so deployment --dir merkl-sushiswap-v3-deployment start
|
|||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
|
|
||||||
Stop all the merkl-sushiswap-v3 services running in background:
|
Stop all the services running in background:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Only stop the docker containers
|
laconic-so --stack merkl-sushiswap-v3 deploy --cluster merkl_sushiswap_v3 down
|
||||||
laconic-so deployment --dir merkl-sushiswap-v3-deployment stop
|
|
||||||
|
|
||||||
# Run 'start' to restart the deployment
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To stop all the merkl-sushiswap-v3 services and also delete data:
|
Clear volumes created by this stack:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Stop the docker containers
|
# List all relevant volumes
|
||||||
laconic-so deployment --dir merkl-sushiswap-v3-deployment stop --delete-volumes
|
docker volume ls -q --filter "name=merkl_sushiswap_v3"
|
||||||
|
|
||||||
# Remove deployment directory (deployment will have to be recreated for a re-run)
|
# Remove all the listed volumes
|
||||||
rm -r merkl-sushiswap-v3-deployment
|
docker volume rm $(docker volume ls -q --filter "name=merkl_sushiswap_v3")
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: "1.0"
|
|||||||
name: merkl-sushiswap-v3
|
name: merkl-sushiswap-v3
|
||||||
description: "SushiSwap v3 watcher stack"
|
description: "SushiSwap v3 watcher stack"
|
||||||
repos:
|
repos:
|
||||||
- github.com/cerc-io/merkl-sushiswap-v3-watcher-ts@v0.1.7
|
- github.com/cerc-io/merkl-sushiswap-v3-watcher-ts@v0.1.6
|
||||||
containers:
|
containers:
|
||||||
- cerc/watcher-merkl-sushiswap-v3
|
- cerc/watcher-merkl-sushiswap-v3
|
||||||
pods:
|
pods:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
version: "0.1"
|
version: "0.1"
|
||||||
name: monitoring
|
name: monitoring
|
||||||
repos:
|
repos:
|
||||||
- github.com/cerc-io/watcher-ts@v0.2.81
|
- github.com/cerc-io/watcher-ts@v0.2.79
|
||||||
containers:
|
containers:
|
||||||
- cerc/watcher-ts
|
- cerc/watcher-ts
|
||||||
pods:
|
pods:
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ ports:
|
|||||||
Create deployment:
|
Create deployment:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack sushiswap-subgraph deploy create --spec-file sushiswap-subgraph-spec.yml --deployment-dir sushiswap-subgraph-deployment
|
laconic-so deploy create --spec-file sushiswap-subgraph-spec.yml --deployment-dir sushiswap-subgraph-deployment
|
||||||
```
|
```
|
||||||
|
|
||||||
## Start the stack
|
## Start the stack
|
||||||
|
|||||||
@@ -16,55 +16,26 @@ laconic-so --stack sushiswap-v3 build-containers
|
|||||||
|
|
||||||
## Deploy
|
## Deploy
|
||||||
|
|
||||||
Create a spec file for the deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack sushiswap-v3 deploy init --output sushiswap-v3-spec.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ports
|
|
||||||
|
|
||||||
Edit `network` in the spec file to map container ports to host ports as required:
|
|
||||||
|
|
||||||
```
|
|
||||||
...
|
|
||||||
network:
|
|
||||||
ports:
|
|
||||||
sushiswap-v3-watcher-db:
|
|
||||||
- '5432'
|
|
||||||
sushiswap-v3-watcher-job-runner:
|
|
||||||
- 9000:9000
|
|
||||||
sushiswap-v3-watcher-server:
|
|
||||||
- 127.0.0.1:3008:3008
|
|
||||||
- 9001:9001
|
|
||||||
```
|
|
||||||
|
|
||||||
### Create a deployment
|
|
||||||
|
|
||||||
Create a deployment from the spec file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so --stack sushiswap-v3 deploy create --spec-file sushiswap-v3-spec.yml --deployment-dir sushiswap-v3-deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
Inside deployment directory, open the `config.env` file and set following env variables:
|
Create and update an env file to be used in the next step:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# External Filecoin (ETH RPC) endpoint to point the watcher
|
||||||
|
CERC_ETH_RPC_ENDPOINT=
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deploy the stack
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# External Filecoin (ETH RPC) endpoint to point the watcher to
|
laconic-so --stack sushiswap-v3 deploy --cluster sushiswap_v3 --env-file <PATH_TO_ENV_FILE> up
|
||||||
CERC_ETH_RPC_ENDPOINT=https://example-lotus-endpoint/rpc/v1
|
|
||||||
```
|
|
||||||
|
|
||||||
### Start the deployment
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir sushiswap-v3-deployment start
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* To list down and monitor the running containers:
|
* To list down and monitor the running containers:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
laconic-so --stack sushiswap-v3 deploy --cluster sushiswap_v3 ps
|
||||||
|
|
||||||
# With status
|
# With status
|
||||||
docker ps -a
|
docker ps -a
|
||||||
|
|
||||||
@@ -72,43 +43,20 @@ laconic-so deployment --dir sushiswap-v3-deployment start
|
|||||||
docker logs -f <CONTAINER_ID>
|
docker logs -f <CONTAINER_ID>
|
||||||
```
|
```
|
||||||
|
|
||||||
* Open the GQL playground at http://localhost:3008/graphql
|
|
||||||
|
|
||||||
```graphql
|
|
||||||
# Example query
|
|
||||||
{
|
|
||||||
_meta {
|
|
||||||
block {
|
|
||||||
number
|
|
||||||
timestamp
|
|
||||||
}
|
|
||||||
hasIndexingErrors
|
|
||||||
}
|
|
||||||
|
|
||||||
factories {
|
|
||||||
id
|
|
||||||
poolCount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Clean up
|
## Clean up
|
||||||
|
|
||||||
Stop all the sushiswap-v3 services running in background:
|
Stop all the services running in background:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Only stop the docker containers
|
laconic-so --stack sushiswap-v3 deploy --cluster sushiswap_v3 down
|
||||||
laconic-so deployment --dir sushiswap-v3-deployment stop
|
|
||||||
|
|
||||||
# Run 'start' to restart the deployment
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To stop all the sushiswap-v3 services and also delete data:
|
Clear volumes created by this stack:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Stop the docker containers
|
# List all relevant volumes
|
||||||
laconic-so deployment --dir sushiswap-v3-deployment stop --delete-volumes
|
docker volume ls -q --filter "name=sushiswap_v3"
|
||||||
|
|
||||||
# Remove deployment directory (deployment will have to be recreated for a re-run)
|
# Remove all the listed volumes
|
||||||
rm -r sushiswap-v3-deployment
|
docker volume rm $(docker volume ls -q --filter "name=sushiswap_v3")
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: "1.0"
|
|||||||
name: sushiswap-v3
|
name: sushiswap-v3
|
||||||
description: "SushiSwap v3 watcher stack"
|
description: "SushiSwap v3 watcher stack"
|
||||||
repos:
|
repos:
|
||||||
- github.com/cerc-io/sushiswap-v3-watcher-ts@v0.1.7
|
- github.com/cerc-io/sushiswap-v3-watcher-ts@v0.1.6
|
||||||
containers:
|
containers:
|
||||||
- cerc/watcher-sushiswap-v3
|
- cerc/watcher-sushiswap-v3
|
||||||
pods:
|
pods:
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ stack: uniswap-urbit-app
|
|||||||
deploy-to: compose
|
deploy-to: compose
|
||||||
network:
|
network:
|
||||||
ports:
|
ports:
|
||||||
|
proxy-server:
|
||||||
|
- '4000:4000'
|
||||||
urbit-fake-ship:
|
urbit-fake-ship:
|
||||||
- '8080:80'
|
- '8080:80'
|
||||||
ipfs:
|
ipfs:
|
||||||
@@ -84,8 +86,7 @@ Inside the deployment directory, open the file `config.env` and set the followin
|
|||||||
# Set this to GQL proxy server endpoint for uniswap app
|
# Set this to GQL proxy server endpoint for uniswap app
|
||||||
# (Eg. http://localhost:4000/v1/graphql - in case stack is being run locally with proxy enabled)
|
# (Eg. http://localhost:4000/v1/graphql - in case stack is being run locally with proxy enabled)
|
||||||
# (Eg. https://abc.xyz.com/v1/graphql - in case https://abc.xyz.com is pointed to the proxy endpoint)
|
# (Eg. https://abc.xyz.com/v1/graphql - in case https://abc.xyz.com is pointed to the proxy endpoint)
|
||||||
CERC_UNISWAP_GQL=/apps/uniswap-proxy/v1/graphql
|
CERC_UNISWAP_GQL=http://localhost:4000/v1/graphql
|
||||||
CERC_UNISWAP_API=/apps/uniswap-proxy/v2
|
|
||||||
|
|
||||||
# Optional
|
# Optional
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ version: "0.1"
|
|||||||
name: uniswap-urbit-app
|
name: uniswap-urbit-app
|
||||||
repos:
|
repos:
|
||||||
- github.com/cerc-io/uniswap-interface@laconic # TODO: Use release
|
- github.com/cerc-io/uniswap-interface@laconic # TODO: Use release
|
||||||
|
- github.com/cerc-io/watcher-ts@v0.2.78
|
||||||
containers:
|
containers:
|
||||||
- cerc/uniswap-interface
|
- cerc/uniswap-interface
|
||||||
|
- cerc/watcher-ts
|
||||||
pods:
|
pods:
|
||||||
- uniswap-interface
|
- uniswap-interface
|
||||||
|
- proxy-server
|
||||||
- fixturenet-urbit
|
- fixturenet-urbit
|
||||||
- kubo
|
- kubo
|
||||||
|
|||||||
@@ -1,131 +0,0 @@
|
|||||||
# 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: "<PASSWORD>\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
|
|
||||||
```
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
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
|
|
||||||
@@ -101,7 +101,7 @@ class ClusterInfo:
|
|||||||
)
|
)
|
||||||
return service
|
return service
|
||||||
|
|
||||||
def get_ingress(self, use_tls=False, certificate=None, cluster_issuer="letsencrypt-prod"):
|
def get_ingress(self, use_tls=False):
|
||||||
# No ingress for a deployment that has no http-proxy defined, for now
|
# No ingress for a deployment that has no http-proxy defined, for now
|
||||||
http_proxy_info_list = self.spec.get_http_proxy()
|
http_proxy_info_list = self.spec.get_http_proxy()
|
||||||
ingress = None
|
ingress = None
|
||||||
@@ -110,13 +110,32 @@ class ClusterInfo:
|
|||||||
http_proxy_info = http_proxy_info_list[0]
|
http_proxy_info = http_proxy_info_list[0]
|
||||||
if opts.o.debug:
|
if opts.o.debug:
|
||||||
print(f"http-proxy: {http_proxy_info}")
|
print(f"http-proxy: {http_proxy_info}")
|
||||||
# TODO: good enough parsing for webapp deployment for now
|
|
||||||
host_name = http_proxy_info["host-name"]
|
host_name = http_proxy_info["host-name"]
|
||||||
|
|
||||||
|
tls = None
|
||||||
|
tls_issuer = None
|
||||||
|
|
||||||
|
if use_tls:
|
||||||
|
tls_info = http_proxy_info.get("tls", {})
|
||||||
|
tls_hosts = tls_info.get("hosts", [host_name])
|
||||||
|
tls_issuer = tls_info.get("issuer", "letsencrypt-prod")
|
||||||
|
tls_secret_name = f"{self.app_name}-tls"
|
||||||
|
if "secret" in tls_info:
|
||||||
|
# If an existing secret is specified, unset the issuer so that we don't try to re-request it.
|
||||||
|
tls_secret_name = tls_info["secret"]
|
||||||
|
tls_issuer = None
|
||||||
|
|
||||||
|
if opts.o.debug:
|
||||||
|
print(f"TLS hosts/secret: {tls_hosts}/{tls_secret_name}")
|
||||||
|
|
||||||
|
tls = [client.V1IngressTLS(
|
||||||
|
hosts=tls_hosts,
|
||||||
|
secret_name=tls_secret_name
|
||||||
|
)]
|
||||||
|
|
||||||
|
# TODO: good enough parsing for webapp deployment for now
|
||||||
rules = []
|
rules = []
|
||||||
tls = [client.V1IngressTLS(
|
|
||||||
hosts=certificate["spec"]["dnsNames"] if certificate else [host_name],
|
|
||||||
secret_name=certificate["spec"]["secretName"] if certificate else f"{self.app_name}-tls"
|
|
||||||
)] if use_tls else None
|
|
||||||
paths = []
|
paths = []
|
||||||
for route in http_proxy_info["routes"]:
|
for route in http_proxy_info["routes"]:
|
||||||
path = route["path"]
|
path = route["path"]
|
||||||
@@ -147,17 +166,15 @@ class ClusterInfo:
|
|||||||
tls=tls,
|
tls=tls,
|
||||||
rules=rules
|
rules=rules
|
||||||
)
|
)
|
||||||
|
annotations = {
|
||||||
ingress_annotations = {
|
|
||||||
"kubernetes.io/ingress.class": "nginx",
|
"kubernetes.io/ingress.class": "nginx",
|
||||||
}
|
}
|
||||||
if not certificate:
|
if tls_issuer:
|
||||||
ingress_annotations["cert-manager.io/cluster-issuer"] = cluster_issuer
|
annotations["cert-manager.io/cluster-issuer"] = tls_issuer
|
||||||
|
|
||||||
ingress = client.V1Ingress(
|
ingress = client.V1Ingress(
|
||||||
metadata=client.V1ObjectMeta(
|
metadata=client.V1ObjectMeta(
|
||||||
name=f"{self.app_name}-ingress",
|
name=f"{self.app_name}-ingress",
|
||||||
annotations=ingress_annotations
|
annotations=annotations
|
||||||
),
|
),
|
||||||
spec=spec
|
spec=spec
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -169,39 +169,6 @@ class K8sDeployer(Deployer):
|
|||||||
print("Service created:")
|
print("Service created:")
|
||||||
print(f"{service_resp}")
|
print(f"{service_resp}")
|
||||||
|
|
||||||
def _find_certificate_for_host_name(self, host_name):
|
|
||||||
all_certificates = self.custom_obj_api.list_namespaced_custom_object(
|
|
||||||
group="cert-manager.io",
|
|
||||||
version="v1",
|
|
||||||
namespace=self.k8s_namespace,
|
|
||||||
plural="certificates"
|
|
||||||
)
|
|
||||||
|
|
||||||
host_parts = host_name.split(".", 1)
|
|
||||||
host_as_wild = None
|
|
||||||
if len(host_parts) == 2:
|
|
||||||
host_as_wild = f"*.{host_parts[1]}"
|
|
||||||
|
|
||||||
now = datetime.utcnow().replace(tzinfo=timezone.utc)
|
|
||||||
fmt = "%Y-%m-%dT%H:%M:%S%z"
|
|
||||||
|
|
||||||
# Walk over all the configured certificates.
|
|
||||||
for cert in all_certificates["items"]:
|
|
||||||
dns = cert["spec"]["dnsNames"]
|
|
||||||
# Check for an exact hostname match or a wildcard match.
|
|
||||||
if host_name in dns or host_as_wild in dns:
|
|
||||||
status = cert.get("status", {})
|
|
||||||
# Check the certificate date.
|
|
||||||
if "notAfter" in status and "notBefore" in status:
|
|
||||||
before = datetime.strptime(status["notBefore"], fmt)
|
|
||||||
after = datetime.strptime(status["notAfter"], fmt)
|
|
||||||
if before < now < after:
|
|
||||||
# Check the status is Ready
|
|
||||||
for condition in status.get("conditions", []):
|
|
||||||
if "True" == condition.get("status") and "Ready" == condition.get("type"):
|
|
||||||
return cert
|
|
||||||
return None
|
|
||||||
|
|
||||||
def up(self, detach, services):
|
def up(self, detach, services):
|
||||||
if not opts.o.dry_run:
|
if not opts.o.dry_run:
|
||||||
if self.is_kind():
|
if self.is_kind():
|
||||||
@@ -222,15 +189,8 @@ class K8sDeployer(Deployer):
|
|||||||
self._create_volume_data()
|
self._create_volume_data()
|
||||||
self._create_deployment()
|
self._create_deployment()
|
||||||
|
|
||||||
http_proxy_info = self.cluster_info.spec.get_http_proxy()
|
|
||||||
# Note: at present we don't support tls for kind (and enabling tls causes errors)
|
# Note: at present we don't support tls for kind (and enabling tls causes errors)
|
||||||
use_tls = http_proxy_info and not self.is_kind()
|
ingress: client.V1Ingress = self.cluster_info.get_ingress(use_tls=not self.is_kind())
|
||||||
certificate = self._find_certificate_for_host_name(http_proxy_info[0]["host-name"]) if use_tls else None
|
|
||||||
if opts.o.debug:
|
|
||||||
if certificate:
|
|
||||||
print(f"Using existing certificate: {certificate}")
|
|
||||||
|
|
||||||
ingress: client.V1Ingress = self.cluster_info.get_ingress(use_tls=use_tls, certificate=certificate)
|
|
||||||
if ingress:
|
if ingress:
|
||||||
if opts.o.debug:
|
if opts.o.debug:
|
||||||
print(f"Sending this ingress: {ingress}")
|
print(f"Sending this ingress: {ingress}")
|
||||||
@@ -393,8 +353,7 @@ class K8sDeployer(Deployer):
|
|||||||
hostname = ingress.spec.rules[0].host
|
hostname = ingress.spec.rules[0].host
|
||||||
ip = ingress.status.load_balancer.ingress[0].ip
|
ip = ingress.status.load_balancer.ingress[0].ip
|
||||||
tls = "notBefore: %s; notAfter: %s; names: %s" % (
|
tls = "notBefore: %s; notAfter: %s; names: %s" % (
|
||||||
cert["status"]["notBefore"], cert["status"]["notAfter"], ingress.spec.tls[0].hosts
|
cert["status"]["notBefore"], cert["status"]["notAfter"], ", ".join(ingress.spec.tls[0].hosts))
|
||||||
)
|
|
||||||
except: # noqa: E722
|
except: # noqa: E722
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import click
|
import click
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from tempfile import NamedTemporaryFile
|
from tempfile import NamedTemporaryFile
|
||||||
@@ -23,6 +24,7 @@ from stack_orchestrator.util import error_exit, global_options2
|
|||||||
from stack_orchestrator.deploy.deployment_create import init_operation, create_operation
|
from stack_orchestrator.deploy.deployment_create import init_operation, create_operation
|
||||||
from stack_orchestrator.deploy.deploy import create_deploy_context
|
from stack_orchestrator.deploy.deploy import create_deploy_context
|
||||||
from stack_orchestrator.deploy.deploy_types import DeployCommandContext
|
from stack_orchestrator.deploy.deploy_types import DeployCommandContext
|
||||||
|
from stack_orchestrator.deploy.webapp.util import TlsDetails
|
||||||
|
|
||||||
|
|
||||||
def _fixup_container_tag(deployment_dir: str, image: str):
|
def _fixup_container_tag(deployment_dir: str, image: str):
|
||||||
@@ -36,16 +38,16 @@ def _fixup_container_tag(deployment_dir: str, image: str):
|
|||||||
wfile.write(contents)
|
wfile.write(contents)
|
||||||
|
|
||||||
|
|
||||||
def _fixup_url_spec(spec_file_name: str, url: str):
|
def _fixup_url_spec(spec_file_name: str, url: str, tls_details: TlsDetails = TlsDetails()):
|
||||||
# url is like: https://example.com/path
|
# url is like: https://example.com/path
|
||||||
parsed_url = urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
http_proxy_spec = f'''
|
http_proxy_spec = f''' http-proxy:
|
||||||
http-proxy:
|
|
||||||
- host-name: {parsed_url.hostname}
|
- host-name: {parsed_url.hostname}
|
||||||
routes:
|
routes:
|
||||||
- path: '{parsed_url.path if parsed_url.path else "/"}'
|
- path: '{parsed_url.path if parsed_url.path else "/"}'
|
||||||
proxy-to: webapp:80
|
proxy-to: webapp:80
|
||||||
'''
|
{tls_details.to_yaml(indent=6)}
|
||||||
|
'''
|
||||||
spec_file_path = Path(spec_file_name)
|
spec_file_path = Path(spec_file_name)
|
||||||
with open(spec_file_path) as rfile:
|
with open(spec_file_path) as rfile:
|
||||||
contents = rfile.read()
|
contents = rfile.read()
|
||||||
@@ -54,7 +56,8 @@ def _fixup_url_spec(spec_file_name: str, url: str):
|
|||||||
wfile.write(contents)
|
wfile.write(contents)
|
||||||
|
|
||||||
|
|
||||||
def create_deployment(ctx, deployment_dir, image, url, kube_config, image_registry, env_file):
|
def create_deployment(ctx, deployment_dir, image, url, kube_config, image_registry, env_file,
|
||||||
|
tls_details: TlsDetails = None):
|
||||||
# Do the equivalent of:
|
# Do the equivalent of:
|
||||||
# 1. laconic-so --stack webapp-template deploy --deploy-to k8s init --output webapp-spec.yml
|
# 1. laconic-so --stack webapp-template deploy --deploy-to k8s init --output webapp-spec.yml
|
||||||
# --config (eqivalent of the contents of my-config.env)
|
# --config (eqivalent of the contents of my-config.env)
|
||||||
@@ -86,7 +89,7 @@ def create_deployment(ctx, deployment_dir, image, url, kube_config, image_regist
|
|||||||
None
|
None
|
||||||
)
|
)
|
||||||
# Add the TLS and DNS spec
|
# Add the TLS and DNS spec
|
||||||
_fixup_url_spec(spec_file_name, url)
|
_fixup_url_spec(spec_file_name, url, tls_details)
|
||||||
create_operation(
|
create_operation(
|
||||||
deploy_command_context,
|
deploy_command_context,
|
||||||
spec_file_name,
|
spec_file_name,
|
||||||
@@ -116,8 +119,16 @@ def command(ctx):
|
|||||||
@click.option("--image", help="image to deploy", required=True)
|
@click.option("--image", help="image to deploy", required=True)
|
||||||
@click.option("--url", help="url to serve", required=True)
|
@click.option("--url", help="url to serve", required=True)
|
||||||
@click.option("--env-file", help="environment file for webapp")
|
@click.option("--env-file", help="environment file for webapp")
|
||||||
|
@click.option("--tls-host", help="Override TLS hostname (eg, '*.mydomain.com')")
|
||||||
|
@click.option("--tls-secret", help="Override TLS secret name")
|
||||||
|
@click.option("--tls-issuer", help="TLS issuer to use (default: letsencrypt-prod)")
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def create(ctx, deployment_dir, image, url, kube_config, image_registry, env_file):
|
def create(ctx, deployment_dir, image, url, kube_config, image_registry, env_file, tls_host, tls_secret, tls_issuer):
|
||||||
'''create a deployment for the specified webapp container'''
|
'''create a deployment for the specified webapp container'''
|
||||||
|
|
||||||
return create_deployment(ctx, deployment_dir, image, url, kube_config, image_registry, env_file)
|
if (tls_secret and not tls_host) or (tls_host and not tls_secret):
|
||||||
|
print("Cannot specify --tls-host without --tls-secret", file=sys.stderr)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
return create_deployment(ctx, deployment_dir, image, url, kube_config, image_registry, env_file,
|
||||||
|
TlsDetails(tls_host, tls_secret, tls_issuer))
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import click
|
|||||||
|
|
||||||
from stack_orchestrator.deploy.images import remote_image_exists, add_tags_to_image
|
from stack_orchestrator.deploy.images import remote_image_exists, add_tags_to_image
|
||||||
from stack_orchestrator.deploy.webapp import deploy_webapp
|
from stack_orchestrator.deploy.webapp import deploy_webapp
|
||||||
from stack_orchestrator.deploy.webapp.util import (LaconicRegistryClient, TimedLogger,
|
from stack_orchestrator.deploy.webapp.util import (LaconicRegistryClient, TimedLogger, TlsDetails,
|
||||||
build_container_image, push_container_image,
|
build_container_image, push_container_image,
|
||||||
file_hash, deploy_to_k8s, publish_deployment,
|
file_hash, deploy_to_k8s, publish_deployment,
|
||||||
hostname_for_deployment_request, generate_hostname_for_app,
|
hostname_for_deployment_request, generate_hostname_for_app,
|
||||||
@@ -44,7 +44,8 @@ def process_app_deployment_request(
|
|||||||
kube_config,
|
kube_config,
|
||||||
image_registry,
|
image_registry,
|
||||||
force_rebuild,
|
force_rebuild,
|
||||||
logger
|
tls_details,
|
||||||
|
logger,
|
||||||
):
|
):
|
||||||
logger.log("BEGIN - process_app_deployment_request")
|
logger.log("BEGIN - process_app_deployment_request")
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ def process_app_deployment_request(
|
|||||||
(app_deployment_crn, deployment_dir))
|
(app_deployment_crn, deployment_dir))
|
||||||
print("deploy_webapp", deployment_dir)
|
print("deploy_webapp", deployment_dir)
|
||||||
deploy_webapp.create_deployment(ctx, deployment_dir, deployment_container_tag,
|
deploy_webapp.create_deployment(ctx, deployment_dir, deployment_container_tag,
|
||||||
f"https://{fqdn}", kube_config, image_registry, env_filename)
|
f"https://{fqdn}", kube_config, image_registry, env_filename, tls_details)
|
||||||
elif env_filename:
|
elif env_filename:
|
||||||
shutil.copyfile(env_filename, deployment_config_file)
|
shutil.copyfile(env_filename, deployment_config_file)
|
||||||
|
|
||||||
@@ -198,11 +199,14 @@ def dump_known_requests(filename, requests, status="SEEN"):
|
|||||||
@click.option("--exclude-tags", help="Exclude requests with matching tags (comma-separated).", default="")
|
@click.option("--exclude-tags", help="Exclude requests with matching tags (comma-separated).", default="")
|
||||||
@click.option("--force-rebuild", help="Rebuild even if the image already exists.", is_flag=True)
|
@click.option("--force-rebuild", help="Rebuild even if the image already exists.", is_flag=True)
|
||||||
@click.option("--log-dir", help="Output build/deployment logs to directory.", default=None)
|
@click.option("--log-dir", help="Output build/deployment logs to directory.", default=None)
|
||||||
|
@click.option("--tls-host", help="Override TLS hostname (eg, '*.mydomain.com')")
|
||||||
|
@click.option("--tls-secret", help="Override TLS secret name")
|
||||||
|
@click.option("--tls-issuer", help="TLS issuer to use (default: letsencrypt-prod)")
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def command(ctx, kube_config, laconic_config, image_registry, deployment_parent_dir, # noqa: C901
|
def command(ctx, kube_config, laconic_config, image_registry, deployment_parent_dir, # noqa: C901
|
||||||
request_id, discover, state_file, only_update_state,
|
request_id, discover, state_file, only_update_state,
|
||||||
dns_suffix, record_namespace_dns, record_namespace_deployments, dry_run,
|
dns_suffix, record_namespace_dns, record_namespace_deployments, dry_run,
|
||||||
include_tags, exclude_tags, force_rebuild, log_dir):
|
include_tags, exclude_tags, force_rebuild, log_dir, tls_host, tls_secret, tls_issuer):
|
||||||
if request_id and discover:
|
if request_id and discover:
|
||||||
print("Cannot specify both --request-id and --discover", file=sys.stderr)
|
print("Cannot specify both --request-id and --discover", file=sys.stderr)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@@ -220,6 +224,10 @@ def command(ctx, kube_config, laconic_config, image_registry, deployment_parent_
|
|||||||
print("--dns-suffix, --record-namespace-dns, and --record-namespace-deployments are all required", file=sys.stderr)
|
print("--dns-suffix, --record-namespace-dns, and --record-namespace-deployments are all required", file=sys.stderr)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
if (tls_secret and not tls_host) or (tls_host and not tls_secret):
|
||||||
|
print("Cannot specify --tls-host without --tls-secret", file=sys.stderr)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
# Split CSV and clean up values.
|
# Split CSV and clean up values.
|
||||||
include_tags = [tag.strip() for tag in include_tags.split(",") if tag]
|
include_tags = [tag.strip() for tag in include_tags.split(",") if tag]
|
||||||
exclude_tags = [tag.strip() for tag in exclude_tags.split(",") if tag]
|
exclude_tags = [tag.strip() for tag in exclude_tags.split(",") if tag]
|
||||||
@@ -305,6 +313,7 @@ def command(ctx, kube_config, laconic_config, image_registry, deployment_parent_
|
|||||||
print("Found %d unsatisfied request(s) to process." % len(requests_to_execute))
|
print("Found %d unsatisfied request(s) to process." % len(requests_to_execute))
|
||||||
|
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
|
tls_details = TlsDetails(tls_host, tls_secret, tls_issuer)
|
||||||
for r in requests_to_execute:
|
for r in requests_to_execute:
|
||||||
dump_known_requests(state_file, [r], "DEPLOYING")
|
dump_known_requests(state_file, [r], "DEPLOYING")
|
||||||
status = "ERROR"
|
status = "ERROR"
|
||||||
@@ -334,6 +343,7 @@ def command(ctx, kube_config, laconic_config, image_registry, deployment_parent_
|
|||||||
kube_config,
|
kube_config,
|
||||||
image_registry,
|
image_registry,
|
||||||
force_rebuild,
|
force_rebuild,
|
||||||
|
tls_details,
|
||||||
logger
|
logger
|
||||||
)
|
)
|
||||||
status = "DEPLOYED"
|
status = "DEPLOYED"
|
||||||
|
|||||||
@@ -26,6 +26,40 @@ import uuid
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
|
class TlsDetails:
|
||||||
|
def __init__(self, host_or_hosts=None, secret_name: str = None, issuer_name: str = None):
|
||||||
|
if host_or_hosts:
|
||||||
|
if isinstance(host_or_hosts, list):
|
||||||
|
self.hosts = host_or_hosts
|
||||||
|
else:
|
||||||
|
self.hosts = [host_or_hosts]
|
||||||
|
else:
|
||||||
|
self.hosts = None
|
||||||
|
self.secret_name = secret_name
|
||||||
|
self.issuer_name = issuer_name
|
||||||
|
|
||||||
|
def to_yaml(self, indent=6):
|
||||||
|
if not self.hosts and not self.secret_name and not self.issuer_name:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
ret = " " * indent + "tls:\n"
|
||||||
|
indent += 2
|
||||||
|
|
||||||
|
if self.issuer_name:
|
||||||
|
ret += " " * indent + "issuer: '%s'\n" % self.issuer_name
|
||||||
|
|
||||||
|
if self.secret_name:
|
||||||
|
ret += " " * indent + "secret: '%s'\n" % self.secret_name
|
||||||
|
|
||||||
|
if self.hosts:
|
||||||
|
ret += " " * indent + "hosts:"
|
||||||
|
indent += 2
|
||||||
|
for h in self.hosts:
|
||||||
|
ret += "\n" + " " * indent + "- '%s'" % h
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class AttrDict(dict):
|
class AttrDict(dict):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(AttrDict, self).__init__(*args, **kwargs)
|
super(AttrDict, self).__init__(*args, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user