From b05c246d8fc658cba3d7865d21b7536f410e7f78 Mon Sep 17 00:00:00 2001 From: alban Date: Mon, 18 May 2020 16:27:33 +0200 Subject: [PATCH] [fix] system goes in system --- .../docker-compose/.env.sample | 0 .../docker-compose/docker-compose.yml | 2 +- system/k8s/deployment.yaml | 65 +++++++++++++++++++ system/k8s/elastic.yaml | 10 +++ system/k8s/service.yaml | 13 ++++ system/k8s/volumes.yaml | 43 ++++++++++++ 6 files changed, 132 insertions(+), 1 deletion(-) rename .env.sample => system/docker-compose/.env.sample (100%) rename docker-compose.yml => system/docker-compose/docker-compose.yml (97%) create mode 100644 system/k8s/deployment.yaml create mode 100644 system/k8s/elastic.yaml create mode 100644 system/k8s/service.yaml create mode 100644 system/k8s/volumes.yaml diff --git a/.env.sample b/system/docker-compose/.env.sample similarity index 100% rename from .env.sample rename to system/docker-compose/.env.sample diff --git a/docker-compose.yml b/system/docker-compose/docker-compose.yml similarity index 97% rename from docker-compose.yml rename to system/docker-compose/docker-compose.yml index 461207c..59ab397 100644 --- a/docker-compose.yml +++ b/system/docker-compose/docker-compose.yml @@ -26,7 +26,7 @@ services: app: env_file: .env - build: . + build: ../ image: albancrommer/changelog-server:latest ports: - "3000:3000" diff --git a/system/k8s/deployment.yaml b/system/k8s/deployment.yaml new file mode 100644 index 0000000..2304354 --- /dev/null +++ b/system/k8s/deployment.yaml @@ -0,0 +1,65 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: changelog-server + labels: + app: changelog-server +spec: + selector: + matchLabels: + app: changelog-server +# strategy: +# type: RollingUpdate +# rollingUpdate: +# maxSurge: 1 +# maxUnavailable: 1 + replicas: 1 + template: + metadata: + labels: + app: changelog-server + spec: + + initContainers: + - name: set-vm-sync-limit + image: busybox + imagePullPolicy: IfNotPresent + command: ["sysctl", "-w", "vm.max_map_count=262144"] + securityContext: + privileged: true + volumes: + - name: changelog-server-esdata + hostPath: + # directory location on host + path: /data + # this field is optional + type: Directory + containers: + - name: app + image: albancrommer/changelog-server:latest + ports: + - containerPort: 80 + protocol: TCP + - name: es + image: blacktop/elasticsearch:7.7 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 9200 + protocol: TCP + volumeMounts: +# - name: elastic-config +# mountPath: /etc/elasticsearch/elasticsearch.yaml +# subPath: elasticsearch.yaml + - name : changelog-server-esdata + mountPath: /usr/share/elasticsearch/data + env: + - name: node.name + value: "es01" + - name: cluster.name + value: "es-docker-cluster" + - name: bootstrap.memory_lock + value: "true" + - name: ES_JAVA_OPTS + value: "-Xms512m -Xmx512m" + + diff --git a/system/k8s/elastic.yaml b/system/k8s/elastic.yaml new file mode 100644 index 0000000..24f1ff1 --- /dev/null +++ b/system/k8s/elastic.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + product: k8s-elastic + name: elastic-config +data: + elasticsearch.yaml: | + discovery.type: single-node + diff --git a/system/k8s/service.yaml b/system/k8s/service.yaml new file mode 100644 index 0000000..051175c --- /dev/null +++ b/system/k8s/service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: changelog-server +spec: + type: ClusterIP + ports: + - name: www + port: 80 + targetPort: 80 + protocol: TCP + selector: + app: changelog-server diff --git a/system/k8s/volumes.yaml b/system/k8s/volumes.yaml new file mode 100644 index 0000000..ce74118 --- /dev/null +++ b/system/k8s/volumes.yaml @@ -0,0 +1,43 @@ +#apiVersion: v1 +#kind: PersistentVolume +#metadata: +# name: changelog-server +#spec: +# capacity: +# storage: 2Mi +# volumeMode: Filesystem +# accessModes: +# - ReadWriteOnce +# persistentVolumeReclaimPolicy: Retain + +#--- +# +#apiVersion: v1 +#kind: PersistentVolume +#metadata: +# name: changelog-server +#spec: +# capacity: +# storage: 5Gi +# volumeMode: Filesystem +# accessModes: +# - ReadWriteOnce +# persistentVolumeReclaimPolicy: Retain +# HostPath : +# path: /changelog-server-es01data +# +# +apiVersion: v1 +kind: PersistentVolume +metadata: + name: changelog-server-esdata + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/changelog-server-esdata" \ No newline at end of file