Refactor to make Urbit setup generic #682
@ -1,10 +1,12 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
# TODO: Describe usage
|
||||
urbit-fake-ship:
|
||||
restart: unless-stopped
|
||||
image: tloncorp/vere
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_URBIT_APP: ${CERC_URBIT_APP}
|
||||
CERC_IPFS_GLOB_HOST_ENDPOINT: ${CERC_IPFS_GLOB_HOST_ENDPOINT:-http://ipfs-glob-host:5001}
|
||||
CERC_IPFS_SERVER_ENDPOINT: ${CERC_IPFS_SERVER_ENDPOINT:-http://ipfs-glob-host:8080}
|
||||
@ -13,7 +15,7 @@ services:
|
||||
- urbit_data:/urbit
|
||||
- urbit_app_builds:/app-builds
|
||||
- ../config/urbit/run-urbit-ship.sh:/urbit/run-urbit-ship.sh
|
||||
- ../config/uniswap-interface/deploy-uniswap-app.sh:/urbit/deploy-app.sh
|
||||
- ../config/urbit/deploy-app.sh:/urbit/deploy-app.sh
|
||||
ports:
|
||||
- "80"
|
||||
healthcheck:
|
||||
@ -23,6 +25,7 @@ services:
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
|
||||
# TODO: Refactor this outside
|
||||
ipfs-glob-host:
|
||||
image: ipfs/kubo:master-2023-02-20-714a968
|
||||
volumes:
|
@ -11,8 +11,8 @@ services:
|
||||
volumes:
|
||||
- ../config/uniswap-interface/build-app.sh:/app/build-app.sh
|
||||
- urbit_app_builds:/app-builds
|
||||
- ../config/uniswap-interface/urbit-files/mar:/app-builds/uniswap/mar
|
||||
- ../config/uniswap-interface/urbit-files/desk.docket-0:/app-builds/uniswap/desk.docket-0
|
||||
- ../config/uniswap-interface/urbit-files/mar:/app/mar
|
||||
- ../config/uniswap-interface/urbit-files/desk.docket-0:/app/desk.docket-0
|
||||
|
||||
volumes:
|
||||
urbit_app_builds:
|
||||
|
@ -13,6 +13,9 @@ fi
|
||||
|
||||
yarn build
|
||||
|
||||
# Move build to app-builds so urbit can deploy it
|
||||
# Copy over build and other files to app-builds for urbit deployment
|
||||
mkdir -p /app-builds/uniswap
|
||||
cp -r ./build /app-builds/uniswap/
|
||||
|
||||
cp -r mar /app-builds/uniswap/
|
||||
cp desk.docket-0 /app-builds/uniswap/
|
||||
|
@ -22,7 +22,7 @@ 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 the additional mark files from ${app_mark_files}"
|
||||
echo "Reading additional mark files from ${app_mark_files}"
|
||||
echo "Reading docket file ${app_docket_file}"
|
||||
|
||||
# Loop until the app's build appears
|
||||
@ -72,9 +72,6 @@ glob_cid=$(echo "$upload_response" | grep -o '"Hash":"[^"]*' | sed 's/"Hash":"//
|
||||
echo "Glob file uploaded to IFPS:"
|
||||
echo "{ cid: ${glob_cid}, filename: ${glob_file} }"
|
||||
|
||||
# Flag to skip installation
|
||||
# Exit here if the installation not required
|
||||
|
||||
# Curl and wait for the glob to be hosted
|
||||
glob_url="${ipfs_server_endpoint}/ipfs/${glob_cid}?filename=${glob_file}"
|
||||
|
||||
@ -86,20 +83,17 @@ while true; do
|
||||
echo "File found at $glob_url"
|
||||
break # Exit the loop if the file is found
|
||||
else
|
||||
echo "File not found. Retrying in a few seconds..."
|
||||
echo "File not found, retrying in a 5s..."
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
|
||||
glob_hash=$(echo "$glob_file" | sed "s/glob-\([a-z0-9\.]*\).glob/\1/")
|
||||
|
||||
# Take the docket file from a volume (/app-builds/uniswap/desk.docket-0)
|
||||
# Replace glob_url and glob_hash in that (refer landscape CI)
|
||||
|
||||
# Replace the docket file for app
|
||||
# Substitue the glob URL and hash
|
||||
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" 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
|
||||
hood "commit %uniswap"
|
@ -7,11 +7,13 @@ fi
|
||||
|
||||
pier_dir="/urbit/zod"
|
||||
|
||||
# TODO: Bootstrap fake ship on the first run
|
||||
|
||||
# Run urbit ship in daemon mode
|
||||
# Check if the directory exists
|
||||
if [ -d "$pier_dir" ]; then
|
||||
echo "Pier directory already exists, rebooting..."
|
||||
urbit -d zod
|
||||
/urbit/zod/.run -d
|
||||
else
|
||||
echo "Creating a new fake ship..."
|
||||
urbit -d -F zod
|
||||
|
@ -67,6 +67,9 @@ laconic-so --stack uniswap-urbit-app deploy create --spec-file uniswap-urbit-app
|
||||
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=uniswap
|
||||
|
||||
# External RPC endpoints
|
||||
# https://docs.infura.io/getting-started#2-create-an-api-key
|
||||
CERC_INFURA_KEY=
|
||||
|
@ -10,4 +10,4 @@ containers:
|
||||
pods:
|
||||
- uniswap-interface
|
||||
- proxy-server
|
||||
- uniswap-urbit
|
||||
- fixturenet-urbit
|
||||
|
Loading…
Reference in New Issue
Block a user