Revize 369e0228
Přidáno uživatelem Michal Schwob před téměř 3 roky(ů)
backend/app-deployment.yaml | ||
---|---|---|
2 | 2 |
kind: Deployment |
3 | 3 |
metadata: |
4 | 4 |
annotations: |
5 |
kompose.cmd: kompose convert
|
|
5 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
6 | 6 |
kompose.version: 1.26.0 (40646f47) |
7 | 7 |
creationTimestamp: null |
8 | 8 |
labels: |
... | ... | |
17 | 17 |
template: |
18 | 18 |
metadata: |
19 | 19 |
annotations: |
20 |
kompose.cmd: kompose convert
|
|
20 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
21 | 21 |
kompose.version: 1.26.0 (40646f47) |
22 | 22 |
creationTimestamp: null |
23 | 23 |
labels: |
... | ... | |
27 | 27 |
- env: |
28 | 28 |
- name: SPRING_DATASOURCE_URL |
29 | 29 |
value: jdbc:postgresql://db:5432/test |
30 |
image: schwobik/backend-app:1.0
|
|
30 |
image: schwobik/backend-app:1.2
|
|
31 | 31 |
name: app-backend |
32 | 32 |
ports: |
33 | 33 |
- containerPort: 8080 |
backend/app-service.yaml | ||
---|---|---|
2 | 2 |
kind: Service |
3 | 3 |
metadata: |
4 | 4 |
annotations: |
5 |
kompose.cmd: kompose convert
|
|
5 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
6 | 6 |
kompose.version: 1.26.0 (40646f47) |
7 | 7 |
creationTimestamp: null |
8 | 8 |
labels: |
backend/db-data-persistentvolumeclaim.yaml | ||
---|---|---|
11 | 11 |
resources: |
12 | 12 |
requests: |
13 | 13 |
storage: 100Mi |
14 |
status: { } |
|
14 |
status: {} |
backend/db-deployment.yaml | ||
---|---|---|
2 | 2 |
kind: Deployment |
3 | 3 |
metadata: |
4 | 4 |
annotations: |
5 |
kompose.cmd: kompose convert
|
|
5 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
6 | 6 |
kompose.version: 1.26.0 (40646f47) |
7 | 7 |
creationTimestamp: null |
8 | 8 |
labels: |
... | ... | |
18 | 18 |
template: |
19 | 19 |
metadata: |
20 | 20 |
annotations: |
21 |
kompose.cmd: kompose convert
|
|
21 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
22 | 22 |
kompose.version: 1.26.0 (40646f47) |
23 | 23 |
creationTimestamp: null |
24 | 24 |
labels: |
... | ... | |
36 | 36 |
name: postgres-db |
37 | 37 |
ports: |
38 | 38 |
- containerPort: 5432 |
39 |
resources: { } |
|
40 |
volumeMounts: |
|
41 |
- mountPath: /var/lib/postgresql/data |
|
42 |
name: db-data |
|
39 |
resources: {} |
|
43 | 40 |
restartPolicy: Always |
44 |
volumes: |
|
45 |
- name: db-data |
|
46 |
persistentVolumeClaim: |
|
47 |
claimName: db-data |
|
48 | 41 |
status: {} |
backend/db-service.yaml | ||
---|---|---|
2 | 2 |
kind: Service |
3 | 3 |
metadata: |
4 | 4 |
annotations: |
5 |
kompose.cmd: kompose convert
|
|
5 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
6 | 6 |
kompose.version: 1.26.0 (40646f47) |
7 | 7 |
creationTimestamp: null |
8 | 8 |
labels: |
... | ... | |
13 | 13 |
- name: "5432" |
14 | 14 |
port: 5432 |
15 | 15 |
targetPort: 5432 |
16 |
- name: 5432-tcp |
|
17 |
port: 5432 |
|
18 |
targetPort: 5432 |
|
19 | 16 |
selector: |
20 | 17 |
io.kompose.service: db |
21 | 18 |
status: |
backend/docker-compose.yml | ||
---|---|---|
19 | 19 |
app: # Spring boot application |
20 | 20 |
build: . |
21 | 21 |
container_name: app-backend # name of the container |
22 |
image: schwobik/backend-app:1.0
|
|
22 |
image: schwobik/backend-app:1.2
|
|
23 | 23 |
ports: |
24 | 24 |
- "8080:8080" # expose port 8080 out of the docker container do the local machine |
25 | 25 |
depends_on: |
... | ... | |
31 | 31 |
# Since our Dockerfile for web-server is located in react-app foler, our build context is ./react-app |
32 | 32 |
build: ../frontend |
33 | 33 |
container_name: frontend |
34 |
image: schwobik/frontend-app:1.0
|
|
34 |
image: schwobik/frontend-app:1.2
|
|
35 | 35 |
ports: |
36 | 36 |
- "80:80" |
37 | 37 |
|
backend/frontend-deployment.yaml | ||
---|---|---|
2 | 2 |
kind: Deployment |
3 | 3 |
metadata: |
4 | 4 |
annotations: |
5 |
kompose.cmd: kompose convert
|
|
5 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
6 | 6 |
kompose.version: 1.26.0 (40646f47) |
7 | 7 |
creationTimestamp: null |
8 | 8 |
labels: |
... | ... | |
13 | 13 |
selector: |
14 | 14 |
matchLabels: |
15 | 15 |
io.kompose.service: frontend |
16 |
strategy: { }
|
|
16 |
strategy: {} |
|
17 | 17 |
template: |
18 | 18 |
metadata: |
19 | 19 |
annotations: |
20 |
kompose.cmd: kompose convert
|
|
20 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
21 | 21 |
kompose.version: 1.26.0 (40646f47) |
22 | 22 |
creationTimestamp: null |
23 | 23 |
labels: |
24 | 24 |
io.kompose.service: frontend |
25 | 25 |
spec: |
26 | 26 |
containers: |
27 |
- image: schwobik/frontend-app:1.0
|
|
27 |
- image: schwobik/frontend-app:1.2
|
|
28 | 28 |
name: frontend |
29 | 29 |
ports: |
30 | 30 |
- containerPort: 80 |
31 |
resources: { }
|
|
31 |
resources: {} |
|
32 | 32 |
restartPolicy: Always |
33 |
status: { } |
|
33 |
status: {} |
backend/frontend-service.yaml | ||
---|---|---|
2 | 2 |
kind: Service |
3 | 3 |
metadata: |
4 | 4 |
annotations: |
5 |
kompose.cmd: kompose convert
|
|
5 |
kompose.cmd: D:\Skola\5_leto\ASWI\Semestralka\aswi2022code-of-duty\kompose.exe convert
|
|
6 | 6 |
kompose.version: 1.26.0 (40646f47) |
7 | 7 |
creationTimestamp: null |
8 | 8 |
labels: |
... | ... | |
15 | 15 |
targetPort: 80 |
16 | 16 |
selector: |
17 | 17 |
io.kompose.service: frontend |
18 |
type: LoadBalancer |
|
18 | 19 |
status: |
19 |
loadBalancer: { } |
|
20 |
loadBalancer: {} |
frontend/.env | ||
---|---|---|
1 |
REACT_APP_API_BASE_URL=http://localhost:8080 |
|
1 |
REACT_APP_API_BASE_URL=/api |
frontend/nginx/nginx.conf | ||
---|---|---|
1 |
upstream app { |
|
2 |
server app:8080; |
|
3 |
} |
|
1 | 4 |
server { |
2 | 5 |
listen 80; |
3 | 6 |
|
... | ... | |
8 | 11 |
try_files $uri $uri/ /index.html; |
9 | 12 |
} |
10 | 13 |
|
11 |
location /api/ { |
|
12 |
proxy_pass http://app-backend:8080/api/; |
|
13 |
proxy_http_version 1.1; |
|
14 |
proxy_set_header Upgrade $http_upgrade; |
|
15 |
proxy_set_header Connection 'upgrade'; |
|
16 |
proxy_set_header Host $host; |
|
17 |
proxy_cache_bypass $http_upgrade; |
|
14 |
location /api { |
|
15 |
rewrite /api/(.*) /$1 break; |
|
16 |
proxy_pass http://app; |
|
18 | 17 |
} |
19 | 18 |
} |
frontend/requests/login.http | ||
---|---|---|
1 | 1 |
POST /login |
2 |
Host: localhost:8080
|
|
2 |
Host: /api
|
|
3 | 3 |
Content-Type: application/json |
4 | 4 |
|
5 | 5 |
{ |
frontend/requests/register.http | ||
---|---|---|
1 | 1 |
POST /register |
2 |
Host: localhost:8080
|
|
2 |
Host: /api
|
|
3 | 3 |
Content-Type: application/json |
4 | 4 |
|
5 | 5 |
|
frontend/src/.env | ||
---|---|---|
1 |
REACT_APP_API_BASE_URL=http://localhost:8080/api |
|
1 |
REACT_APP_API_BASE_URL=/api |
frontend/src/config/conf.ts | ||
---|---|---|
1 | 1 |
const conf = { |
2 |
baseUrl: 'http://localhost:8080'
|
|
2 |
baseUrl: '/api'
|
|
3 | 3 |
} |
4 | 4 |
|
5 | 5 |
export default conf; |
frontend/src/swagger/http-client.ts | ||
---|---|---|
54 | 54 |
} |
55 | 55 |
|
56 | 56 |
export class HttpClient<SecurityDataType = unknown> { |
57 |
public baseUrl: string = "http://localhost:8080";
|
|
57 |
public baseUrl: string = "/api";
|
|
58 | 58 |
private securityData: SecurityDataType | null = null; |
59 | 59 |
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"]; |
60 | 60 |
private abortControllers = new Map<CancelToken, AbortController>(); |
Také k dispozici: Unified diff
Working deployment
re #9333