Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
932 changes: 762 additions & 170 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions typescript/Dockerfile.node-service
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Unified Dockerfile for NCC-bundled TypeScript node services
# Used by: rebalancer, warp-monitor
# Used by: rebalancer, warp-monitor, ccip-server
#
# Build args (passed from docker-bake.hcl):
# SERVICE_DIR - Directory name under typescript/ (e.g., "rebalancer")
# SERVICE_PACKAGE - Package name for turbo filter (e.g., "@hyperlane-xyz/rebalancer")
# SERVICE_PORT - Optional HTTP port (default: none, only metrics on 9090)

FROM node:24-slim AS builder

Expand Down Expand Up @@ -54,6 +55,13 @@ COPY solidity/package.json ./solidity/
COPY solhint-plugin/package.json ./solhint-plugin/
COPY starknet/package.json ./starknet/

# Copy prisma schema if present (needed for postinstall prisma generate in ccip-server)
RUN --mount=type=bind,source=typescript/${SERVICE_DIR},target=/tmp/service-src \
if [ -d /tmp/service-src/prisma ]; then \
mkdir -p typescript/${SERVICE_DIR} && \
cp -r /tmp/service-src/prisma typescript/${SERVICE_DIR}/prisma; \
fi

RUN pnpm install --frozen-lockfile

# Copy source files
Expand Down Expand Up @@ -116,11 +124,13 @@ RUN GCP_LOGGER_VERSION=$(grep "pino-logging-gcp-config" /tmp/pnpm-workspace.yaml

# Environment variables
ARG SERVICE_VERSION=dev
ARG SERVICE_PORT
ENV NODE_ENV=production
ENV LOG_LEVEL=info
ENV SERVICE_VERSION=${SERVICE_VERSION}
ENV SERVER_PORT=${SERVICE_PORT}

# Expose metrics port
# Expose metrics port; service port published at runtime with -p if needed
EXPOSE 9090

# Run the service from the bundle
Expand Down
1 change: 1 addition & 0 deletions typescript/ccip-server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/configs
/prisma/dev.db
/src/generated
/bundle

# allow check-in of .env.example
!.env.example
129 changes: 0 additions & 129 deletions typescript/ccip-server/Dockerfile

This file was deleted.

2 changes: 2 additions & 0 deletions typescript/ccip-server/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export default [
'**/tests/*',
'src/**/*.js',
'src/generated/**',
'bundle/**',
'prisma/config.ts',
],
},
];
9 changes: 7 additions & 2 deletions typescript/ccip-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"postinstall": "prisma generate",
"build": "prisma generate && tsc -p tsconfig.json",
"bundle": "rm -rf ./bundle && ncc build ./dist/server.js -o bundle -e @google-cloud/pino-logging-gcp-config && node ../../scripts/ncc.post-bundle.mjs",
"start": "tsx src/server.ts",
"dev": "NODE_ENV=development LOG_FORMAT=pretty tsx watch src/server.ts",
"test": "jest",
Expand All @@ -31,9 +32,11 @@
"@types/cors": "^2",
"@types/express": "^4.17.1",
"@types/node": "catalog:",
"@types/pg": "^8.16.0",
"@types/pino-http": "^5.8.4",
"@typescript-eslint/eslint-plugin": "catalog:",
"@typescript-eslint/parser": "catalog:",
"@vercel/ncc": "catalog:",
"eslint": "catalog:",
"eslint-import-resolver-typescript": "catalog:",
"jest": "^29.7.0",
Expand All @@ -56,13 +59,15 @@
"@hyperlane-xyz/sdk": "workspace:*",
"@hyperlane-xyz/utils": "workspace:*",
"pino": "catalog:",
"@prisma/client": "^6.8.2",
"@prisma/adapter-pg": "^7.3.0",
"@prisma/client": "^7.3.0",
"cors": "^2.8.5",
"dotenv-flow": "^4.1.0",
"ethers": "catalog:",
"express": "^4.17.1",
"pg": "^8.17.2",
"pino-http": "^8.6.1",
"prisma": "^6.8.2",
"prisma": "^7.3.0",
"prom-client": "catalog:",
"zod": "catalog:"
}
Expand Down
11 changes: 11 additions & 0 deletions typescript/ccip-server/prisma/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { defineConfig, env } from 'prisma/config';

export default defineConfig({
schema: 'prisma/schema.prisma',
migrations: {
path: 'prisma/migrations',
},
datasource: {
url: env('DATABASE_URL'),
},
});
5 changes: 2 additions & 3 deletions typescript/ccip-server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
provider = "prisma-client"
output = "../src/generated/prisma"
}

// DATABASE_URL is required for prisma generate but actual connection is handled in code
// DATABASE_URL is now configured in prisma.config.ts (Prisma 7 requirement)
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model Commitment {
Expand Down
7 changes: 6 additions & 1 deletion typescript/ccip-server/src/db.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import { PrismaPg } from '@prisma/adapter-pg';
import pg from 'pg';

import { PrismaClient } from './generated/prisma/client.js';

export const prisma = new PrismaClient();
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
const adapter = new PrismaPg(pool);
export const prisma = new PrismaClient({ adapter });
5 changes: 3 additions & 2 deletions typescript/ccip-server/turbo.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"extends": ["//"],
"tasks": {
"build": {
"outputs": ["dist/**", "src/generated/**"]
"bundle": {
"dependsOn": ["build"],
"outputs": ["bundle/**"]
}
}
}
25 changes: 5 additions & 20 deletions typescript/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ variable "REGISTRY" {

# Default group builds all targets
group "default" {
targets = ["ncc-services", "ccip-server"]
targets = ["ncc-services"]
}

# NCC-bundled services using the unified Dockerfile
target "ncc-services" {
name = item.name
matrix = {
item = [
{ name = "rebalancer", dir = "rebalancer", package = "@hyperlane-xyz/rebalancer", image = "hyperlane-rebalancer" },
{ name = "warp-monitor", dir = "warp-monitor", package = "@hyperlane-xyz/warp-monitor", image = "hyperlane-warp-monitor" },
{ name = "rebalancer", dir = "rebalancer", package = "@hyperlane-xyz/rebalancer", image = "hyperlane-rebalancer", port = "" },
{ name = "warp-monitor", dir = "warp-monitor", package = "@hyperlane-xyz/warp-monitor", image = "hyperlane-warp-monitor", port = "" },
{ name = "ccip-server", dir = "ccip-server", package = "@hyperlane-xyz/ccip-server", image = "hyperlane-offchain-lookup-server", port = "3000" },
]
}

Expand All @@ -54,27 +55,11 @@ target "ncc-services" {
SERVICE_VERSION = SERVICE_VERSION
SERVICE_DIR = item.dir
SERVICE_PACKAGE = item.package
SERVICE_PORT = item.port
}

tags = compact([
"${REGISTRY}/${item.image}:${TAG}",
TAG_SHA_DATE != "" ? "${REGISTRY}/${item.image}:${TAG_SHA_DATE}" : "",
])
}

# CCIP server requires separate Dockerfile due to Prisma
target "ccip-server" {
dockerfile = "typescript/ccip-server/Dockerfile"
context = "."
platforms = split(",", PLATFORMS)

args = {
FOUNDRY_VERSION = FOUNDRY_VERSION
SERVICE_VERSION = SERVICE_VERSION
}

tags = compact([
"${REGISTRY}/hyperlane-offchain-lookup-server:${TAG}",
TAG_SHA_DATE != "" ? "${REGISTRY}/hyperlane-offchain-lookup-server:${TAG_SHA_DATE}" : "",
])
}
Loading