Skip to content

Commit

Permalink
Merge branch 'develop' into dpid-url
Browse files Browse the repository at this point in the history
  • Loading branch information
shadrach-tayo committed Apr 9, 2024
2 parents 7a98457 + 8b9c67b commit 32f8ada
Show file tree
Hide file tree
Showing 48 changed files with 4,071 additions and 5,379 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ ORCID_CLIENT_SECRET=
REPO_SERVER_URL=http://host.docker.internal:5484
REPO_SERVICE_SECRET_KEY=secretrepo

# To run bootstrapCeramic.sh, clone `@desci-labs/desci-codex` and put the path here
CODEX_REPO_PATH=
# To run bootstrapCeramic.sh, you need the admin seed for the model IDs to be the same
CERAMIC_ADMIN_SEED=

# ISOLATED MEDIA SERVER
ISOLATED_MEDIA_SERVER_URL=http://media_isolated:7771
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ ipfs-data/
local-data/
node-modules/
node_modules/*
.idea
.idea
.composedbRuntimeDefinition.json
67 changes: 41 additions & 26 deletions bootstrapCeramic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@
# There is no damage trying to run this multiple times in a row; it's
# idempotent.

set -euo pipefail

CTX="[bootstrapCeramic.sh]"
WAS_RUNNING=0

set -euo pipefail
trap catch ERR
catch() {
echo "$CTX script failed (are CODEX_REPO_PATH and TOGGLE_CERAMIC set in .env?)"
echo "$CTX script failed! Have you set CERAMIC_ADMIN_SEED in .env?"
if [ "$WAS_RUNNING" -eq "0" ]; then
docker compose --project-name desci down
fi
exit 1
}

Expand All @@ -25,38 +30,48 @@ if [[ ! -f .env ]]; then
exit 1
fi

# Assert desci-codex repo available
CODEX_REPO_PATH=$(grep "CODEX_REPO_PATH" .env | cut -d"=" -f2)
if [[ -z "$CODEX_REPO_PATH" ]]; then
echo "$CTX CODEX_REPO_PATH not set in .env, aborting!"
# Make sure we have the admin seed in env so modelIDs make sense
CERAMIC_ADMIN_SEED=$(grep "CERAMIC_ADMIN_SEED" .env | cut -d"=" -f2)
if [[ -z "$CERAMIC_ADMIN_SEED" ]]; then
echo "$CTX CERAMIC_ADMIN_SEED must be set in env, as the modelID's aren't deterministic otherwise."
exit 1
else
echo "$CTX Found codex repo path: $CODEX_REPO_PATH"
fi

# Assert ceramic service is running
# Check if ceramic service is already running
WAS_RUNNING=0
RUNNING_SERVICES=$(docker compose --project-name desci ps --services)
if ! grep -q ceramic <<<"$RUNNING_SERVICES"; then
echo "$CTX the ceramic compose service doesn't seem to be running, aborting!"
exit 1
echo "$CTX the ceramic compose service doesn't seem to be running, starting..."
docker compose \
-f docker-compose.dev.yml \
-f docker-compose.yml \
--project-name desci \
up ceramic \
--detach
sleep 5
else
echo "$CTX Ceramic service already running, won't touch compose services..."
WAS_RUNNING=1
fi

# Setup desci-codex and deploy composites
pushd "$CODEX_REPO_PATH"
echo "$CTX Downloading the runtime definition file for the composeDB models..."
curl -L --output .composedbRuntimeDefinition.json \
https://raw.githubusercontent.com/desci-labs/desci-codex/main/packages/composedb/src/__generated__/definition.json

# Check that the node admin secret is set up, otherwise the model ID's wont be correct
if [ ! -f "packages/composedb/admin_seed.txt" ]; then
echo "$CTX Composites need to be deployed with the ceramic node admin seed for the local node, as the model IDs aren't deterministic otherwise"
exit 1
fi
echo "$CTX Deploying composites to ceramic node..."
npx --yes @composedb/cli composite:deploy \
.composedbRuntimeDefinition.json \
--ceramic-url="http://localhost:7007" \
--did-private-key="$CERAMIC_ADMIN_SEED"

if [[ ! -d "node_modules" ]]; then
echo "$CTX installing deps desci-codex..."
npm ci
fi
sleep 5
echo "$CTX Deployment all good, probably!"

echo "$CTX deploying composites..."
npm run --workspace packages/composedb deployComposites
popd
if [ "$WAS_RUNNING" -eq "0" ]; then
echo "$CTX Shutting down ceramic service..."
docker compose --project-name desci down
else
echo "$CTX Leaving compose services up as they were already running when we started."
fi

echo "$CTX Done! Re-run this script if local state is cleaned."
echo "$CTX Done! You need to run me again if local data is wiped."
1 change: 1 addition & 0 deletions desci-contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ build
.openzeppelin/migration-complete.json
*.dbg.json
flat.sol
dist
167 changes: 0 additions & 167 deletions desci-contracts/.openzeppelin/old/sepoliaDev-dpid.json

This file was deleted.

Loading

0 comments on commit 32f8ada

Please sign in to comment.