Skip to content
This repository was archived by the owner on Dec 4, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions devenv/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
show_help() {
echo "Usage: $0 [-h|--help] <profile>"
echo "Available profiles: min (bitcoin, stacks, electrs), full"
echo "Configs and runtimes may change depending on the profile."
exit 0
}

docker_runner() {
if [ "$profile" == "min" ]; then
docker compose -f min-docker-compose.yml $1 $2
elif [ "$profile" == "full" ]; then
docker compose $1 $2
else
echo "Invalid profile. Available profiles: min, full"
fi
}

run() {
local profile=""
while [[ $# -gt 0 ]]; do
key="$1"

case $key in
-h | --help)
show_help
;;
min | full)
if ! [ -z "$profile" ]; then
echo "Profile '$profile' already set"
show_help
exit 1
fi
profile="$1"
shift
;;
*)
echo "Unknown option: $1"
show_help
;;
esac
done

if [ -z "$profile" ]; then
echo "You must specify a profile (min or full)"
show_help
exit 1
fi

local subcommand=$(basename $0 .sh)
docker_runner $subcommand "$FLAGS"
}
117 changes: 18 additions & 99 deletions devenv/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,13 @@ version: '3.2'

services:
bitcoin:
image: bitcoin:latest
container_name: bitcoin
stop_grace_period: 5s
build:
context: ./bitcoin/docker
args:
VERSION: '25.0'
ports:
- 18444:18444
- 18443:18443
- 18433:18433
environment:
- 'BTC_NETWORK=regtest'
- 'BTC_DISABLEWALLET=0'
- 'BTC_TXINDEX=1'
- 'BTC_RPCBIND=0.0.0.0'
- 'BTC_RPCALLOWIP=0.0.0.0/0'
- 'BTC_RPCPASSWORD=devnet'
- 'BTC_RPCUSER=devnet'
extends:
file: min-docker-compose.yml
service: bitcoin
postgres:
image: postgres:15-alpine
container_name: postgres
stop_grace_period: 5s
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
extends:
file: min-docker-compose.yml
service: postgres
mongodb:
image: mongo:6.0
container_name: mongodb
Expand All @@ -52,67 +31,17 @@ services:
MYSQL_PASSWORD: "mempool"
MYSQL_ROOT_PASSWORD: "admin"
miner:
image: miner:latest
container_name: miner
stop_grace_period: 5s
build:
context: ./miner/docker
depends_on:
- bitcoin
environment:
INIT_BTC_BLOCKS: 200
BTC_BLOCK_GEN_TIME: 10
extends:
file: min-docker-compose.yml
service: miner
stacks:
image: stacks:latest
container_name: stacks
stop_grace_period: 5s
build:
context: ./stacks/docker
args:
STACKS_NODE_VERSION: '2.4.0.0.0'
GIT_URI: https://github.com/stacks-network/stacks-blockchain.git
GIT_BRANCH: develop
ports:
- 20444:20444
- 20443:20443
depends_on:
- bitcoin
- miner
environment:
- STACKS_LOG_DEBUG=0
- STACKS_LOG_JSON=0
extends:
file: min-docker-compose.yml
service: stacks
stacks-api:
image: stacks-api:latest
container_name: stacks-api
stop_grace_period: 5s
build:
context: ./stacks-api/docker
args:
GIT_URI: 'https://github.com/hirosystems/stacks-blockchain-api.git'
GIT_BRANCH: 'v7.3.0'
ports:
- 3999:3999
- 3700:3700
depends_on:
- postgres
- stacks
- bitcoin
environment:
- NODE_ENV=production
- GIT_TAG=master
- PG_HOST=postgres
- PG_PORT=5432
- PG_USER=postgres
- PG_PASSWORD=postgres
- PG_DATABASE=postgres
- STACKS_CHAIN_ID=0x80000000
- STACKS_CORE_EVENT_PORT=3700
- STACKS_CORE_EVENT_HOST=0.0.0.0
- STACKS_BLOCKCHAIN_API_PORT=3999
- STACKS_BLOCKCHAIN_API_HOST=0.0.0.0
- STACKS_CORE_RPC_HOST=stacks
- STACKS_CORE_RPC_PORT=20443
- API_DOCS_URL=http://localhost:3999/doc
extends:
file: min-docker-compose.yml
service: stacks-api
stacks-explorer:
image: stacks-explorer
container_name: stacks-explorer
Expand All @@ -133,19 +62,9 @@ services:
environment:
- NEXT_PUBLIC_MAINNET_API_SERVER=http://127.0.0.1:3999
electrs:
image: electrs:latest
container_name: electrs
stop_grace_period: 5s
build:
context: ./electrs/docker
ports:
- 60401:60401
- 3002:3002
depends_on:
- bitcoin
- miner
environment:
RUST_BACKTRACE: 1
extends:
file: min-docker-compose.yml
service: electrs
sbtc:
image: sbtc:latest
container_name: sbtc
Expand Down
8 changes: 7 additions & 1 deletion devenv/down.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
#!/usr/bin/env bash
docker compose down

