diff --git a/backend/server.ts b/backend/server.ts index 707fcd3..7b989b0 100644 --- a/backend/server.ts +++ b/backend/server.ts @@ -7,7 +7,7 @@ const port = 8090; app.use(cors()); -app.post('/command', (req, res) => { +app.post('/api/command', (req, res) => { executeCommand(); res.status(200).send('Command executed\n'); }); diff --git a/ingress.yaml b/ingress.yaml index a1acb56..763fe2f 100644 --- a/ingress.yaml +++ b/ingress.yaml @@ -8,24 +8,27 @@ metadata: spec: ingressClassName: nginx rules: - - host: 192-168-197-2.c-one-infra.de - http: - paths: - - path: /iching/api(/|$)(.*) - pathType: ImplementationSpecific - backend: - service: - name: iching-service - port: - number: 81 - - path: /iching(/|$)(.*) - pathType: ImplementationSpecific - backend: - service: - name: iching-service - port: - number: 80 + - host: 192-168-197-2.c-one-infra.de + http: + paths: + # API → kein Rewrite + - path: /iching/api(/|$)(.*) + pathType: ImplementationSpecific + backend: + service: + name: iching-service + port: + number: 81 + + # Frontend → mit Rewrite + - path: /iching(/|$)(.*) + pathType: ImplementationSpecific + backend: + service: + name: iching-service + port: + number: 80 tls: - - hosts: - - 192-168-197-2.c-one-infra.de - secretName: argocd-net-tls \ No newline at end of file + - hosts: + - 192-168-197-2.c-one-infra.de + secretName: argocd-net-tls \ No newline at end of file diff --git a/old.2.Dockerfile b/old.2.Dockerfile deleted file mode 100644 index fb7a8f1..0000000 --- a/old.2.Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -# 1. Node.js Build-Stage -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1 AS build - -WORKDIR /app - -COPY package*.json ./ -COPY . . - -RUN npm install -g npm@11.2.0 -RUN npm install - -#RUN npx tsc -p tsconfig.json -RUN npx tsc -p tsconfig.backend.json -RUN npx tsc -p tsconfig.frontend.json - - -### NEW # Danach: -RUN find dist/backend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \; - - -# 2. Rust build-Stage -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/rust:1.74.0 AS rust-build -RUN cargo install iching - -# 3. Final runtime -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1 - -WORKDIR /app - -### NEW ### -COPY --from=build /app/node_modules ./node_modules - -COPY --from=build /app/dist ./dist -#COPY --from=build /app/index.html ./dist/ -COPY --from=build /app/frontend/index.html ./dist/frontend/ - -COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching - -RUN find dist/backend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \; -RUN find dist/frontend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \; - -RUN node dist/backend/server.mjs & - -#CMD ["npx", "http-server", "dist", "-p", "8080", "--mime", "application/javascript=js"] -CMD ["npx", "http-server", "dist/frontend", "-p", "8080", "--mime", "application/javascript=js"] \ No newline at end of file diff --git a/old.3.Dockerfile b/old.3.Dockerfile deleted file mode 100644 index 9b7cddc..0000000 --- a/old.3.Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -# 1. Node.js Build-Stage -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1 AS build - -WORKDIR /app - -COPY package*.json ./ -COPY tsconfig.json ./ -COPY tsconfig.backend.json ./ -COPY . . - -RUN npm install -g npm@11.2.0 -RUN npm install - -# Kompiliere zuerst den Backend-Code, sodass broker.mjs und andere Dateien erzeugt werden -RUN npx tsc -p tsconfig.backend.json - -# Danach können wir die Frontend-Dateien auch kompilieren -RUN npx tsc -p tsconfig.frontend.json - -# 2. Rust build-Stage -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/rust:1.74.0 AS rust-build -RUN cargo install iching - -# 3. Final runtime -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1 - -WORKDIR /app - -# Kopiere Node-Modules und alle generierten Dateien -COPY --from=build /app/node_modules ./node_modules -COPY --from=build /app/dist ./dist -COPY --from=build /app/frontend/index.html ./dist/frontend/ - -COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching - -# Falls notwendig: Umbenennen von .js zu .mjs -#RUN find dist/backend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \; -RUN find dist/frontend -name "*.js" -exec bash -c 'mv "$0" "${0%.js}.mjs"' {} \; - -# Starte den Backend-Server -#RUN node dist/backend/server.js & -CMD ["node", "--loader", "ts-node/esm", "/app/dist/backend/server.js"] - -# Starte den Frontend-Server -CMD ["npx", "http-server", "dist/frontend", "-p", "8080", "--mime", "application/javascript=js"] \ No newline at end of file diff --git a/old.Dockerfile b/old.Dockerfile deleted file mode 100644 index ab906a8..0000000 --- a/old.Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -# 1. Node.js Build-Stage -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1 AS build - -WORKDIR /app - -COPY package*.json ./ -COPY . . - -RUN npm install -g npm@11.2.0 - -#RUN npx tsc -#RUN npx tsc -p tsconfig.json -#RUN npx tsc event.ts -#RUN npx tsc broker.ts -#RUN npx tsc server.ts -RUN npx tsc -p tsconfig.json - -RUN cp index.html dist/ - - -# 2. Rust build-Stage -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/rust:1.74.0 AS rust-build -RUN cargo install iching - - -# 3. Final node.js runtime-Stage -FROM forgejo.edf-bootstrap.cx.fg1.ffm.osc.live/devfw-cicd/node:20.18.1 - -WORKDIR /app - - -# 4. Copy previous builds -COPY --from=build /app . -COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching - -# Lege das /iching-Verzeichnis in dist an -RUN mkdir -p dist/iching - -# Kopiere HTML und JS-Dateien hinein -RUN cp index.html dist/iching/ -RUN cp dist/*.js dist/iching/ - - -# 5. Run server & app - -RUN node server.js - -CMD ["npx", "http-server", "dist", "-p", "8080", "--mime", "application/javascript=js"] diff --git a/old.ingress.yaml b/old.ingress.yaml index 9482165..a1acb56 100644 --- a/old.ingress.yaml +++ b/old.ingress.yaml @@ -11,8 +11,15 @@ spec: - host: 192-168-197-2.c-one-infra.de http: paths: + - path: /iching/api(/|$)(.*) + pathType: ImplementationSpecific + backend: + service: + name: iching-service + port: + number: 81 - path: /iching(/|$)(.*) - pathType: ImplementationSpecific + pathType: ImplementationSpecific backend: service: name: iching-service diff --git a/old.service.yaml b/old.service.yaml deleted file mode 100644 index 2b810e0..0000000 --- a/old.service.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: iching-service - namespace: argocd -spec: - selector: - app: iching-broker - ports: - - protocol: TCP - port: 80 - targetPort: 8080 - type: ClusterIP \ No newline at end of file diff --git a/old.tsconfig.backend.json b/old.tsconfig.backend.json deleted file mode 100644 index a861f5d..0000000 --- a/old.tsconfig.backend.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./dist/backend", // Zielordner für die kompilierte Backend-Dateien - "rootDir": "./backend", // Quellordner - "module": "NodeNext", // Nutze ES-Modul für Node.js - "moduleResolution": "NodeNext", // NodeNext für die Modulauflösung - "target": "ES2020", // Zielversion - "esModuleInterop": true, // Interoperabilität mit CommonJS und ES-Modulen - "allowSyntheticDefaultImports": true, - "skipLibCheck": true, - "allowJs": true, // Erlaubt es, .js und .mjs Dateien zu importieren - "noEmit": false, // Dateien sollen tatsächlich erzeugt werden (keine Deklarationsdateien) - "resolveJsonModule": true, - "jsx": "react", - "isolatedModules": true - }, - "include": [ - "backend/**/*.ts" - ] -} \ No newline at end of file diff --git a/old.tsconfig.broker.json b/old.tsconfig.broker.json deleted file mode 100644 index 1b7a0c8..0000000 --- a/old.tsconfig.broker.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./dist/backend", - "rootDir": "./backend", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "target": "ES2020", - "esModuleInterop": true, - "skipLibCheck": true - }, - "include": [ - "backend/broker.ts" - ] -} \ No newline at end of file