scripts: organize the store service deployment

This commit is contained in:
shum committed 2026-10-27 13:10:47 +00:00
1 parent 2e19012e1a
commit 752efb43d7
7 files changed
+53 -19

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
# Store service deployment
- `compose.yml`: the service, built from `Dockerfile`, with `./config` mounted read-only.
- `compose.dev.yml`: adds a local chain and database to `compose.yml`, for development.
- `Dockerfile`, `Dockerfile.dockerignore`: the image, built from the repository root.
- `store_service.ini.example`: the template of `config/store_service.ini`.
- `dev/chain.sh`: the dev chain, which also writes the dev `config/store_service.ini`.
- `dev/contract-run.sh`: runs the names webapp's end-to-end cases against the service.
- `ops/egress.sh`: the egress rule of a production host.
- `config/`, `badges/`, `names/`, `data/`, `.env`: local state, gitignored.
Production, with PostgreSQL at `BADGE_DB_CONN` (by default
`postgresql://simplex@127.0.0.1:5432/badge_service`), and the ini filled in before the last command:
```
install -d -m 700 config
install -m 600 store_service.ini.example config/store_service.ini
docker compose up -d --build
```
Development, from a fresh clone:
```
git clone https://github.com/simplex-chat/simplex-chat && cd simplex-chat
git checkout sh/store-service && git submodule update --init apps/simplex-domains
cd scripts/store-service
echo "COMPOSE_FILE=compose.yml:compose.dev.yml" > .env
docker compose up -d --build
```
The names site is then on `http://127.0.0.1:8081`, the badges site on `http://127.0.0.1:8080`.
Everything else is in [apps/simplex-store-service/README.md](../../apps/simplex-store-service/README.md#deployment).
+2 -2
View File
@@ -21,8 +21,8 @@ services:
volumes:
- ./data/chain:/chain
- ./config:/config
- ./dev-chain.sh:/usr/local/bin/dev-chain.sh:ro
command: dev-chain.sh
- ./dev/chain.sh:/usr/local/bin/chain.sh:ro
command: chain.sh
healthcheck:
test: ["CMD", "test", "-f", "/chain/ready"]
interval: 5s
@@ -1,9 +1,9 @@
#!/bin/sh
# The local chain of compose.dev.yml. Runs in the webapp's dev image, which has anvil, node, the deploy script and the
# compiled contracts.
# dev-chain.sh anvil with its state kept in $CHAIN_DIR, the names contracts deployed on the first start,
# chain.sh anvil with its state kept in $CHAIN_DIR, the names contracts deployed on the first start,
# and $CONFIG_DIR/store_service.ini written for them unless it exists
# dev-chain.sh topup [address] [eth] sets an account's balance, by default the service key's account to 10000 ETH
# chain.sh topup [address] [eth] sets an account's balance, by default the service key's account to 10000 ETH
set -eu
CHAIN_DIR="${CHAIN_DIR:-/chain}"
@@ -70,7 +70,7 @@ write_config() {
tmp="$CONFIG.tmp"
rm -f "$tmp"
(umask 077 && cat > "$tmp" <<INI)
; written by dev-chain.sh for the local chain on its first start, and never rewritten
; written by dev/chain.sh for the local chain on its first start, and never rewritten
[listener]
host = 127.0.0.1
badges_port = 8080
@@ -6,13 +6,13 @@
set -euo pipefail
shopt -s inherit_errexit
WEBAPP_DIR="${WEBAPP_DIR:-$(cd "$(dirname "$0")/../.." && pwd)/apps/simplex-domains/webapp}"
WEBAPP_DIR="${WEBAPP_DIR:-$(cd "$(dirname "$0")/../../.." && pwd)/apps/simplex-domains/webapp}"
: "${ENS_CONTRACTS_DIR:?set ENS_CONTRACTS_DIR to a compiled ens-contracts checkout, as for the webapp dev/start.sh}"
ANVIL="${ANVIL:-anvil}"
SERVICE_PORT="${SERVICE_PORT:-8180}"
BADGES_PORT="${BADGES_PORT:-8181}"
CODES_PORT="${CODES_PORT:-8199}"
REPO="$(cd "$(dirname "$0")/../.." && pwd)"
REPO="$(cd "$(dirname "$0")/../../.." && pwd)"
STORE_SERVICE_BIN="${STORE_SERVICE_BIN:-$(cd "$REPO" && cabal list-bin exe:simplex-store-service)}"
# The e2e helpers read the chain from the webapp's dev/local-chain-0.json, which slot 0 of dev/start.sh
File renamed without changes.
@@ -103,7 +103,7 @@ private_key = replace-me
; the chain the names are registered on. rpc_url can carry a provider's API key and service_key
; pays for every commit and register: keep both secret. Neither is ever logged.
;[chain]
; the reth node; egress.sh allows it
; the reth node; ops/egress.sh allows it
;rpc_url = http://127.0.0.1:8545
; 1 for Ethereum mainnet
;chain_id = 1