diff --git a/Dockerfile b/Dockerfile index 59696ab5..4ee4e70c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,10 +24,10 @@ RUN --mount=type=cache,id=workspace,target=/root/.local/share/pnpm/store pnpm in # Build stage for the server. FROM base AS build # TODO: Remove this when we switch to an actual database. -ENV DATABASE_URL="file:./dev.db" +# ENV DATABASE_URL="file:./dev.db" RUN \ # TODO: This initalizes the database. But we should probably remove this later. - pnpm --filter server prisma migrate reset --force && \ + # pnpm --filter server prisma migrate reset --force && \ # Build the monorepo packages pnpm build && \ # Generate the prisma client @@ -48,6 +48,7 @@ FROM node:22-alpine AS server WORKDIR /app COPY --from=build /workspace/deployment/out . # TODO: Remove this when we switch to an actual database. -ENV DATABASE_URL="file:./dev.db" +ENV DATABASE_URL="file:/mnt/hypergraph_data/production.sqlite" +RUN npm run prisma migrate deploy --skip-generate EXPOSE 3030 -CMD ["node", "dist/index.js"] +CMD ["sh", "-c", "npm run prisma migrate deploy && node dist/index.js"] \ No newline at end of file diff --git a/apps/server/package.json b/apps/server/package.json index 0859b3c8..22077187 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -21,6 +21,7 @@ "cors": "^2.8.5", "effect": "^3.16.3", "express": "^5.1.0", + "prisma": "^6.7.0", "siwe": "^3.0.0", "viem": "^2.29.0", "ws": "^8.18.2" @@ -31,7 +32,6 @@ "@types/node": "^22.15.15", "@types/pg": "^8.15.0", "@types/ws": "^8.18.1", - "prisma": "^6.7.0", "tsup": "^8.4.0", "typescript": "^5.8.3" } diff --git a/fly.toml b/fly.toml index 19e88a83..adb11b22 100644 --- a/fly.toml +++ b/fly.toml @@ -9,14 +9,21 @@ primary_region = 'fra' [build] [http_service] - internal_port = 3030 - force_https = true - auto_stop_machines = 'stop' - auto_start_machines = true - min_machines_running = 0 - processes = ['app'] +internal_port = 3030 +force_https = true +auto_stop_machines = 'stop' +auto_start_machines = true +min_machines_running = 0 +processes = ['app'] [[vm]] - memory = '1gb' - cpu_kind = 'shared' - cpus = 1 +memory = '1gb' +cpu_kind = 'shared' +cpus = 1 + +[mounts] +source = "hypergraph_data" +destination = "/mnt/hypergraph_data" + +# [deploy] +# release_command = "/bin/sh -c 'npm run prisma migrate deploy --skip-generate'" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c4e9b6dc..14bdb4d0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -179,7 +179,7 @@ importers: version: 7.1.2(graphql@16.11.0) isomorphic-ws: specifier: ^5.0.0 - version: 5.0.0(ws@8.18.2(bufferutil@4.0.9)(utf-8-validate@5.0.10)) + version: 5.0.0(ws@8.18.1(bufferutil@4.0.9)(utf-8-validate@5.0.10)) lucide-react: specifier: ^0.508.0 version: 0.508.0(react@19.1.0) @@ -314,6 +314,9 @@ importers: express: specifier: ^5.1.0 version: 5.1.0 + prisma: + specifier: ^6.7.0 + version: 6.7.0(typescript@5.8.3) siwe: specifier: ^3.0.0 version: 3.0.0(ethers@6.13.5(bufferutil@4.0.9)(utf-8-validate@5.0.10)) @@ -339,9 +342,6 @@ importers: '@types/ws': specifier: ^8.18.1 version: 8.18.1 - prisma: - specifier: ^6.7.0 - version: 6.7.0(typescript@5.8.3) tsup: specifier: ^8.4.0 version: 8.4.0(@swc/core@1.11.24(@swc/helpers@0.5.17))(jiti@2.4.2)(postcss@8.5.3)(tsx@4.19.4)(typescript@5.8.3)(yaml@2.7.0) @@ -22022,6 +22022,10 @@ snapshots: dependencies: ws: 7.5.10(bufferutil@4.0.9)(utf-8-validate@5.0.10) + isomorphic-ws@5.0.0(ws@8.18.1(bufferutil@4.0.9)(utf-8-validate@5.0.10)): + dependencies: + ws: 8.18.1(bufferutil@4.0.9)(utf-8-validate@5.0.10) + isomorphic-ws@5.0.0(ws@8.18.2(bufferutil@4.0.9)(utf-8-validate@5.0.10)): dependencies: ws: 8.18.2(bufferutil@4.0.9)(utf-8-validate@5.0.10)