diff --git a/system/docker-compose/.env.sample b/.env.sample similarity index 100% rename from system/docker-compose/.env.sample rename to .env.sample diff --git a/system/docker-compose/docker-compose.yml b/docker-compose.yml similarity index 97% rename from system/docker-compose/docker-compose.yml rename to docker-compose.yml index 59ab397..461207c 100644 --- a/system/docker-compose/docker-compose.yml +++ b/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/routes/index.js b/routes/index.js new file mode 100644 index 0000000..19cbf5d --- /dev/null +++ b/routes/index.js @@ -0,0 +1,78 @@ +module.exports = { + main: (req, res) => { + console.log("request /") + res.render('index', { title: 'Hey', message: 'Hello there!' }) + res.end('wut') + +// +// res.type('html') +// res.send(` +// +// +//Welcome to Alex's express.js example +// +// +//

Hi, thanks for using my Express.js lab 👏

+// +//

If you found it useful, view my other GitHub projects today 👑

+// +//

Results from GET /links:

+// +// +// +//

Copyright Alex Ellis 2020 ®

+// +// +// +//`); + }, + links: (req, res) => { + res.type("json") + res.send( + [ + { + "name": "github", + "url": "https://github.com/alexellis" + }, + { + "name": "twitter", + "url": "https://twitter.com/alexellisuk" + }, + { + "name": "blog", + "url": "https://blog.alexellis.io" + }, + { + "name": "sponsors", + "url": "https://github.com/users/alexellis/sponsorship" + }, + ]) + }, + health: (req, res) => { + + // Do an ES request + client.ping({ + // ping usually has a 3000ms timeout + requestTimeout: 1000 + }, function (error) { + if (error) { + console.trace('elasticsearch cluster is down!'); + } else { + console.log('All is well'); + } + }); + res.send("OK"); + } +} diff --git a/system/k8s/deployment.yaml b/system/k8s/deployment.yaml deleted file mode 100644 index 2304354..0000000 --- a/system/k8s/deployment.yaml +++ /dev/null @@ -1,65 +0,0 @@ -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 deleted file mode 100644 index 24f1ff1..0000000 --- a/system/k8s/elastic.yaml +++ /dev/null @@ -1,10 +0,0 @@ -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 deleted file mode 100644 index 051175c..0000000 --- a/system/k8s/service.yaml +++ /dev/null @@ -1,13 +0,0 @@ -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 deleted file mode 100644 index ce74118..0000000 --- a/system/k8s/volumes.yaml +++ /dev/null @@ -1,43 +0,0 @@ -#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