-
Notifications
You must be signed in to change notification settings - Fork 6
/
kube.yml
159 lines (147 loc) · 3 KB
/
kube.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: develop
---
apiVersion: v1
kind: ConfigMap
metadata:
name: develop
labels:
app: develop
data:
nginx.conf: |
map $uri $app_user {
"~^(/~(?<user>[^/]+))" $user;
default [email protected];
}
map $uri $app_socket {
"~^(/~[^/]+)?(/@(?<app>[^/]+))" /run/app/$app.socket;
default /run/app/socket;
}
map $uri $app_prefix {
"~^(?<prefix>(/~[^/]+)?(/@[^/]+)?)" $prefix;
}
map $uri $app_path {
"~^(/~[^/]+)?(/@[^/]+)?(?<path>.*)" $path;
}
server {
listen 80;
location = /healthz {
return 200 "ok";
access_log off;
}
location / {
if ($app_path = "") {
return 302 $scheme://$http_host$uri/;
}
uwsgi_pass unix://$app_socket;
uwsgi_modifier1 30;
include uwsgi_params;
uwsgi_param SCRIPT_NAME $app_prefix if_not_empty;
uwsgi_param REMOTE_USER $app_user if_not_empty;
}
location = /logout {
return 204;
}
location /doc {
alias /var/www/doc/html;
absolute_redirect off;
}
}
---
apiVersion: v1
kind: Pod
metadata:
name: develop
labels:
app: develop
spec:
serviceAccountName: develop
volumes:
- name: appenv
emptyDir: {}
- name: pgdata
emptyDir: {}
- name: pgrun
emptyDir: {}
- name: ngconf
configMap:
name: develop
items:
- key: nginx.conf
path: default.conf
containers:
- name: develop
image: rexdb/build:2022.07.26
workingDir: /app
command: [sleep, infinity]
env:
- name: PATH
value: /app/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- name: PGUSER
value: postgres
volumeMounts:
- name: appenv
mountPath: /app
- name: pgrun
mountPath: /var/run/postgresql
- name: postgres
image: postgres:12
env:
- name: POSTGRES_HOST_AUTH_METHOD
value: trust
volumeMounts:
- name: pgdata
mountPath: /var/lib/postgresql/data
- name: pgrun
mountPath: /var/run/postgresql
- name: nginx
image: nginx:1.15
ports:
- name: http
containerPort: 80
readinessProbe:
httpGet:
path: /healthz
port: 80
volumeMounts:
- name: ngconf
mountPath: /etc/nginx/conf.d
- name: appenv
subPath: run
mountPath: /run/app
- name: appenv
subPath: doc/build
mountPath: /var/www/doc
---
apiVersion: v1
kind: Service
metadata:
name: develop
labels:
app: develop
spec:
selector:
app: develop
ports:
- port: 80
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: develop
annotations:
kubernetes.io/ingress.class: nginx-internal
spec:
tls:
- hosts:
- NAMESPACE.EXAMPLE.COM
rules:
- host: NAMESPACE.EXAMPLE.COM
http:
paths:
- backend:
serviceName: develop
servicePort: 80