Files
purple-explorer/docker/mongo-init.sh
T
davide 306f494cd8 Add Docker setup for BitcoinPurple explorer
- Dockerfile: node:20-alpine, compiles SCSS at build time, single image
  used for web server and all sync modes (blocks, peers, markets)
- docker-compose.yml: explorer + MongoDB (bind-mounted ./db) on shared
  'purple' network alongside bitcoinpurpled and electrumx
- docker/entrypoint.sh: generates settings.json from env vars via
  envsubst, dispatches to web/sync-blocks/sync-peers/reindex modes
- docker/settings.json.tmpl: minimal settings template parametrized
  for BitcoinPurple (coin, wallet RPC, MongoDB, theme)
- docker/mongo-init.sh: creates app user in explorerdb on first start
- .env.example: pre-filled defaults for BitcoinPurple
- CLAUDE.md: codebase guidance for Claude Code
- .gitignore: add db/ (MongoDB bind-mount data directory)
2026-04-28 13:39:53 +02:00

12 lines
394 B
Bash

#!/bin/bash
# Creates the explorer app user in explorerdb.
# Runs once on first container start (only when the data volume is empty).
mongosh -u "$MONGO_INITDB_ROOT_USERNAME" -p "$MONGO_INITDB_ROOT_PASSWORD" --authenticationDatabase admin <<EOF
use $MONGO_APP_DB
db.createUser({
user: "$MONGO_APP_USER",
pwd: "$MONGO_APP_PASS",
roles: [{ role: "readWrite", db: "$MONGO_APP_DB" }]
})
EOF