Skip to content

Commit

Permalink
initial kubernetes
Browse files Browse the repository at this point in the history
  • Loading branch information
RawToast committed Mar 3, 2018
1 parent e13bc43 commit 883e991
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ COPY . .

RUN yarn && npm link bs-platform && yarn build

CMD ["serve", "-s", "build", "-p", "8080"]
CMD ["serve", "-s", "build", "-p", "3000"]
3 changes: 3 additions & 0 deletions kube/build-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eval $(minikube docker-env)

docker build ../ -t dokusho
27 changes: 27 additions & 0 deletions kube/mongo-controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: mongo
name: mongo-controller
spec:
replicas: 1
template:
metadata:
labels:
name: mongo
spec:
containers:
- image: mongo
name: mongo
ports:
- name: mongo
containerPort: 27017
hostPort: 27017
volumeMounts:
- name: mongo-persistent-storage
mountPath: /data/db
volumes:
- name: mongo-persistent-storage
hostPath:
path: /data/pv0001/
11 changes: 11 additions & 0 deletions kube/mongo-disk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongo-volume
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 5Gi
hostPath:
path: /data/mongo-volume/
12 changes: 12 additions & 0 deletions kube/mongo-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: mongo
name: mongo
spec:
ports:
- port: 27017
targetPort: 27017
selector:
name: mongo
7 changes: 7 additions & 0 deletions kube/run-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

kubectl create -f mongo-service.yaml
kubectl create -f web-service.yaml

kubectl create -f mongo-controller.yaml
kubectl create -f web-controller.yaml
21 changes: 21 additions & 0 deletions kube/web-controller.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: web
name: web-controller
spec:
replicas: 2
selector:
name: web
template:
metadata:
labels:
name: web
spec:
containers:
- image: dokusho:web
name: web
ports:
- containerPort: 3000
name: http-server
14 changes: 14 additions & 0 deletions kube/web-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: web
labels:
name: web
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 3000
protocol: TCP
selector:
name: web
6 changes: 4 additions & 2 deletions run-docker.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
docker build ./ -t node:dokusho
#!/bin/bash

docker run -p 80:8080 node:dokusho
docker build ./ -t dokusho

docker run -p 3000:3000 node:dokusho

0 comments on commit 883e991

Please sign in to comment.