mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-24 18:48:28 +00:00
Fix: done docker setup
This commit is contained in:
parent
d111220aca
commit
26661cfd86
@ -1,5 +1,3 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
||||||
import type { NodePopupContent, EdgePopupContent } from "./type";
|
import type { NodePopupContent, EdgePopupContent } from "./type";
|
||||||
import { getNodeColor } from "./node-colors";
|
import { getNodeColor } from "./node-colors";
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { useState, useMemo, forwardRef } from "react";
|
import { useState, useMemo, forwardRef } from "react";
|
||||||
import { Graph, type GraphRef } from "./graph";
|
import { Graph, type GraphRef } from "./graph";
|
||||||
import { GraphPopovers } from "./graph-popover";
|
import { GraphPopovers } from "./graph-popover";
|
||||||
@ -7,7 +5,6 @@ import type { RawTriplet, NodePopupContent, EdgePopupContent } from "./type";
|
|||||||
|
|
||||||
import { createLabelColorMap } from "./node-colors";
|
import { createLabelColorMap } from "./node-colors";
|
||||||
|
|
||||||
import { useTheme } from "remix-themes";
|
|
||||||
import { toGraphTriplets } from "./utils";
|
import { toGraphTriplets } from "./utils";
|
||||||
|
|
||||||
interface GraphVisualizationProps {
|
interface GraphVisualizationProps {
|
||||||
@ -29,9 +26,6 @@ export const GraphVisualization = forwardRef<GraphRef, GraphVisualizationProps>(
|
|||||||
},
|
},
|
||||||
ref,
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const [resolvedTheme] = useTheme();
|
|
||||||
const isDarkMode = resolvedTheme === "dark";
|
|
||||||
|
|
||||||
// Graph state for popovers
|
// Graph state for popovers
|
||||||
const [showNodePopup, setShowNodePopup] = useState<boolean>(false);
|
const [showNodePopup, setShowNodePopup] = useState<boolean>(false);
|
||||||
const [showEdgePopup, setShowEdgePopup] = useState<boolean>(false);
|
const [showEdgePopup, setShowEdgePopup] = useState<boolean>(false);
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { Button } from "./button";
|
import { Button } from "./button";
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
|
|||||||
@ -45,6 +45,7 @@
|
|||||||
"@remix-run/v1-meta": "^0.1.3",
|
"@remix-run/v1-meta": "^0.1.3",
|
||||||
"@remixicon/react": "^4.2.0",
|
"@remixicon/react": "^4.2.0",
|
||||||
"@tanstack/react-table": "^8.13.2",
|
"@tanstack/react-table": "^8.13.2",
|
||||||
|
"@prisma/client": "*",
|
||||||
"@tailwindcss/container-queries": "^0.1.1",
|
"@tailwindcss/container-queries": "^0.1.1",
|
||||||
"@tailwindcss/postcss": "^4.1.7",
|
"@tailwindcss/postcss": "^4.1.7",
|
||||||
"ai": "4.3.14",
|
"ai": "4.3.14",
|
||||||
@ -112,6 +113,7 @@
|
|||||||
"eslint-plugin-react": "^7.33.2",
|
"eslint-plugin-react": "^7.33.2",
|
||||||
"eslint-plugin-react-hooks": "^4.6.2",
|
"eslint-plugin-react-hooks": "^4.6.2",
|
||||||
"eslint-plugin-turbo": "^2.0.4",
|
"eslint-plugin-turbo": "^2.0.4",
|
||||||
|
"npm-run-all": "^4.1.5",
|
||||||
"postcss": "^8.4.38",
|
"postcss": "^8.4.38",
|
||||||
"postcss-import": "^16.0.1",
|
"postcss-import": "^16.0.1",
|
||||||
"postcss-loader": "^8.1.1",
|
"postcss-loader": "^8.1.1",
|
||||||
|
|||||||
@ -3,49 +3,54 @@ import compression from "compression";
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import morgan from "morgan";
|
import morgan from "morgan";
|
||||||
|
|
||||||
const viteDevServer =
|
let viteDevServer;
|
||||||
process.env.NODE_ENV === "production"
|
let remixHandler;
|
||||||
? undefined
|
|
||||||
: await import("vite").then((vite) =>
|
|
||||||
vite.createServer({
|
|
||||||
server: { middlewareMode: true },
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const remixHandler = createRequestHandler({
|
async function init() {
|
||||||
build: viteDevServer
|
if (process.env.NODE_ENV !== "production") {
|
||||||
|
const vite = await import("vite");
|
||||||
|
viteDevServer = await vite.createServer({
|
||||||
|
server: { middlewareMode: true },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const build = viteDevServer
|
||||||
? () => viteDevServer.ssrLoadModule("virtual:remix/server-build")
|
? () => viteDevServer.ssrLoadModule("virtual:remix/server-build")
|
||||||
: await import("./build/server/index.js"),
|
: await import("./build/server/index.js");
|
||||||
});
|
|
||||||
|
|
||||||
const app = express();
|
remixHandler = createRequestHandler({ build });
|
||||||
|
|
||||||
app.use(compression());
|
const app = express();
|
||||||
|
|
||||||
// http://expressjs.com/en/advanced/best-practice-security.html#at-a-minimum-disable-x-powered-by-header
|
app.use(compression());
|
||||||
app.disable("x-powered-by");
|
|
||||||
|
|
||||||
// handle asset requests
|
// http://expressjs.com/en/advanced/best-practice-security.html#at-a-minimum-disable-x-powered-by-header
|
||||||
if (viteDevServer) {
|
app.disable("x-powered-by");
|
||||||
app.use(viteDevServer.middlewares);
|
|
||||||
} else {
|
// handle asset requests
|
||||||
// Vite fingerprints its assets so we can cache forever.
|
if (viteDevServer) {
|
||||||
app.use(
|
app.use(viteDevServer.middlewares);
|
||||||
"/assets",
|
} else {
|
||||||
express.static("build/client/assets", { immutable: true, maxAge: "1y" }),
|
// Vite fingerprints its assets so we can cache forever.
|
||||||
|
app.use(
|
||||||
|
"/assets",
|
||||||
|
express.static("build/client/assets", { immutable: true, maxAge: "1y" }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Everything else (like favicon.ico) is cached for an hour. You may want to be
|
||||||
|
// more aggressive with this caching.
|
||||||
|
app.use(express.static("build/client", { maxAge: "1h" }));
|
||||||
|
|
||||||
|
app.use(morgan("tiny"));
|
||||||
|
|
||||||
|
// handle SSR requests
|
||||||
|
app.all("*", remixHandler);
|
||||||
|
|
||||||
|
const port = process.env.REMIX_APP_PORT || 3000;
|
||||||
|
app.listen(port, () =>
|
||||||
|
console.log(`Express server listening at http://localhost:${port}`),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything else (like favicon.ico) is cached for an hour. You may want to be
|
init().catch(console.error);
|
||||||
// more aggressive with this caching.
|
|
||||||
app.use(express.static("build/client", { maxAge: "1h" }));
|
|
||||||
|
|
||||||
app.use(morgan("tiny"));
|
|
||||||
|
|
||||||
// handle SSR requests
|
|
||||||
app.all("*", remixHandler);
|
|
||||||
|
|
||||||
const port = process.env.REMIX_APP_PORT || 3000;
|
|
||||||
app.listen(port, () =>
|
|
||||||
console.log(`Express server listening at http://localhost:${port}`),
|
|
||||||
);
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ export default defineConfig({
|
|||||||
allowedHosts: true,
|
allowedHosts: true,
|
||||||
},
|
},
|
||||||
ssr: {
|
ssr: {
|
||||||
noExternal: ["helix-ts"],
|
noExternal: ["@core/database", "tailwindcss"],
|
||||||
|
external: ["@prisma/client"],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,7 +5,7 @@ FROM ${NODE_IMAGE} AS pruner
|
|||||||
WORKDIR /core
|
WORKDIR /core
|
||||||
|
|
||||||
COPY --chown=node:node . .
|
COPY --chown=node:node . .
|
||||||
RUN npx -q turbo@1.10.9 prune --scope=webapp --docker
|
RUN npx -q turbo@2.5.3 prune --scope=webapp --docker
|
||||||
RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
|
RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
|
||||||
|
|
||||||
# Base strategy to have layer caching
|
# Base strategy to have layer caching
|
||||||
@ -60,10 +60,11 @@ WORKDIR /core
|
|||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
|
|
||||||
|
|
||||||
COPY --from=base /usr/bin/dumb-init /usr/bin/dumb-init
|
COPY --from=base /usr/bin/dumb-init /usr/bin/dumb-init
|
||||||
COPY --from=pruner --chown=node:node /core/out/full/ .
|
COPY --from=pruner --chown=node:node /core/out/full/ .
|
||||||
COPY --from=production-deps --chown=node:node /core .
|
COPY --from=production-deps --chown=node:node /core .
|
||||||
COPY --from=builder --chown=node:node /core/apps/webapp/build/server.js ./apps/webapp/build/server.js
|
COPY --from=builder --chown=node:node /core/apps/webapp/server.mjs ./apps/webapp/server.mjs
|
||||||
COPY --from=builder --chown=node:node /core/apps/webapp/build ./apps/webapp/build
|
COPY --from=builder --chown=node:node /core/apps/webapp/build ./apps/webapp/build
|
||||||
COPY --from=builder --chown=node:node /core/apps/webapp/public ./apps/webapp/public
|
COPY --from=builder --chown=node:node /core/apps/webapp/public ./apps/webapp/public
|
||||||
COPY --from=builder --chown=node:node /core/scripts ./scripts
|
COPY --from=builder --chown=node:node /core/scripts ./scripts
|
||||||
|
|||||||
@ -0,0 +1,59 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
core:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=${NODE_ENV}
|
||||||
|
- DATABASE_URL=${DATABASE_URL}
|
||||||
|
- DIRECT_URL=${DIRECT_URL}
|
||||||
|
- SESSION_SECRET=${SESSION_SECRET}
|
||||||
|
- ENCRYPTION_KEY=${ENCRYPTION_KEY}
|
||||||
|
- MAGIC_LINK_SECRET=${MAGIC_LINK_SECRET}
|
||||||
|
- LOGIN_ORIGIN=${LOGIN_ORIGIN}
|
||||||
|
- APP_ORIGIN=${APP_ORIGIN}
|
||||||
|
- REDIS_HOST=${REDIS_HOST}
|
||||||
|
- REDIS_PORT=${REDIS_PORT}
|
||||||
|
- REDIS_TLS_DISABLED=${REDIS_TLS_DISABLED}
|
||||||
|
- NEO4J_URI=${NEO4J_URI}
|
||||||
|
- NEO4J_USERNAME=${NEO4J_USERNAME}
|
||||||
|
- NEO4J_PASSWORD=${NEO4J_PASSWORD}
|
||||||
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
- redis
|
||||||
|
- neo4j
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=${POSTGRES_USER}
|
||||||
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||||
|
- POSTGRES_DB=${POSTGRES_DB}
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:7
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
|
||||||
|
neo4j:
|
||||||
|
image: neo4j:5
|
||||||
|
environment:
|
||||||
|
- NEO4J_AUTH=${NEO4J_AUTH}
|
||||||
|
ports:
|
||||||
|
- "7474:7474"
|
||||||
|
- "7687:7687"
|
||||||
|
volumes:
|
||||||
|
- neo4j_data:/data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
|
neo4j_data:
|
||||||
@ -9,10 +9,12 @@ fi
|
|||||||
pnpm --filter @core/database db:migrate:deploy
|
pnpm --filter @core/database db:migrate:deploy
|
||||||
|
|
||||||
# Copy over required prisma files
|
# Copy over required prisma files
|
||||||
|
mkdir -p apps/webapp/prisma/
|
||||||
|
mkdir -p apps/webapp/.prisma/
|
||||||
cp packages/database/prisma/schema.prisma apps/webapp/prisma/
|
cp packages/database/prisma/schema.prisma apps/webapp/prisma/
|
||||||
cp node_modules/@prisma/engines/*.node apps/webapp/prisma/
|
cp -r packages/database/node_modules/@prisma/* apps/webapp/.prisma/
|
||||||
|
# cp node_modules/@prisma/engines/*.node apps/webapp/prisma/
|
||||||
|
|
||||||
cd /core/apps/webapp
|
cd /core/apps/webapp
|
||||||
# exec dumb-init pnpm run start:local
|
# exec dumb-init pnpm run start:local
|
||||||
NODE_PATH='/core/node_modules/.pnpm/node_modules' exec dumb-init node --max-old-space-size=8192 ./build/server.js
|
NODE_PATH='/core/node_modules/.pnpm/node_modules' exec dumb-init node --max-old-space-size=8192 ./server.mjs
|
||||||
|
|
||||||
|
|||||||
@ -5,12 +5,12 @@
|
|||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "5.4.1"
|
"@prisma/client": "5.4.1",
|
||||||
|
"prisma": "5.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prisma": "5.4.1",
|
|
||||||
"rimraf": "6.0.1",
|
"rimraf": "6.0.1",
|
||||||
"esbuild": "^0.15.10"
|
"esbuild": "^0.25.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
|
|||||||
@ -1,2 +1 @@
|
|||||||
export * from "@prisma/client";
|
export * from "@prisma/client";
|
||||||
export * from "./transaction";
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prisma": "5.4.1",
|
"prisma": "5.4.1",
|
||||||
"rimraf": "6.0.1",
|
"rimraf": "6.0.1",
|
||||||
"esbuild": "^0.15.10"
|
"esbuild": "^0.25.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf dist",
|
"clean": "rimraf dist",
|
||||||
|
|||||||
2631
pnpm-lock.yaml
generated
2631
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user