@evolu/relay 1.1.2-preview.1 → 1.1.2-preview.2

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @evolu/relay@1.1.2-preview.1 build /home/runner/work/evolu/evolu/apps/relay
2
+ > @evolu/relay@1.1.2-preview.2 build /home/runner/work/evolu/evolu/apps/relay
3
3
  > shx rm -rf dist && tsc
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # server
2
2
 
3
+ ## 1.1.2-preview.2
4
+
5
+ ### Patch Changes
6
+
7
+ - cc08e11: add shebang to CLI script
8
+
3
9
  ## 1.1.2-preview.1
4
10
 
5
11
  ### Patch Changes
package/Dockerfile CHANGED
@@ -1,66 +1,25 @@
1
- FROM node:22-alpine AS base
2
- ENV PNPM_HOME="/pnpm"
3
- ENV PATH="$PNPM_HOME:$PATH"
1
+ FROM node:22-alpine
4
2
 
5
- FROM base AS builder
6
- RUN apk update && apk add --no-cache libc6-compat
7
- WORKDIR /app
8
- RUN corepack enable pnpm
9
- RUN pnpm install -g turbo
10
- COPY . .
11
-
12
- # Generate a partial monorepo with a pruned lockfile for the relay workspace
13
- RUN turbo prune @evolu/relay --docker
14
-
15
- # ------------------------------------------------------------
16
- # Installer stage - build the pruned workspace
17
- FROM base AS installer
18
- RUN apk update && apk add --no-cache libc6-compat
19
- WORKDIR /app
20
-
21
- # Install pnpm and turbo
22
- RUN corepack enable pnpm
23
- RUN pnpm install -g turbo
3
+ # Install required dependencies and create non-root user
4
+ RUN apk add --no-cache wget && \
5
+ addgroup --system --gid 1001 nodejs && \
6
+ adduser --system --uid 1001 evolu --ingroup nodejs && \
7
+ npm install -g @evolu/relay@latest && \
8
+ mkdir -p /app/data && \
9
+ chown -R evolu:nodejs /app
24
10
 
25
- # Install dependencies from pruned lockfile
26
- COPY --from=builder /app/out/json/ .
27
- RUN pnpm install --frozen-lockfile
28
-
29
- # Copy source and build
30
- COPY --from=builder /app/out/full/ .
31
- # Ensure README.md is available at the root for the build process
32
- COPY --from=builder /app/README.md ./README.md
33
- RUN turbo run build
34
-
35
- # ------------------------------------------------------------
36
- # Runner stage - minimal runtime image
37
- FROM base AS runner
38
11
  WORKDIR /app
39
-
40
- # Create non-root user
41
- RUN addgroup --system --gid 1001 nodejs && \
42
- adduser --system --uid 1001 evolu --ingroup nodejs
43
- RUN chown evolu:nodejs /app
44
12
  USER evolu
45
13
 
46
- # Copy built application
47
- COPY --from=installer --chown=evolu:nodejs /app/apps/relay/dist ./dist
48
-
49
- # Copy the complete node_modules with all dependencies
50
- COPY --from=installer --chown=evolu:nodejs /app/node_modules ./node_modules
51
-
52
- # Copy the built workspace packages that the relay needs at runtime
53
- COPY --from=installer --chown=evolu:nodejs /app/packages/common/dist ./node_modules/@evolu/common/dist
54
- COPY --from=installer --chown=evolu:nodejs /app/packages/common/package.json ./node_modules/@evolu/common/package.json
55
- COPY --from=installer --chown=evolu:nodejs /app/packages/nodejs/dist ./node_modules/@evolu/nodejs/dist
56
- COPY --from=installer --chown=evolu:nodejs /app/packages/nodejs/package.json ./node_modules/@evolu/nodejs/package.json
14
+ ENV RELAY_PORT=4000 \
15
+ RELAY_NAME=evolu-relay \
16
+ RELAY_ENABLE_LOGGING=false \
17
+ NODE_ENV=production \
18
+ LOG_LEVEL=error
57
19
 
58
- # Expose port
59
- EXPOSE 4000
20
+ EXPOSE ${RELAY_PORT}
60
21
 
61
- # Health check
62
22
  HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
63
- CMD wget --no-verbose --tries=1 --spider http://localhost:4000 || exit 1
23
+ CMD wget --no-verbose --tries=1 --spider http://localhost:${RELAY_PORT}
64
24
 
