@secondlayer/cli 23.2.1 → 23.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +54 -98
- package/dist/cli.js.map +4 -4
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -31892,7 +31892,7 @@ var {
|
|
|
31892
31892
|
// package.json
|
|
31893
31893
|
var package_default = {
|
|
31894
31894
|
name: "@secondlayer/cli",
|
|
31895
|
-
version: "23.
|
|
31895
|
+
version: "23.3.0",
|
|
31896
31896
|
description: "Run a Stacks index on your own hardware — set it up, restore verified history, and keep it current.",
|
|
31897
31897
|
repository: {
|
|
31898
31898
|
type: "git",
|
|
@@ -31918,7 +31918,7 @@ var package_default = {
|
|
|
31918
31918
|
build: "bunup",
|
|
31919
31919
|
dev: "bunup --watch",
|
|
31920
31920
|
test: "bun test",
|
|
31921
|
-
typecheck: "
|
|
31921
|
+
typecheck: "bun check",
|
|
31922
31922
|
prepublishOnly: "bun run build"
|
|
31923
31923
|
},
|
|
31924
31924
|
keywords: [
|
|
@@ -31942,7 +31942,7 @@ var package_default = {
|
|
|
31942
31942
|
"@secondlayer/bundler": "^0.7.3",
|
|
31943
31943
|
"@secondlayer/scaffold": "^1.6.3",
|
|
31944
31944
|
"@secondlayer/sdk": "^16.2.0",
|
|
31945
|
-
"@secondlayer/shared": "^15.0.
|
|
31945
|
+
"@secondlayer/shared": "^15.0.1",
|
|
31946
31946
|
"@secondlayer/stacks": "^6.5.3",
|
|
31947
31947
|
"@secondlayer/subgraphs": "^8.0.1",
|
|
31948
31948
|
"@secondlayer/verify": "^0.6.1",
|
|
@@ -35611,14 +35611,14 @@ import { dirname as dirname7, join as join10 } from "node:path";
|
|
|
35611
35611
|
var DEFAULT_IMAGE_OWNER = "ryanwaits";
|
|
35612
35612
|
var DEFAULT_IMAGE_TAG = "latest";
|
|
35613
35613
|
var DEV_INSTANCE_TOKEN = "dev-instance-token";
|
|
35614
|
+
var DEV_WEBHOOK_SIGNING_KEY = "-----BEGIN PRIVATE KEY-----\\nMC4CAQAwBQYDK2VwBCIEIIczaKV9CBblFKXjqGwrA3A1FOJxY2HiST7++XGea/jX\\n-----END PRIVATE KEY-----";
|
|
35614
35615
|
function buildDevnetCompose(opts = {}) {
|
|
35615
35616
|
const owner = opts.owner ?? DEFAULT_IMAGE_OWNER;
|
|
35616
35617
|
const tag = opts.imageTag ?? DEFAULT_IMAGE_TAG;
|
|
35617
35618
|
const apiPort = opts.apiPort ?? 3800;
|
|
35618
35619
|
const indexerPort = opts.indexerPort ?? 3700;
|
|
35619
35620
|
const apiPublish = `127.0.0.1:${apiPort}`;
|
|
35620
|
-
const
|
|
35621
|
-
const indexerImage = `ghcr.io/${owner}/secondlayer-indexer:${tag}`;
|
|
35621
|
+
const runtimeImage = `ghcr.io/${owner}/secondlayer-runtime:${tag}`;
|
|
35622
35622
|
const dbUrl = "postgres://secondlayer:secondlayer@postgres:5432/secondlayer";
|
|
35623
35623
|
const DEV_SECRETS_KEY = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef";
|
|
35624
35624
|
return `# Generated by \`secondlayer devnet connect\` — do not edit by hand.
|
|
@@ -35641,22 +35641,24 @@ services:
|
|
|
35641
35641
|
retries: 10
|
|
35642
35642
|
restart: unless-stopped
|
|
35643
35643
|
|
|
35644
|
-
|
|
35645
|
-
image: ${
|
|
35646
|
-
command: ["bun", "run", "packages/shared/src/db/migrate.ts"]
|
|
35647
|
-
environment:
|
|
35648
|
-
DATABASE_URL: ${dbUrl}
|
|
35649
|
-
depends_on:
|
|
35650
|
-
postgres:
|
|
35651
|
-
condition: service_healthy
|
|
35652
|
-
restart: "no"
|
|
35653
|
-
|
|
35654
|
-
api:
|
|
35655
|
-
image: ${apiImage}
|
|
35644
|
+
secondlayer:
|
|
35645
|
+
image: ${runtimeImage}
|
|
35656
35646
|
environment:
|
|
35657
35647
|
INSTANCE_MODE: oss
|
|
35648
|
+
# Keep every network key aligned: the indexer writes index_progress under
|
|
35649
|
+
# STACKS_NETWORK, the subgraph processor reads it under NETWORK. If they
|
|
35650
|
+
# differ, catch-up finds no progress row and subgraphs never advance.
|
|
35651
|
+
NETWORKS: testnet
|
|
35652
|
+
STACKS_NETWORK: testnet
|
|
35653
|
+
NETWORK: testnet
|
|
35654
|
+
NODE_MODE: external
|
|
35655
|
+
# A devnet index is tiny; the runtime's RAM/disk floors target real
|
|
35656
|
+
# networks and a laptop's Docker VM often has less than 80 GB free.
|
|
35657
|
+
SECONDLAYER_ALLOW_UNDERSIZED: "true"
|
|
35658
35658
|
DATABASE_URL: ${dbUrl}
|
|
35659
|
-
|
|
35659
|
+
DATA_DIR: /data
|
|
35660
|
+
API_PORT: "3800"
|
|
35661
|
+
INDEXER_PORT: "3700"
|
|
35660
35662
|
# 0.0.0.0 is forced: a container process that binds loopback is
|
|
35661
35663
|
# unreachable through a published port. The real reach is the publish
|
|
35662
35664
|
# spec below, handed over verbatim so /v1 reads stay keyless on devnet.
|
|
@@ -35665,93 +35667,48 @@ services:
|
|
|
35665
35667
|
# Boot guard reads LISTEN_HOST, so a token is required to start at all.
|
|
35666
35668
|
# It gates writes only — reads are open on this loopback publish.
|
|
35667
35669
|
INSTANCE_TOKEN: ${DEV_INSTANCE_TOKEN}
|
|
35668
|
-
|
|
35669
|
-
|
|
35670
|
-
# Shared across api + subgraph-processor so the secret the api encrypts
|
|
35671
|
-
# (e.g. a webhook's signing secret) can be decrypted by the emitter.
|
|
35672
|
-
# OSS auto-generates a per-process key when unset — that splits them.
|
|
35673
|
-
# Local-dev fixed value; not a production secret.
|
|
35670
|
+
# Fixed so the secret the api encrypts (e.g. a webhook's signing secret)
|
|
35671
|
+
# can be decrypted by the emitter across restarts. Not a production secret.
|
|
35674
35672
|
SECONDLAYER_SECRETS_KEY: ${DEV_SECRETS_KEY}
|
|
35675
|
-
|
|
35676
|
-
|
|
35677
|
-
|
|
35678
|
-
|
|
35679
|
-
|
|
35680
|
-
|
|
35681
|
-
|
|
35682
|
-
|
|
35683
|
-
condition: service_healthy
|
|
35684
|
-
healthcheck:
|
|
35685
|
-
test: ["CMD", "curl", "-f", "http://localhost:3800/health"]
|
|
35686
|
-
interval: 10s
|
|
35687
|
-
timeout: 3s
|
|
35688
|
-
start_period: 10s
|
|
35689
|
-
retries: 5
|
|
35690
|
-
restart: unless-stopped
|
|
35691
|
-
|
|
35692
|
-
indexer:
|
|
35693
|
-
image: ${indexerImage}
|
|
35694
|
-
environment:
|
|
35695
|
-
DATABASE_URL: ${dbUrl}
|
|
35696
|
-
PORT: 3700
|
|
35697
|
-
NODE_ENV: production
|
|
35698
|
-
# Keep every network key aligned: the indexer writes index_progress under
|
|
35699
|
-
# STACKS_NETWORK, the subgraph processor reads it under NETWORK. If they
|
|
35700
|
-
# differ, catch-up finds no progress row and subgraphs never advance.
|
|
35701
|
-
NETWORKS: testnet
|
|
35702
|
-
STACKS_NETWORK: testnet
|
|
35703
|
-
NETWORK: testnet
|
|
35673
|
+
# Signed deliveries, so receivers can test verification. Publicly known.
|
|
35674
|
+
SECONDLAYER_WEBHOOK_SIGNING_PRIVATE_KEY: "${DEV_WEBHOOK_SIGNING_KEY}"
|
|
35675
|
+
# The emitter blocks webhook delivery to private/loopback IPs by default.
|
|
35676
|
+
# On a local devnet you deliver to your own localhost receiver, so allow it.
|
|
35677
|
+
SECONDLAYER_ALLOW_PRIVATE_EGRESS: "true"
|
|
35678
|
+
# An OSS indexer with no index_progress spools observer blocks until an
|
|
35679
|
+
# archive import finishes. A devnet has no archive, so ingest live.
|
|
35680
|
+
INGEST_MODE: live
|
|
35704
35681
|
# Fed by the devnet node's event observer — never reach out to Hiro mainnet.
|
|
35705
35682
|
AUTO_BACKFILL_ENABLED: "false"
|
|
35706
35683
|
TIP_FOLLOWER_ENABLED: "false"
|
|
35707
|
-
|
|
35708
|
-
|
|
35709
|
-
|
|
35710
|
-
|
|
35684
|
+
# clarinet publishes the devnet node RPC on the host's 20443.
|
|
35685
|
+
STACKS_NODE_RPC_URL: http://host.docker.internal:20443
|
|
35686
|
+
STREAMS_API_URL: http://127.0.0.1:3800
|
|
35687
|
+
SUBGRAPH_SOURCE: streams-index
|
|
35688
|
+
SUBGRAPH_INDEX_API_URL: http://127.0.0.1:3800
|
|
35689
|
+
NODE_ENV: production
|
|
35690
|
+
# The api is loopback-only; the indexer is deliberately published on every
|
|
35691
|
+
# interface: the devnet's stacks-node runs in its own container and POSTs
|
|
35692
|
+
# events to host.docker.internal:3700, which resolves to the host gateway
|
|
35693
|
+
# address, not 127.0.0.1. A loopback publish would drop every block.
|
|
35711
35694
|
ports:
|
|
35695
|
+
- "${apiPublish}:3800"
|
|
35712
35696
|
- "${indexerPort}:3700"
|
|
35713
35697
|
extra_hosts:
|
|
35714
35698
|
- "host.docker.internal:host-gateway"
|
|
35699
|
+
volumes:
|
|
35700
|
+
- subgraphs_data:/data/subgraphs
|
|
35715
35701
|
depends_on:
|
|
35716
|
-
migrate:
|
|
35717
|
-
condition: service_completed_successfully
|
|
35718
35702
|
postgres:
|
|
35719
35703
|
condition: service_healthy
|
|
35720
35704
|
healthcheck:
|
|
35721
|
-
test: ["CMD", "curl", "-f", "http://localhost:
|
|
35705
|
+
test: ["CMD", "curl", "-f", "http://localhost:3800/health"]
|
|
35722
35706
|
interval: 10s
|
|
35723
35707
|
timeout: 3s
|
|
35724
|
-
start_period:
|
|
35708
|
+
start_period: 40s
|
|
35725
35709
|
retries: 5
|
|
35726
35710
|
restart: unless-stopped
|
|
35727
35711
|
|
|
35728
|
-
subgraph-processor:
|
|
35729
|
-
image: ${apiImage}
|
|
35730
|
-
command: ["bun", "run", "packages/subgraphs/src/service.ts"]
|
|
35731
|
-
environment:
|
|
35732
|
-
DATABASE_URL: ${dbUrl}
|
|
35733
|
-
NODE_ENV: production
|
|
35734
|
-
DATA_DIR: /data
|
|
35735
|
-
# Must match the indexer's network key (see indexer note) — catch-up reads
|
|
35736
|
-
# index_progress under NETWORK.
|
|
35737
|
-
NETWORK: testnet
|
|
35738
|
-
STACKS_NETWORK: testnet
|
|
35739
|
-
# The emitter blocks webhook delivery to private/loopback IPs by default.
|
|
35740
|
-
# On a local devnet you deliver to your own localhost receiver, so allow it.
|
|
35741
|
-
SECONDLAYER_ALLOW_PRIVATE_EGRESS: "true"
|
|
35742
|
-
# Must match the api's key so the emitter can decrypt signing secrets.
|
|
35743
|
-
SECONDLAYER_SECRETS_KEY: ${DEV_SECRETS_KEY}
|
|
35744
|
-
volumes:
|
|
35745
|
-
- subgraphs_data:/data/subgraphs
|
|
35746
|
-
depends_on:
|
|
35747
|
-
migrate:
|
|
35748
|
-
condition: service_completed_successfully
|
|
35749
|
-
postgres:
|
|
35750
|
-
condition: service_healthy
|
|
35751
|
-
healthcheck:
|
|
35752
|
-
disable: true
|
|
35753
|
-
restart: unless-stopped
|
|
35754
|
-
|
|
35755
35712
|
volumes:
|
|
35756
35713
|
postgres_data:
|
|
35757
35714
|
subgraphs_data:
|
|
@@ -35966,13 +35923,7 @@ function dockerCompose(composePath, args) {
|
|
|
35966
35923
|
}
|
|
35967
35924
|
var API_URL = (process.env.SECONDLAYER_API_URL || LOCAL_API_URL).replace(/\/+$/, "");
|
|
35968
35925
|
var INDEXER_URL = process.env.INDEXER_URL ?? "http://localhost:3700";
|
|
35969
|
-
var SERVICES = [
|
|
35970
|
-
"indexer",
|
|
35971
|
-
"api",
|
|
35972
|
-
"subgraph-processor",
|
|
35973
|
-
"postgres",
|
|
35974
|
-
"migrate"
|
|
35975
|
-
];
|
|
35926
|
+
var SERVICES = ["secondlayer", "postgres"];
|
|
35976
35927
|
function registerDevnetCommand(program) {
|
|
35977
35928
|
const devnet = program.command("devnet").description("Run Secondlayer services against a local Clarinet devnet");
|
|
35978
35929
|
registerFaucetCommand(devnet);
|
|
@@ -35985,7 +35936,7 @@ function registerDevnetCommand(program) {
|
|
|
35985
35936
|
devnet.command("status").description("Snapshot of the local stack: ingest, subgraphs, and recent activity").option("-w, --watch", "Refresh every 2s until Ctrl-C").option("--limit <n>", "Recent activity rows to show", "12").action(async (options) => {
|
|
35986
35937
|
await status(options);
|
|
35987
35938
|
});
|
|
35988
|
-
devnet.command("logs [service]").description("Tail stack logs — all services, or one of:
|
|
35939
|
+
devnet.command("logs [service]").description("Tail stack logs — all services, or one of: secondlayer, postgres").option("--project <dir>", "Clarinet project directory").option("-f, --follow", "Follow log output").option("-n, --lines <n>", "Lines to show from the end of each log").action(async (service, options) => {
|
|
35989
35940
|
await logs(service, options);
|
|
35990
35941
|
});
|
|
35991
35942
|
}
|
|
@@ -36029,6 +35980,11 @@ Skipped docker. Start it with:
|
|
|
36029
35980
|
}
|
|
36030
35981
|
ensureDocker();
|
|
36031
35982
|
console.log(dim(`
|
|
35983
|
+
Pulling latest images…`));
|
|
35984
|
+
if (dockerCompose(composePath, ["pull"]) !== 0) {
|
|
35985
|
+
console.log(yellow("couldn't pull the latest images — starting with what's cached"));
|
|
35986
|
+
}
|
|
35987
|
+
console.log(dim(`
|
|
36032
35988
|
Starting Secondlayer stack (docker compose up -d)…`));
|
|
36033
35989
|
if (dockerCompose(composePath, ["up", "-d"]) !== 0) {
|
|
36034
35990
|
error("docker compose up failed — see output above.");
|
|
@@ -36105,7 +36061,7 @@ var SYS_COLS = new Set([
|
|
|
36105
36061
|
"tx_id"
|
|
36106
36062
|
]);
|
|
36107
36063
|
function shortVal(v) {
|
|
36108
|
-
const s = String(v);
|
|
36064
|
+
const s = typeof v === "object" && v !== null ? JSON.stringify(v) : String(v);
|
|
36109
36065
|
return s.length > 18 ? `${s.slice(0, 6)}…${s.slice(-4)}` : s;
|
|
36110
36066
|
}
|
|
36111
36067
|
async function renderStatus(limit) {
|
|
@@ -37781,5 +37737,5 @@ registerCreditsCommand(program);
|
|
|
37781
37737
|
registerArchiveCommand(program);
|
|
37782
37738
|
program.parse();
|
|
37783
37739
|
|
|
37784
|
-
//# debugId=
|
|
37740
|
+
//# debugId=599D8A8ADF6556BF64756E2164756E21
|
|
37785
37741
|
//# sourceMappingURL=cli.js.map
|