Skip to content

Commit

Permalink
feat(apis/extractor): init nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
OlaStenberg committed Dec 13, 2023
1 parent faa61fe commit a671302
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ yarn-error.log*

# env
.env
skaffold.env

# mesh
.mesh
Expand Down
5 changes: 4 additions & 1 deletion apis/extractor/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Extractor API

...

```bash
kubectl create secret generic extractor --from-literal=DRPC_ID=XXX
```
75 changes: 74 additions & 1 deletion apis/extractor/k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,80 @@ spec:
env:
- name: PORT
value: "8080"
- name: CONFIG_GROUP
value: "1"
- name: DRPC_ID
valueFrom:
secretKeyRef:
name: extractor
key: DRPC_ID
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
initialDelaySeconds: 5
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: extractor-56
spec:
replicas: 1
selector:
matchLabels:
app: extractor-56
template:
metadata:
labels:
app: extractor-56
spec:
containers:
- name: extractor
image: extractor
ports:
- containerPort: 8081
env:
- name: PORT
value: "8081"
- name: CONFIG_GROUP
value: "56"
- name: DRPC_ID
valueFrom:
secretKeyRef:
name: extractor
key: DRPC_ID
readinessProbe:
tcpSocket:
port: 8081
initialDelaySeconds: 5
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
selector:
matchLabels:
app: nginx
strategy:
type: Recreate
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx:latest
name: nginx
ports:
- containerPort: 80
name: web
volumeMounts:
- name: config-vol
mountPath: /etc/nginx/
volumes:
- name: config-vol
configMap:
name: nginx-config
items:
- key: nginx.conf
path: nginx.conf
43 changes: 40 additions & 3 deletions apis/extractor/k8s/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,45 @@ metadata:
spec:
type: LoadBalancer
selector:
app: extractor-1
app: nginx
ports:
- name: http
port: 81
targetPort: 8080
port: 80
targetPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30001
selector:
app: nginx
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
nginx.conf: '
events {
}
http {
map $arg_chainId $extractor_ip {
default 127.0.0.1:8080;
1 127.0.0.1:8081;
}
server {
listen 80;
location / {
proxy_pass $extractor_ip
}
}
}
'
1 change: 1 addition & 0 deletions apis/extractor/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ manifests:
rawYaml:
- k8s/deployment.yaml
- k8s/service.yaml

0 comments on commit a671302

Please sign in to comment.