65
- # Start the application
66
- CMD ["node", "dist/index.js"]
25
+ CMD ["sh", "-c", "node /usr/local/lib/node_modules/@evolu/relay/dist/src/cli.js start --port $RELAY_PORT --name $RELAY_NAME $([ \"$RELAY_ENABLE_LOGGING\" = \"true\" ] && echo --enable-logging)"]
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evolu/relay",
3
- "version": "1.1.2-preview.1",
3
+ "version": "1.1.2-preview.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "@evolu/relay": "dist/src/cli.js"
@@ -13,7 +13,7 @@
13
13
  "docker:build": "docker-compose build --no-cache",
14
14
  "docker:up": "docker-compose up --build",
15
15
  "docker:up:detached": "docker-compose up -d --build",
16
- "docker:down": "docker-compose down",
16
+ "docker:down": "docker-compose down -v",
17
17
  "docker:restart": "docker-compose down && docker-compose up --build",
18
18
  "docker:logs": "docker-compose logs -f evolu-relay",
19
19
  "docker:shell": "docker exec -it evolu-relay-server sh",
package/dist/src/cli.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ #!/usr/bin/env node
1
2
  export {};
2
3
  //# sourceMappingURL=cli.d.ts.map
package/dist/src/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  import { Command, Option } from "commander";
2
3
  import packageJson from "../package.json" with { type: "json" };
3
4
  import { logger } from "./logger.js";
@@ -3,19 +3,21 @@ services:
3
3
  container_name: evolu-relay-server
4
4
  image: evolu/relay:latest
5
5
  build:
6
- context: ../../
7
- dockerfile: apps/relay/Dockerfile
6
+ context: .
7
+ dockerfile: Dockerfile
8
8
  tags:
9
9
  - evolu/relay:latest
10
- - evolu/relay:dev
11
10
  ports:
12
- - "4000:4000"
11
+ - "${RELAY_PORT:-4000}:${RELAY_PORT:-4000}"
13
12
  volumes:
14
13
  # Use named volume by default, can be overridden with bind mount if needed
15
- - evolu-relay-data:/app/apps/relay/data
14
+ - evolu-relay-data:/app/data
16
15
  environment:
17
16
  - NODE_ENV=${NODE_ENV:-production}
18
- - LOG_LEVEL=${LOG_LEVEL:-info}
17
+ - LOG_LEVEL=${LOG_LEVEL:-error}
18
+ - RELAY_NAME=${RELAY_NAME:-evolu-relay}
19
+ - RELAY_PORT=${RELAY_PORT:-4000}
20
+ - RELAY_ENABLE_LOGGING=${RELAY_ENABLE_LOGGING:-false}
19
21
  restart: unless-stopped
20
22
  deploy:
21
23
  resources:
@@ -29,9 +31,11 @@ services:
29
31
  test:
30
32
  [
31
33
  "CMD",
32
- "sh",
33
- "-c",
34
- "wget --no-verbose --tries=1 --spider http://localhost:4000 2>&1 | grep -q '426 Upgrade Required' || exit 1",
34
+ "wget",
35
+ "--no-verbose",
36
+ "--tries=1",
37
+ "--spider",
38
+ "http://localhost:4000",
35
39
  ]
36
40
  interval: 30s
37
41
  timeout: 5s
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@evolu/relay",
3
- "version": "1.1.2-preview.1",
3
+ "version": "1.1.2-preview.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "@evolu/relay": "dist/src/cli.js"
7
7
  },
8
8
  "dependencies": {
9
9
  "commander": "^14.0.1",
10
- "@evolu/common": "6.0.1-preview.19",
11
- "@evolu/nodejs": "1.0.1-preview.7"
10
+ "@evolu/nodejs": "1.0.1-preview.7",
11
+ "@evolu/common": "6.0.1-preview.19"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@types/node": "^22.17.1",
@@ -29,7 +29,7 @@
29
29
  "docker:build": "docker-compose build --no-cache",
30
30
  "docker:up": "docker-compose up --build",
31
31
  "docker:up:detached": "docker-compose up -d --build",
32
- "docker:down": "docker-compose down",
32
+ "docker:down": "docker-compose down -v",
33
33
  "docker:restart": "docker-compose down && docker-compose up --build",
34
34
  "docker:logs": "docker-compose logs -f evolu-relay",
35
35
  "docker:shell": "docker exec -it evolu-relay-server sh",
package/src/cli.ts CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  import { Command, Option } from "commander";
2
4
  import packageJson from "../package.json" with { type: "json" };
3
5
  import { logger } from "./logger.js";