feat: add devnet scripts (#34)

* feat: add a way to get marketplace address from url

* feat: add devnet scripts
This commit is contained in:
Slava 2025-07-03 21:50:44 +03:00 committed by GitHub
parent c85372b8b9
commit ab8faf8250
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 156 additions and 3 deletions

View File

@ -78,3 +78,28 @@ curl -s https://get.codex.storage/testnet/generate.sh | bash
# Run Codex
curl -s https://get.codex.storage/testnet/run.sh | bash
```
## Join Codex Devnet
### Linux, macOS and Windows (msys2)
```shell
# Create a directory
mkdir codex-devnet && cd codex-devnet
```
```shell
# Install Codex
curl -s https://get.codex.storage/devnet/install.sh | bash
```
```shell
# Generate key
curl -s https://get.codex.storage/devnet/generate.sh | bash
```
```shell
# Run Codex
curl -s https://get.codex.storage/devnet/run.sh | bash
```

16
devnet/generate.sh Executable file
View File

@ -0,0 +1,16 @@
# Codex Devnet - Generate
# Variables
set -a
BASE_SCRIPT="https://get.codex.storage/generate.sh"
SCRIPT_URL="https://get.codex.storage/devnet/generate.sh"
set +a
# Help
if [[ $1 == *"help"* ]] ; then
curl -s "${BASE_SCRIPT}" | bash -s -- help
exit 0
fi
# Generate
curl -s "${BASE_SCRIPT}" | bash

52
devnet/index.html Normal file
View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<title>Join Codex Devnet</title>
<style>
html * {
font-size: 14px;
line-height: 1.5;
color: black;
font-family: monospace;
}
</style>
</head>
<body>
<h3>
Join Codex Devnet - Linux, macOS and Windows (msys2)
</h3>
<p>
<span style="color:grey;">
# Create a directory
</span>
<br>
mkdir codex-devnet && cd codex-devnet
</p>
<p>
<span style="color:grey;">
# Install Codex
</span>
<br>
curl -s https://get.codex.storage/devnet/install.sh | bash
</p>
<p>
<span style="color:grey;">
# Generate key
</span>
<br>
curl -s https://get.codex.storage/devnet/generate.sh | bash
</p>
<p>
<span style="color:grey;">
# Run Codex
</span>
<br>
curl -s https://get.codex.storage/devnet/run.sh | bash
</p>
</body>
</html>

17
devnet/install.sh Executable file
View File

@ -0,0 +1,17 @@
# Codex Devnet - Install
# Variables
set -a
BASE_SCRIPT="https://get.codex.storage/install.sh"
SCRIPT_URL="https://get.codex.storage/devnet/install.sh"
INSTALL_DIR="${INSTALL_DIR:-.}"
set +a
# Help
if [[ $1 == *"help"* ]] ; then
curl -s "${BASE_SCRIPT}" | bash -s -- help
exit 0
fi
# Install
curl -s "${BASE_SCRIPT}" | bash

20
devnet/run.sh Executable file
View File

@ -0,0 +1,20 @@
# Codex Devnet - Run
# Variables
set -a
BASE_SCRIPT="https://get.codex.storage/run.sh"
SCRIPT_URL="https://get.codex.storage/devnet/run.sh"
CODEX_BINARY="${CODEX_BINARY:-./codex}"
BOOTSTRAP_NODE_FROM_URL="https://spr.codex.storage/devnet"
MARKETPLACE_ADDRESS_FROM_URL="https://marketplace.codex.storage/codex-devnet/latest"
CODEX_ETH_PROVIDER="${CODEX_ETH_PROVIDER:-wss://public.sepolia.rpc.status.network/ws}"
set +a
# Help
if [[ $1 == *"help"* ]] ; then
curl -s "${BASE_SCRIPT}" | bash -s -- help
exit 0
fi
# Run
curl -s "${BASE_SCRIPT}" | bash -s -- $@

29
run.sh
View File

@ -28,7 +28,7 @@ export CODEX_ETH_PRIVATE_KEY="${CODEX_ETH_PRIVATE_KEY:-eth.key}"
export CODEX_ETH_PROVIDER="${CODEX_ETH_PROVIDER:-https://rpc.testnet.codex.storage}"
[[ -n "${CODEX_MARKETPLACE_ADDRESS}" ]] && export CODEX_MARKETPLACE_ADDRESS="${CODEX_MARKETPLACE_ADDRESS}"
# Default bootstrap nodes
# Bootstrap node from URL
BOOTSTRAP_NODE_FROM_URL="${BOOTSTRAP_NODE_FROM_URL:-https://spr.codex.storage/testnet}"
WAIT=60
SECONDS=0
@ -49,6 +49,29 @@ while (( SECONDS < WAIT )); do
fi
done
# Marketplace address from URL
if [[ ( -z "${CODEX_MARKETPLACE_ADDRESS}" || "$@" != *"--marketplace-address"* ) && -n "${MARKETPLACE_ADDRESS_FROM_URL}" ]]; then
echo "args - $@"
echo "CODEX_MARKETPLACE_ADDRESS - $CODEX_MARKETPLACE_ADDRESS"
echo "MARKETPLACE_ADDRESS_FROM_URL - $MARKETPLACE_ADDRESS_FROM_URL"
WAIT=60
SECONDS=0
SLEEP=1
while (( SECONDS < WAIT )); do
set +e
MARKETPLACE_ADDRESS=($(curl -s -f -m 5 "${MARKETPLACE_ADDRESS_FROM_URL}"))
set -e
if [[ $? -eq 0 && -n "${MARKETPLACE_ADDRESS}" ]]; then
export CODEX_MARKETPLACE_ADDRESS="${MARKETPLACE_ADDRESS}"
break
else
echo "Can't get Marketplace address from ${MARKETPLACE_ADDRESS_FROM_URL} - Retry in $SLEEP seconds / $((WAIT - SECONDS))"
sleep $SLEEP
fi
done
fi
# Help
if [[ $1 == *"help"* ]] ; then
COMMAND="curl -s ${SCRIPT_URL}"
@ -168,5 +191,5 @@ message="Running Codex"
show_progress "${message}" && show_pass "${message}\n"
${CODEX_BINARY} \
$@ \
persistence
persistence \
$@