Skip to content

Commit 2514d6d

Browse files
committed
Deployment Ready.
1 parent e41aeaa commit 2514d6d

File tree

7 files changed

+72
-22
lines changed

7 files changed

+72
-22
lines changed

DUUIRestService/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Verwenden Sie das offizielle OpenJDK 17 Image als Basis
22
# FROM maven:3.8.5-openjdk-17
3-
FROM maven:3.9.4-eclipse-temurin-17
3+
FROM maven:3.9.4-eclipse-temurin-21
44

55
# Setzen Sie das Arbeitsverzeichnis im Container
66
WORKDIR /app

DUUIRestService/src/main/java/org/texttechnologylab/duui/api/Methods.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ public static void init() {
7575
}
7676
});
7777

78+
path("/alive", () -> {
79+
get("", (request, response) -> {
80+
response.type("text/plain");
81+
return "OK";
82+
});
83+
});
84+
7885

7986
path("/settings", () -> {
8087
before("/*", (request, response) -> {

DUUIRestService/src/main/resources/logback.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<!-- </encoder>-->
2626
<!-- </appender>-->
2727

28+
<logger name="org.texttechnologylab.duui.api.controllers.users" level="TRACE"/>
29+
2830
<!-- 3) Root logger: send everything ≥ INFO to console & file -->
2931
<root level="INFO">
3032
<appender-ref ref="CONSOLE" />

DUUIWeb/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
FROM node:18-alpine AS builder
22

33
ARG API_URL
4-
ENV API_URL=http://duui-gateway-backend:2605
54
ARG DBX_URL
5+
6+
ENV API_URL=${API_URL}
67
ENV DBX_URL=${DBX_URL}
78

89
RUN mkdir /app
@@ -13,12 +14,16 @@ RUN cd /app && npm install && npm run build
1314

1415
FROM node:18-alpine
1516

17+
# Installiere Python sowie notwendige Build-Tools
18+
RUN apk add --no-cache python3 make g++
19+
1620
RUN mkdir /app
1721
COPY --from=builder /app/build /app/build
1822
COPY --from=builder /app/package.json /app/
1923

2024
RUN cd /app && \
21-
npm install --omit=dev
25+
npm install --omit=dev --ignore-scripts && \
26+
npm rebuild bcrypt --build-from-source
2227

2328
WORKDIR /app
2429

DUUIWeb/src/hooks.server.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
import { API_URL } from '$env/static/private'
22
import type { Handle, RequestEvent } from '@sveltejs/kit'
33

4+
5+
async function testBackendConnection() {
6+
try {
7+
console.log('Trying to reach: ', API_URL)
8+
const res = await fetch(`${API_URL}/alive`, {
9+
method: 'GET'
10+
});
11+
if (res.ok) {
12+
console.log('Backend reachable: ', API_URL)
13+
} else {
14+
console.error('Backend responds with: ', res.status)
15+
}
16+
} catch (error: any) {
17+
if (error instanceof Error) {
18+
console.error('Connecting to backend failed: ', error.toString(), error.stack);
19+
} else {
20+
console.error('Connecting to backend failed: ', error);
21+
}
22+
}
23+
}
24+
25+
testBackendConnection()
26+
427
/**
528
* Fetch a user from the databse to verify the user is authorized.
629
*

DUUIWeb/src/routes/account/+page.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@
13021302
{/each}
13031303
</div>
13041304
{:else}
1305-
{@html value}
1305+
<p class="p-4 break-words text-center">{value ?? ''}</p>
13061306
{/if}
13071307
</svelte:fragment>
13081308
</FunctionalTable2>
@@ -1402,7 +1402,8 @@
14021402
{/each}
14031403
</div>
14041404
{:else}
1405-
{@html value}
1405+
<p class="p-4 break-words text-center">{value ?? ''}</p>
1406+
14061407
{/if}
14071408
</svelte:fragment>
14081409
</FunctionalTable2>

docker-compose.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ services:
99
volumes:
1010
# Mount the Docker socket so the backend can start containers
1111
- /var/run/docker.sock:/var/run/docker.sock
12-
# - /:/app/drives
13-
- /home/:/app/drives
12+
- /:/app/drives
1413
environment:
1514
- PORT=2605
1615
- HOST=duui-gateway-backend
@@ -32,22 +31,29 @@ services:
3231
- "host.docker.internal:host-gateway"
3332
depends_on:
3433
- mongodb
34+
networks:
35+
- app-network
3536

3637

37-
# duui-frontend:
38-
# build:
39-
# context: ./DUUIWeb
40-
# dockerfile: Dockerfile # or Dockerfile-frontend, etc.
41-
# container_name: duui-gateway-frontend
42-
# ports:
43-
# - "5173:5173"
44-
# depends_on:
45-
# - duui-backend
46-
# environment:
47-
# - ORIGIN=http://duui-gateway-frontend:5173
48-
# - API_URL=http://duui-gateway-backend:2605
49-
# - PORT=5173
50-
# - DBX_URL='https://www.dropbox.com/home/Apps/DUUI'
38+
duui-frontend:
39+
build:
40+
context: ./DUUIWeb
41+
dockerfile: Dockerfile # or Dockerfile-frontend, etc.
42+
args:
43+
API_URL: http://duui-gateway-backend:2605
44+
DBX_URL: https://www.dropbox.com/home/Apps/DUUI
45+
container_name: duui-gateway-frontend
46+
ports:
47+
- "5173:5173"
48+
depends_on:
49+
- duui-backend
50+
environment:
51+
- ORIGIN=http://duui-gateway-frontend:5173
52+
- API_URL=http://duui-gateway-backend:2605
53+
- PORT=5173
54+
- DBX_URL='https://www.dropbox.com/home/Apps/DUUI'
55+
networks:
56+
- app-network
5157

5258

5359
mongodb:
@@ -62,4 +68,10 @@ services:
6268
- "27017:27017"
6369
volumes:
6470
- ./mongodb_data:/data/db
65-
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
71+
- ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
72+
networks:
73+
- app-network
74+
75+
networks:
76+
app-network:
77+
driver: bridge

0 commit comments

Comments
 (0)