-
Notifications
You must be signed in to change notification settings - Fork 0
/
ffxivapi-k8s.yml
161 lines (156 loc) · 3.89 KB
/
ffxivapi-k8s.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
160
161
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: roobre
cert-manager.io/cluster-issuer: letsencrypt-prod-roobre
name: ffxivapi
spec:
rules:
- host: ffxivapi.roobre.es
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: ffxivapi-back
port:
name: back-http
tls:
- hosts:
- ffxivapi.roobre.es
secretName: ffxivapi-cert
---
apiVersion: v1
kind: Service
metadata:
name: ffxivapi-back
spec:
type: ClusterIP
ports:
- name: ffxivapi-back-http
port: 8080
targetPort: back-http
selector:
app: ffxivapi-back
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ffxivapi-back
spec:
replicas: 2
selector:
matchLabels:
app: ffxivapi-back
template:
metadata:
labels:
app: ffxivapi-back
spec:
containers:
- name: ffxivapi-back
image: roobre/ffxivapi:latest
imagePullPolicy: Always
ports:
- name: back-http
containerPort: 8080
env:
- name: FFXIVAPI_NOCACHE
value: hellYeahCommaIDontWannaCacheShit
- name: FFXIVAPI_SERVER
value: http://ffxivapi-lodestoneproxy
livenessProbe:
exec:
command:
- curl
- localhost:8080
initialDelaySeconds: 5
timeoutSeconds: 2
periodSeconds: 60
---
apiVersion: v1
kind: Service
metadata:
name: ffxivapi-lodestoneproxy
spec:
type: ClusterIP
ports:
- name: proxy-http
port: 80
targetPort: proxy-http
selector:
app: ffxivapi-lodestoneproxy
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ffxivapi-lodestoneproxy
spec:
replicas: 1
selector:
matchLabels:
app: ffxivapi-lodestoneproxy
template:
metadata:
labels:
app: ffxivapi-lodestoneproxy
spec:
containers:
- name: ffxivapi-lodestoneproxy
image: nginx:latest
ports:
- name: proxy-http
containerPort: 80
volumeMounts:
- name: nginx-conf
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
livenessProbe:
httpGet:
port: 80
initialDelaySeconds: 10
periodSeconds: 60
timeoutSeconds: 10
volumes:
- name: nginx-conf
configMap:
name: ffxivapi-lodestoneproxy-nginxconf
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ffxivapi-lodestoneproxy-nginxconf
data:
nginx.conf: |
worker_processes auto;
events {
worker_connections 1024;
}
http {
sendfile on;
root /srv/http/;
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=NGINX:1M inactive=72h max_size=128M;
server {
listen *:80;
server_name ffxivapi-lodestoneproxy;
location / {
proxy_connect_timeout 20s;
proxy_cache_lock on;
proxy_cache_lock_age 7s;
proxy_cache_lock_timeout 10s;
proxy_ignore_headers Cache-Control Expires Set-Cookie;
proxy_pass https://eu.finalfantasyxiv.com;
proxy_buffering on;
proxy_cache NGINX;
proxy_cache_valid 200 15m;
proxy_cache_valid 403 30m;
proxy_cache_valid 404 30m;
proxy_cache_valid 429 0s;
proxy_cache_valid any 3m;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
}
}
}