set -ueo >/dev/null

FLAGS=""
source ./common.sh

run $@
105 changes: 105 additions & 0 deletions devenv/min-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
version: '3.2'

services:
bitcoin:
image: bitcoin:latest
container_name: bitcoin
stop_grace_period: 5s
build:
context: ./bitcoin/docker
args:
VERSION: '25.0'
ports:
- 18444:18444
- 18443:18443
- 18433:18433
environment:
- 'BTC_NETWORK=regtest'
- 'BTC_DISABLEWALLET=0'
- 'BTC_TXINDEX=1'
- 'BTC_RPCBIND=0.0.0.0'
- 'BTC_RPCALLOWIP=0.0.0.0/0'
- 'BTC_RPCPASSWORD=devnet'
- 'BTC_RPCUSER=devnet'
miner:
image: miner:latest
stop_grace_period: 5s
build:
context: ./miner/docker
depends_on:
- bitcoin
environment:
INIT_BTC_BLOCKS: 101
BTC_BLOCK_GEN_TIME: 5
electrs:
image: electrs:latest
container_name: electrs
stop_grace_period: 5s
build:
context: ./electrs/docker
ports:
- 60401:60401
- 3002:3002
depends_on:
- bitcoin
environment:
RUST_BACKTRACE: 1
stacks:
image: stacks:latest
container_name: stacks
stop_grace_period: 5s
build:
context: ./stacks/docker
args:
STACKS_NODE_VERSION: '2.4.0.0.0'
GIT_URI: https://github.com/stacks-network/stacks-blockchain.git
GIT_BRANCH: develop
ports:
- 20444:20444
- 20443:20443
depends_on:
- bitcoin
environment:
- STACKS_LOG_DEBUG=0
- STACKS_LOG_JSON=0
postgres:
image: postgres:15-alpine
container_name: postgres
stop_grace_period: 5s
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
stacks-api:
image: stacks-api:latest
container_name: stacks-api
stop_grace_period: 5s
build:
context: ./stacks-api/docker
args:
GIT_URI: 'https://github.com/hirosystems/stacks-blockchain-api.git'
GIT_BRANCH: 'v7.3.0'
ports:
- 3999:3999
- 3700:3700
depends_on:
- postgres
- stacks
- bitcoin
environment:
- NODE_ENV=production
- GIT_TAG=master
- PG_HOST=postgres
- PG_PORT=5432
- PG_USER=postgres
- PG_PASSWORD=postgres
- PG_DATABASE=postgres
- STACKS_CHAIN_ID=0x80000000
- STACKS_CORE_EVENT_PORT=3700
- STACKS_CORE_EVENT_HOST=0.0.0.0
- STACKS_BLOCKCHAIN_API_PORT=3999
- STACKS_BLOCKCHAIN_API_HOST=0.0.0.0
- STACKS_CORE_RPC_HOST=stacks
- STACKS_CORE_RPC_PORT=20443
- API_DOCS_URL=http://localhost:3999/doc
11 changes: 6 additions & 5 deletions devenv/up.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash

if [ $? -eq 0 ]; then
docker compose up -d
else
echo "Build failed, not starting devenv"
fi
set -ueo >/dev/null

FLAGS="-d --remove-orphans"
source ./common.sh

run $@