Skip to content

Commit 272e521

Browse files
committed
feat: map old env variables to new ones
1 parent 4936a8c commit 272e521

File tree

19 files changed

+596
-679
lines changed

19 files changed

+596
-679
lines changed

build/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ USER root
111111

112112
ARG DEBIAN_FRONTEND=noninteractive
113113
RUN apt-get update && apt-get install -y --no-install-recommends \
114-
libpq5 ca-certificates curl redis-tools
114+
libpq5 ca-certificates curl redis-tools redis
115115
RUN rm -rf /var/lib/apt/lists/*
116116

117117
# Copy Rust binaries
@@ -132,4 +132,4 @@ RUN chown cartesi:cartesi ${RUNTIME_DIR}
132132
WORKDIR ${RUNTIME_DIR}
133133

134134
USER cartesi
135-
CMD ["/bin/bash"]
135+
CMD ["cartesi-rollups-node"]

build/deps-compose.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
version: "3.9"
2+
3+
name: rollups-node
4+
services:
5+
devnet:
6+
image: sunodo/devnet:1.1.1
7+
command:
8+
[
9+
"anvil",
10+
"--block-time",
11+
"${BLOCK_TIME:-5}",
12+
"--load-state",
13+
"/usr/share/sunodo/anvil_state.json",
14+
]
15+
ports:
16+
- 8545:8545
17+
healthcheck:
18+
test: ["CMD", "eth_isready"]
19+
interval: 10s
20+
timeout: 1s
21+
retries: 5
22+
environment:
23+
ANVIL_IP_ADDR: 0.0.0.0
24+
volumes:
25+
- blockchain-data:/usr/share/sunodo
26+
27+
machine_snapshot_setup:
28+
image: cartesi/rollups-machine-snapshot:devel
29+
volumes:
30+
- machine:/var/opt/cartesi/machine-snapshots
31+
32+
dapp_deployer:
33+
image: cartesi/rollups-cli:1.0.2
34+
restart: on-failure
35+
depends_on:
36+
devnet:
37+
condition: service_started
38+
machine_snapshot_setup:
39+
condition: service_completed_successfully
40+
command:
41+
[
42+
"create",
43+
"--rpc",
44+
"http://devnet:8545",
45+
"--deploymentFile",
46+
"/usr/share/sunodo/localhost.json",
47+
"--mnemonic",
48+
"test test test test test test test test test test test junk",
49+
"--templateHashFile",
50+
"/var/opt/cartesi/machine-snapshots/0_0/hash",
51+
"--outputFile",
52+
"/usr/share/sunodo/dapp.json",
53+
]
54+
volumes:
55+
- machine:/var/opt/cartesi/machine-snapshots:ro
56+
- blockchain-data:/usr/share/sunodo
57+
58+
database:
59+
image: postgres:13-alpine
60+
ports:
61+
- 5432:5432
62+
healthcheck:
63+
test: ["CMD-SHELL", "pg_isready -U postgres || exit 1"]
64+
interval: 10s
65+
timeout: 5s
66+
retries: 5
67+
environment:
68+
- POSTGRES_PASSWORD=password
69+
70+
volumes:
71+
blockchain-data: {}
72+
machine: {}

build/docker-compose.yml

-206
This file was deleted.

build/node-compose.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
version: "3.9"
2+
3+
name: rollups-node
4+
services:
5+
node:
6+
image: "cartesi/rollups-node:devel"
7+
ports:
8+
- "10003:4000"
9+
- "10007:5005"
10+
restart: always
11+
depends_on:
12+
devnet:
13+
condition: service_healthy
14+
dapp_deployer:
15+
condition: service_completed_successfully
16+
machine_snapshot_setup:
17+
condition: service_completed_successfully
18+
database:
19+
condition: service_healthy
20+
environment:
21+
CARTESI_LOG_LEVEL: "info"
22+
CARTESI_LOG_TIMESTAMP: "true"
23+
CARTESI_FEATURE_HOST_MODE: "false"
24+
CARTESI_FEATURE_READER_MODE: "false"
25+
CARTESI_EPOCH_DURATION: "120"
26+
CARTESI_BLOCKCHAIN_ID: "31337"
27+
CARTESI_BLOCKCHAIN_HTTP_ENDPOINT: "http://devnet:8545"
28+
CARTESI_BLOCKCHAIN_WS_ENDPOINT: "ws://devnet:8545"
29+
CARTESI_BLOCKCHAIN_IS_LEGACY: "false"
30+
CARTESI_BLOCKCHAIN_GENESIS_BLOCK: "1"
31+
CARTESI_BLOCKCHAIN_READ_DEPTH: "1"
32+
CARTESI_CONTRACTS_DAPP_ADDRESS: "0x70ac08179605AF2D9e75782b8DEcDD3c22aA4D0C"
33+
CARTESI_CONTRACTS_DAPP_DEPLOYMENT_BLOCK_NUMBER: "1"
34+
CARTESI_CONTRACTS_HISTORY_ADDRESS: "0x4FF8BD9122b7D91d56Dd5c88FE6891Fb3c0b5281"
35+
CARTESI_CONTRACTS_AUTHORITY_ADDRESS: "0x5050F233F2312B1636eb7CF6c7876D9cC6ac4785"
36+
CARTESI_CONTRACTS_INPUT_BOX_ADDRESS: "0x59b22D57D4f067708AB0c00552767405926dc768"
37+
CARTESI_SNAPSHOT_DIR: "/var/opt/cartesi/machine-snapshots"
38+
CARTESI_AUTH_MNEMONIC: "test test test test test test test test test test test junk"
39+
CARTESI_POSTGRES_ENDPOINT: "postgres://postgres:password@database:5432/postgres"
40+
volumes:
41+
- machine:/var/opt/cartesi/machine-snapshots

cmd/cartesi-rollups-cli/root/send/send.go

-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ func init() {
5050
}
5151

5252
func run(cmd *cobra.Command, args []string) {
53-
logger.Init("info", true)
54-
5553
payload, err := hexutil.Decode(hexPayload)
5654
cobra.CheckErr(err)
5755

cmd/cartesi-rollups-node/main.go

+28-8
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,38 @@ package main
55

66
import (
77
"context"
8-
"os"
98

10-
"github.com/cartesi/rollups-node/internal/logger"
9+
"github.com/cartesi/rollups-node/internal/config"
10+
"github.com/cartesi/rollups-node/internal/services"
1111
)
1212

1313
func main() {
14-
logLevel := os.Getenv("CARTESI_LOG_LEVEL")
15-
_, enableTimestamp := os.LookupEnv("CARTESI_LOG_ENABLE_TIMESTAMP")
16-
logger.Init(logLevel, enableTimestamp)
14+
var s []services.Service
1715

18-
ctx := context.Background()
19-
if err := rootCmd.ExecuteContext(ctx); err != nil {
20-
logger.Error.Panic(err)
16+
// Start Redis first
17+
s = append(s, newRedis())
18+
19+
// Start services without dependencies
20+
s = append(s, newGraphQLServer())
21+
s = append(s, newIndexer())
22+
s = append(s, newStateServer())
23+
24+
// Start either the server manager or host runner
25+
if config.GetFeatureHostMode() {
26+
s = append(s, newHostRunner())
27+
} else {
28+
s = append(s, newServerManager())
29+
}
30+
31+
// Enable claimer if reader mode is disabled
32+
if !config.GetFeatureReaderMode() {
33+
s = append(s, newAuthorityClaimer())
2134
}
35+
36+
// Start services with dependencies
37+
s = append(s, newAdvanceRunner()) // Depends on the server-manager/host-runner
38+
s = append(s, newDispatcher()) // Depends on the state server
39+
s = append(s, newInspectServer()) // Depends on the server-manager/host-runner
40+
41+
services.Run(context.Background(), s)
2242
}

0 commit comments

Comments
 (0)