Added k8s support
This commit is contained in:
parent
167da69ae4
commit
ea75ed0d9e
12
.dockerignore
Normal file
12
.dockerignore
Normal file
@ -0,0 +1,12 @@
|
||||
*.swp
|
||||
*.log
|
||||
__*
|
||||
.git
|
||||
.gitignore
|
||||
.gitmodules
|
||||
.dockerignore
|
||||
tests/
|
||||
node_modules/
|
||||
Dockerfile
|
||||
ci_build
|
||||
k8s.yaml
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
||||
FROM node:alpine
|
||||
WORKDIR /app
|
||||
|
||||
RUN echo "www-data:x:33:33:www-data:/app:/usr/sbin/nologin" >> /etc/passwd; echo "www-data:x:33:" >> /etc/group
|
||||
RUN chown www-data:www-data . -R
|
||||
|
||||
COPY . /app/
|
||||
RUN npm install
|
||||
|
||||
USER www-data
|
||||
|
||||
EXPOSE 15602
|
||||
ENTRYPOINT [ "node", "index.js" ]
|
@ -1,8 +1,4 @@
|
||||
var fs = require( "fs" );
|
||||
var path = "logs/access.log";
|
||||
|
||||
module.exports = {
|
||||
handler: fs.createWriteStream(
|
||||
path, { flag: "w+" }
|
||||
)
|
||||
};
|
||||
var w = { "write": process.stdout.write.bind( process.stdout ) };
|
||||
module.exports = { handler: w };
|
||||
|
121
k8s.yaml
Normal file
121
k8s.yaml
Normal file
@ -0,0 +1,121 @@
|
||||
kind: PersistentVolume
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: notify-mongodb
|
||||
labels:
|
||||
type: local
|
||||
app: notify
|
||||
srv: mongodb
|
||||
spec:
|
||||
storageClassName: local-storage
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
hostPath:
|
||||
path: "/mnt/notify"
|
||||
|
||||
---
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: notify-mongodb
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: notify
|
||||
srv: mongodb
|
||||
serviceName: notify-mongodb
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: notify
|
||||
srv: mongodb
|
||||
spec:
|
||||
containers:
|
||||
- name: notify-mongodb
|
||||
image: 192.168.80.4:32000/apps/mongodb:b00002
|
||||
volumeMounts:
|
||||
- name: mongodata
|
||||
mountPath: /data/db
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: mongodata
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: local-storage
|
||||
|
||||
---
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: notify
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: notify
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: notify
|
||||
srv: node
|
||||
spec:
|
||||
volumes:
|
||||
- name: notify-assets
|
||||
nfs:
|
||||
server: astrofile.astrohost
|
||||
path: /srv/astrostorage
|
||||
containers:
|
||||
- name: web
|
||||
image: 192.168.80.4:32000/sites/notify:b00001
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: notify-web
|
||||
spec:
|
||||
selector:
|
||||
app: notify
|
||||
srv: node
|
||||
ports:
|
||||
- name: app
|
||||
port: 15602
|
||||
targetPort: 15602
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: notify-mongodb
|
||||
spec:
|
||||
selector:
|
||||
app: notify
|
||||
srv: mongodb
|
||||
ports:
|
||||
- port: 27017
|
||||
targetPort: 27017
|
||||
|
||||
---
|
||||
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: notify-web
|
||||
spec:
|
||||
rules:
|
||||
- host: notify.astropenguin.net
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: notify-web
|
||||
servicePort: 15602
|
Loading…
Reference in New Issue
Block a user