Skip to content

Commit

Permalink
Added dockerfile for sequencer-node, added option to provide containe…
Browse files Browse the repository at this point in the history
…r args in cdk8s
  • Loading branch information
idan-starkware committed Nov 13, 2024
1 parent 698cddd commit 7a6e141
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
18 changes: 18 additions & 0 deletions config/sequencer/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"chain_id": "0x5",
"eth_fee_token_address": "0x6",
"strk_fee_token_address": "0x7",
"components.batcher.execution_mode": "Disabled",
"components.batcher.local_server_config.#is_none": true,
"components.consensus_manager.execution_mode": "Disabled",
"components.gateway.execution_mode": "Disabled",
"components.http_server.execution_mode": "Disabled",
"components.mempool.execution_mode": "Disabled",
"components.mempool_p2p.execution_mode": "Disabled",
"components.consensus_manager.local_server_config.#is_none": true,
"components.gateway.local_server_config.#is_none": true,
"components.http_server.local_server_config.#is_none": true,
"components.mempool.local_server_config.#is_none": true,
"components.mempool_p2p.local_server_config.#is_none": true,
"components.http_server.remote_server_config.#is_none": true
}
31 changes: 31 additions & 0 deletions deployments/images/sequencer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# syntax = devthefuture/dockerfile-x

INCLUDE deployments/images/base/Dockerfile


# Compile the sequencer_node crate in release mode, ensuring dependencies are locked.
FROM base AS builder
COPY . .
RUN cargo build --release --package starknet_sequencer_node

FROM base AS sequencer

ENV ID=1000
WORKDIR /app
COPY --from=builder /target/release/starknet_sequencer_node /app/target/release/starknet_sequencer_node
COPY config/ config/

# Create a new user "sequencer".
RUN set -ex; \
addgroup --gid ${ID} sequencer; \
adduser --ingroup $(getent group ${ID} | cut -d: -f1) --uid ${ID} --gecos "" --disabled-password --home /app sequencer; \
chown -R sequencer:sequencer /app

# Expose RPC and monitoring ports.
EXPOSE 8080 8081 8082

# Switch to the new user.
USER ${ID}

# Set the entrypoint to use tini to manage the process.
ENTRYPOINT ["tini", "--", "/app/target/release/starknet_sequencer_node"]
7 changes: 4 additions & 3 deletions deployments/sequencer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def __init__(
self.service = Service(
self,
"sequencer-node",
image="us.gcr.io/starkware-dev/sequencer-node:0.0.3",
image="us.gcr.io/starkware-dev/sequencer-node-test:0.0.1-dev.1",
args=["--config_file", "/app/config/sequencer/config.json"],
port_mappings=[
PortMappings(name="http", port=80, container_port=8080),
PortMappings(name="rpc", port=8081, container_port=8081),
Expand All @@ -49,7 +50,7 @@ def __init__(
replicas=1,
config=config,
health_check=HealthCheck(
startup_probe=Probe(port=8082, path="/monitoring/NodeVersion", period_seconds=10, failure_threshold=10, timeout_seconds=5),
startup_probe=Probe(port=8082, path="/monitoring/nodeVersion", period_seconds=10, failure_threshold=10, timeout_seconds=5),
readiness_probe=Probe(port=8082, path="/monitoring/ready", period_seconds=10, failure_threshold=5, timeout_seconds=5),
liveness_probe=Probe(port=8082, path="/monitoring/alive", period_seconds=10, failure_threshold=5, timeout_seconds=5)
),
Expand Down Expand Up @@ -99,7 +100,7 @@ def __init__(
scope=app,
name="sequencer-node",
namespace="sequencer",
config=SequencerDevConfig(mount_path="/app/config")
config=None
)
a = SequencerSystem(
scope=app,
Expand Down
4 changes: 3 additions & 1 deletion deployments/sequencer/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def __init__(
port_mappings: Optional[List[PortMappings]] = None,
config: Optional[Config] = None,
health_check: Optional[HealthCheck] = None,
pvc: Optional[PersistentVolumeClaim] = None
pvc: Optional[PersistentVolumeClaim] = None,
args: Optional[List[str]] = None
):
super().__init__(scope, id)

Expand Down Expand Up @@ -63,6 +64,7 @@ def __init__(
k8s.Container(
name="sequencer",
image=image,
args=args or [],
ports=[k8s.ContainerPort(container_port=port_map.get("container_port")) for port_map in port_mappings or []],
startup_probe=k8s.Probe(
http_get=k8s.HttpGetAction(
Expand Down

0 comments on commit 7a6e141

Please sign in to comment.