diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6616843 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +## Run docker-compose +compose: + @docker-compose up -d docker-compose.yml + +## Run minikube +minikube: + @bash -x scripts/minikube.sh + +## Run haproxy +haproxy: + @bash -x scripts/haproxy.sh + +## Run minikube & haproxy +run: + @bash -x scripts/run.sh + +## Deploy k8s objects +deploy: + @bash -x scripts/deploy.sh + +help: + @printf "Available targets:\n\n" + @awk '/^[a-zA-Z\-\_0-9%:\\]+:/ { \ + helpMessage = match(lastLine, /^## (.*)/); \ + if (helpMessage) { \ + helpCommand = $$1; \ + helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ + gsub("\\\\", "", helpCommand); \ + gsub(":+$$", "", helpCommand); \ + printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \ + } \ + } \ + { lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u + @printf "\n" \ No newline at end of file diff --git a/docker-containers/grafana/Dockerfile b/docker-containers/grafana/Dockerfile new file mode 100644 index 0000000..7dd0f83 --- /dev/null +++ b/docker-containers/grafana/Dockerfile @@ -0,0 +1,10 @@ +FROM grafana/grafana +MAINTAINER Pedro César + +ADD conf/grafana.db /var/lib/grafana/grafana.db +ADD conf/home.json /usr/share/grafana/public/dashboards/home.json + +ENV GF_SERVER_ROOT_URL http://localhost +ENV GF_SECURITY_ADMIN_PASSWORD admin +ENV GF_AUTH_ANONYMOUS_ENABLED true +ENTRYPOINT ["/run.sh"] \ No newline at end of file diff --git a/docker-containers/grafana/grafana.db b/docker-containers/grafana/grafana.db new file mode 100644 index 0000000..9cdba0d Binary files /dev/null and b/docker-containers/grafana/grafana.db differ diff --git a/docker-containers/grafana/home.json b/docker-containers/grafana/home.json new file mode 100644 index 0000000..b8ab023 --- /dev/null +++ b/docker-containers/grafana/home.json @@ -0,0 +1,295 @@ +{ + "id": null, + "title": "Home", + "originalTitle": "Home", + "tags": [], + "style": "dark", + "timezone": "browser", + "editable": true, + "hideControls": true, + "sharedCrosshair": false, + "rows": [ + { + "collapse": false, + "editable": true, + "height": "100px", + "panels": [ + { + "title": "Download", + "error": false, + "span": 12, + "editable": true, + "type": "graph", + "yaxes": [ + { + "show": true, + "min": null, + "max": null, + "logBase": 1, + "format": "MBs" + }, + { + "show": true, + "min": null, + "max": null, + "logBase": 1, + "format": "MBs" + } + ], + "isNew": true, + "id": 1, + "datasource": "InfluxDB", + "renderer": "flot", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "MBs", + "MBs" + ], + "grid": { + "leftLogBase": 1, + "leftMax": null, + "rightMax": null, + "leftMin": null, + "rightMin": null, + "rightLogBase": 1, + "threshold1": null, + "threshold2": null, + "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2Color": "rgba(234, 112, 112, 0.22)" + }, + "lines": true, + "fill": 1, + "linewidth": 2, + "points": false, + "pointradius": 5, + "bars": false, + "stack": false, + "percentage": false, + "legend": { + "show": true, + "values": false, + "min": false, + "max": false, + "current": false, + "total": false, + "avg": false + }, + "nullPointMode": "connected", + "steppedLine": false, + "tooltip": { + "value_type": "cumulative", + "shared": true + }, + "timeFrom": null, + "timeShift": null, + "targets": [ + { + "refId": "A", + "dsType": "influxdb", + "resultFormat": "time_series", + "tags": [], + "groupBy": [ + { + "type": "time", + "params": [ + "$interval" + ] + }, + { + "type": "fill", + "params": [ + "null" + ] + } + ], + "select": [ + [ + { + "type": "field", + "params": [ + "value" + ] + }, + { + "type": "mean", + "params": [] + } + ] + ], + "alias": "Download", + "measurement": "download", + "query": "SELECT mean(\"value\") FROM \"download\" WHERE $timeFilter GROUP BY time($interval) fill(null)" + } + ], + "aliasColors": {}, + "seriesOverrides": [], + "links": [], + "height": "250px" + } + ], + "title": "New row" + }, + { + "height": "610px", + "panels": [ + { + "title": "Upload", + "error": false, + "span": 12, + "editable": true, + "type": "graph", + "yaxes": [ + { + "show": true, + "min": null, + "max": null, + "logBase": 1, + "format": "MBs" + }, + { + "show": true, + "min": null, + "max": null, + "logBase": 1, + "format": "MBs" + } + ], + "isNew": true, + "id": 2, + "datasource": "InfluxDB", + "renderer": "flot", + "x-axis": true, + "y-axis": true, + "y_formats": [ + "MBs", + "MBs" + ], + "grid": { + "leftLogBase": 1, + "leftMax": null, + "rightMax": null, + "leftMin": null, + "rightMin": null, + "rightLogBase": 1, + "threshold1": null, + "threshold2": null, + "threshold1Color": "rgba(216, 200, 27, 0.27)", + "threshold2Color": "rgba(234, 112, 112, 0.22)" + }, + "lines": true, + "fill": 1, + "linewidth": 2, + "points": false, + "pointradius": 5, + "bars": false, + "stack": false, + "percentage": false, + "legend": { + "show": true, + "values": false, + "min": false, + "max": false, + "current": false, + "total": false, + "avg": false + }, + "nullPointMode": "connected", + "steppedLine": false, + "tooltip": { + "value_type": "cumulative", + "shared": true + }, + "timeFrom": null, + "timeShift": null, + "targets": [ + { + "refId": "A", + "dsType": "influxdb", + "resultFormat": "time_series", + "tags": [], + "groupBy": [ + { + "type": "time", + "params": [ + "$interval" + ] + }, + { + "type": "fill", + "params": [ + "null" + ] + } + ], + "select": [ + [ + { + "type": "field", + "params": [ + "value" + ] + }, + { + "type": "mean", + "params": [] + } + ] + ], + "alias": "Upload", + "measurement": "upload", + "query": "SELECT mean(\"value\") FROM \"upload\" WHERE $timeFilter GROUP BY time($interval) fill(null)" + } + ], + "aliasColors": {}, + "seriesOverrides": [], + "links": [], + "height": "250px" + } + ], + "title": "Row", + "collapse": false, + "editable": true + } + ], + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "enable": false, + "type": "timepicker", + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ], + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "templating": { + "list": [] + }, + "annotations": { + "list": [] + }, + "schemaVersion": 8, + "version": 5, + "links": [] +} diff --git a/docker-containers/grafana/run.sh b/docker-containers/grafana/run.sh new file mode 100644 index 0000000..365c41e --- /dev/null +++ b/docker-containers/grafana/run.sh @@ -0,0 +1,48 @@ +#!/bin/bash -e + +: "${GF_PATHS_DATA:=/var/lib/grafana}" +: "${GF_PATHS_LOGS:=/var/log/grafana}" +: "${GF_PATHS_PLUGINS:=/var/lib/grafana/plugins}" + +chown -R grafana:grafana "$GF_PATHS_DATA" "$GF_PATHS_LOGS" +chown -R grafana:grafana /etc/grafana + +if [ ! -z ${GF_AWS_PROFILES+x} ]; then + mkdir -p ~grafana/.aws/ + touch ~grafana/.aws/credentials + + for profile in ${GF_AWS_PROFILES}; do + access_key_varname="GF_AWS_${profile}_ACCESS_KEY_ID" + secret_key_varname="GF_AWS_${profile}_SECRET_ACCESS_KEY" + region_varname="GF_AWS_${profile}_REGION" + + if [ ! -z "${!access_key_varname}" -a ! -z "${!secret_key_varname}" ]; then + echo "[${profile}]" >> ~grafana/.aws/credentials + echo "aws_access_key_id = ${!access_key_varname}" >> ~grafana/.aws/credentials + echo "aws_secret_access_key = ${!secret_key_varname}" >> ~grafana/.aws/credentials + if [ ! -z "${!region_varname}" ]; then + echo "region = ${!region_varname}" >> ~grafana/.aws/credentials + fi + fi + done + + chown grafana:grafana -R ~grafana/.aws + chmod 600 ~grafana/.aws/credentials +fi + +if [ ! -z "${GF_INSTALL_PLUGINS}" ]; then + OLDIFS=$IFS + IFS=',' + for plugin in ${GF_INSTALL_PLUGINS}; do + grafana-cli --pluginsDir "${GF_PATHS_PLUGINS}" plugins install ${plugin} + done + IFS=$OLDIFS +fi + +exec gosu grafana /usr/sbin/grafana-server \ + --homepath=/usr/share/grafana \ + --config=/etc/grafana/grafana.ini \ + cfg:default.paths.data="$GF_PATHS_DATA" \ + cfg:default.paths.logs="$GF_PATHS_LOGS" \ + cfg:default.paths.plugins="$GF_PATHS_PLUGINS" \ + "$@" \ No newline at end of file diff --git a/docker-containers/influxdb/Dockerfile b/docker-containers/influxdb/Dockerfile new file mode 100644 index 0000000..e69de29 diff --git a/docker-containers/speedtest/Dockerfile b/docker-containers/speedtest/Dockerfile new file mode 100644 index 0000000..d091c44 --- /dev/null +++ b/docker-containers/speedtest/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:trusty +MAINTAINER Pedro César + +RUN mkdir -p /app/speedtest/ +RUN apt-get update && apt-get install -y wget python curl +RUN wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py -O /app/speedtest/speedtest_cli.py +RUN chmod +x /app/speedtest/speedtest_cli.py + +ADD scripts/ /app/speedtest/ + +CMD bash -c /app/speedtest/init_test_connection.sh \ No newline at end of file diff --git a/docker-containers/speedtest/init_test_connection.sh b/docker-containers/speedtest/init_test_connection.sh new file mode 100644 index 0000000..3b41c51 --- /dev/null +++ b/docker-containers/speedtest/init_test_connection.sh @@ -0,0 +1,17 @@ +#!/bin/bash +FILE="/app/speedtest/test_connection.log" + +while true +do + TIMESTAMP=$(date '+%s') + + /app/speedtest/speedtest_cli.py > $FILE + + DOWNLOAD=$(cat $FILE | grep "Download:" | awk -F " " '{print $2}') + UPLOAD=$(cat $FILE | grep "Upload:" | awk -F " " '{print $2}') + echo "Download: $DOWNLOAD Upload: $UPLOAD $TIMESTAMP" + curl -i -XPOST 'http://db:8086/write?db=speedtest' --data-binary "download,host=local value=$DOWNLOAD" + curl -i -XPOST 'http://db:8086/write?db=speedtest' --data-binary "upload,host=local value=$UPLOAD" + sleep $TEST_INTERVAL + +done \ No newline at end of file diff --git a/k8s/db-deployment.yaml b/k8s/db-deployment.yaml new file mode 100644 index 0000000..db5275a --- /dev/null +++ b/k8s/db-deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + replicas: 1 + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: db + spec: + containers: + - env: + - name: ADMIN_USER + value: admin + - name: INFLUXDB_INIT_PWD + value: password + - name: PRE_CREATE_DB + value: speedtest + image: tutum/influxdb + name: db + ports: + - containerPort: 8083 + - containerPort: 8086 + resources: {} + restartPolicy: Always +status: {} diff --git a/k8s/db-service.yaml b/k8s/db-service.yaml new file mode 100644 index 0000000..8c835a4 --- /dev/null +++ b/k8s/db-service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: db + name: db +spec: + ports: + - name: "8083" + port: 8083 + targetPort: 8083 + - name: "8086" + port: 8086 + targetPort: 8086 + selector: + io.kompose.service: db +status: + loadBalancer: {} diff --git a/k8s/ingress/default-backend.yaml b/k8s/ingress/default-backend.yaml new file mode 100644 index 0000000..4506cdf --- /dev/null +++ b/k8s/ingress/default-backend.yaml @@ -0,0 +1,47 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: default-http-backend +spec: + replicas: 1 + template: + metadata: + labels: + app: default-http-backend + spec: + terminationGracePeriodSeconds: 60 + containers: + - name: default-http-backend + # Any image is permissable as long as: + # 1. It serves a 404 page at / + # 2. It serves 200 on a /healthz endpoint + image: gcr.io/google_containers/defaultbackend:1.0 + livenessProbe: + httpGet: + path: /healthz + port: 8080 + scheme: HTTP + initialDelaySeconds: 30 + timeoutSeconds: 5 + ports: + - containerPort: 8080 + resources: + limits: + cpu: 10m + memory: 20Mi + requests: + cpu: 10m + memory: 20Mi +--- +kind: Service +apiVersion: v1 +metadata: + name: default-http-backend +spec: + selector: + app: default-http-backend + ports: + - protocol: TCP + port: 80 + targetPort: 8080 + type: NodePort \ No newline at end of file diff --git a/k8s/ingress/ingress-controller.yaml b/k8s/ingress/ingress-controller.yaml new file mode 100644 index 0000000..210a3d7 --- /dev/null +++ b/k8s/ingress/ingress-controller.yaml @@ -0,0 +1,67 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: nginx-ingress-controller +spec: + replicas: 1 + revisionHistoryLimit: 3 + template: + metadata: + labels: + k8s-app: nginx-ingress-lb + spec: + containers: + - args: + - /nginx-ingress-controller + - "--default-backend-service=$(POD_NAMESPACE)/default-http-backend" + - "--default-ssl-certificate=$(POD_NAMESPACE)/tls-certificate" + env: + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + image: "gcr.io/google_containers/nginx-ingress-controller:0.9.0" + imagePullPolicy: Always + livenessProbe: + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + initialDelaySeconds: 10 + timeoutSeconds: 5 + name: nginx-ingress-controller + ports: + - containerPort: 80 + name: http + protocol: TCP + - containerPort: 443 + name: https + protocol: TCP + volumeMounts: + - mountPath: /etc/nginx-ssl/dhparam + name: tls-dhparam-vol + terminationGracePeriodSeconds: 60 + volumes: + - name: tls-dhparam-vol + secret: + secretName: tls-dhparam +--- +apiVersion: v1 +kind: Service +metadata: + name: nginx-ingress +spec: + type: LoadBalancer + ports: + - name: http + port: 80 + targetPort: http + - name: https + port: 443 + targetPort: https + selector: + k8s-app: nginx-ingress-lb \ No newline at end of file diff --git a/k8s/ingress/traefik-deployment.yaml b/k8s/ingress/traefik-deployment.yaml new file mode 100644 index 0000000..ccf18bf --- /dev/null +++ b/k8s/ingress/traefik-deployment.yaml @@ -0,0 +1,51 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: traefik-ingress-controller + namespace: kube-system +--- +kind: Deployment +apiVersion: extensions/v1beta1 +metadata: + name: traefik-ingress-controller + namespace: kube-system + labels: + k8s-app: traefik-ingress-lb +spec: + replicas: 1 + selector: + matchLabels: + k8s-app: traefik-ingress-lb + template: + metadata: + labels: + k8s-app: traefik-ingress-lb + name: traefik-ingress-lb + spec: + serviceAccountName: traefik-ingress-controller + terminationGracePeriodSeconds: 60 + containers: + - image: traefik + name: traefik-ingress-lb + args: + - --api + - --kubernetes + - --logLevel=INFO +--- +kind: Service +apiVersion: v1 +metadata: + name: traefik-ingress-service + namespace: kube-system +spec: + selector: + k8s-app: traefik-ingress-lb + ports: + - protocol: TCP + port: 80 + name: web + - protocol: TCP + port: 8080 + name: admin + type: NodePort diff --git a/k8s/ingress/traefik-rbac.yaml b/k8s/ingress/traefik-rbac.yaml new file mode 100644 index 0000000..db5fb8c --- /dev/null +++ b/k8s/ingress/traefik-rbac.yaml @@ -0,0 +1,37 @@ +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: traefik-ingress-controller +rules: + - apiGroups: + - "" + resources: + - services + - endpoints + - secrets + verbs: + - get + - list + - watch + - apiGroups: + - extensions + resources: + - ingresses + verbs: + - get + - list + - watch +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1beta1 +metadata: + name: traefik-ingress-controller +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: traefik-ingress-controller +subjects: +- kind: ServiceAccount + name: traefik-ingress-controller + namespace: kube-system diff --git a/k8s/ingress/traefik-ui.yaml b/k8s/ingress/traefik-ui.yaml new file mode 100644 index 0000000..3f24db0 --- /dev/null +++ b/k8s/ingress/traefik-ui.yaml @@ -0,0 +1,28 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: traefik-web-ui + namespace: kube-system +spec: + selector: + k8s-app: traefik-ingress-lb + ports: + - name: web + port: 80 + targetPort: 8080 +--- +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: traefik-web-ui + namespace: kube-system +spec: + rules: + - host: + http: + paths: + - path: / + backend: + serviceName: traefik-web-ui + servicePort: web diff --git a/k8s/testing-deployment.yaml b/k8s/testing-deployment.yaml new file mode 100644 index 0000000..6b11702 --- /dev/null +++ b/k8s/testing-deployment.yaml @@ -0,0 +1,25 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: testing + name: testing +spec: + replicas: 1 + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: testing + spec: + containers: + - env: + - name: TEST_INTERVAL + value: "5" + image: pedrocesarti/internet-speedtest-docker:speedtest + name: testing + resources: {} + restartPolicy: Always +status: {} diff --git a/k8s/testing-service.yaml b/k8s/testing-service.yaml new file mode 100644 index 0000000..595b32e --- /dev/null +++ b/k8s/testing-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: testing + name: testing +spec: + clusterIP: None + ports: + - name: headless + port: 55555 + targetPort: 0 + selector: + io.kompose.service: testing +status: + loadBalancer: {} diff --git a/k8s/web-deployment.yaml b/k8s/web-deployment.yaml new file mode 100644 index 0000000..cf2b42f --- /dev/null +++ b/k8s/web-deployment.yaml @@ -0,0 +1,29 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + replicas: 1 + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: web + spec: + containers: + - env: + - name: GF_SERVER_ROOT_URL + value: http://localhost + - name: GF_SECURITY_ADMIN_PASSWORD + value: teste + image: pedrocesarti/internet-speedtest-docker:grafana + name: web + ports: + - containerPort: 3000 + resources: {} + restartPolicy: Always +status: {} diff --git a/k8s/web-ingress.yaml b/k8s/web-ingress.yaml new file mode 100644 index 0000000..b93e92b --- /dev/null +++ b/k8s/web-ingress.yaml @@ -0,0 +1,18 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: speedtest-ingress + annotations: + ingress.kubernetes.io/rewrite-target: / +spec: + backend: + serviceName: web + servicePort: 80 + rules: + - host: + http: + paths: + - path: / + backend: + serviceName: web + servicePort: web \ No newline at end of file diff --git a/k8s/web-service.yaml b/k8s/web-service.yaml new file mode 100644 index 0000000..cb183e0 --- /dev/null +++ b/k8s/web-service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + io.kompose.service: web + name: web +spec: + ports: + - name: web + port: 80 + targetPort: 3000 + selector: + io.kompose.service: web +status: + loadBalancer: {} diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 0000000..c3468ea --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -x + +minikube addons enable ingress +# kubectl apply -f k8s/ingress/traefik-rbac.yaml +# kubectl apply -f k8s/ingress/traefik-deployment.yaml +# kubectl apply -f k8s/ingress/traefik-ui.yaml + + +kubectl apply -f k8s/db-deployment.yaml +kubectl apply -f k8s/db-service.yaml +kubectl apply -f k8s/testing-deployment.yaml +kubectl apply -f k8s/testing-service.yaml +kubectl apply -f k8s/web-deployment.yaml +kubectl apply -f k8s/web-service.yaml +kubectl apply -f k8s/web-ingress.yaml \ No newline at end of file diff --git a/scripts/haproxy-override/haproxy.cfg b/scripts/haproxy-override/haproxy.cfg new file mode 100644 index 0000000..a941b56 --- /dev/null +++ b/scripts/haproxy-override/haproxy.cfg @@ -0,0 +1,37 @@ +global + log 127.0.0.1 local0 + log 127.0.0.1 local1 notice + # chroot /var/lib/haproxy + # user haproxy + # group haproxy + # daemon + +defaults + log global + mode http + # option httplog + option dontlognull + timeout connect 5000ms + timeout client 50000ms + timeout server 50000ms + +listen stats + bind 0.0.0.0:8080 + stats enable + stats uri / + +listen l1 + bind 0.0.0.0:3000 + mode tcp + # timeout connect 4000 + # timeout client 180000 + # timeout server 180000 + server srv1 192.168.99.100 + +listen l2 + bind 0.0.0.0:80 + mode tcp + # timeout connect 4000 + # timeout client 180000 + # timeout server 180000 + server srv1 192.168.99.100 \ No newline at end of file diff --git a/scripts/haproxy.sh b/scripts/haproxy.sh new file mode 100755 index 0000000..c07d86f --- /dev/null +++ b/scripts/haproxy.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -x +# docker run -d -p 80:80 -p 3000:3000 -p 8080:8080 -v /home/deploy/Dropbox/Code/internet-speedtest-docker/scripts/haproxy-override:/haproxy-override haproxy:1.8.7-alpine +docker run -d -p 3000:3000 -p 8080:8080 -v $PWD/scripts/haproxy-override:/usr/local/etc/haproxy/ haproxy:1.8.7-alpine \ No newline at end of file diff --git a/scripts/minikube.sh b/scripts/minikube.sh new file mode 100755 index 0000000..086c5db --- /dev/null +++ b/scripts/minikube.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -x +minikube start \ No newline at end of file diff --git a/scripts/run.sh b/scripts/run.sh new file mode 100755 index 0000000..3c0aa75 --- /dev/null +++ b/scripts/run.sh @@ -0,0 +1,4 @@ +#/bin/bash +set -x +./scripts/minikube.sh +# ./scripts/haproxy.sh \ No newline at end of file diff --git a/speedtest-deployment.yaml b/speedtest-deployment.yaml new file mode 100644 index 0000000..2ea18a4 --- /dev/null +++ b/speedtest-deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + io.kompose.service: speedtest + name: speedtest +spec: + replicas: 1 + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + io.kompose.service: speedtest + spec: + containers: + - name: testing + image: pedrocesarti/internet-speedtest-docker:speedtest + env: + - name: TEST_INTERVAL + value: "5" + - name: web + image: pedrocesarti/internet-speedtest-docker:grafana + env: + - name: GF_SERVER_ROOT_URL + value: http://localhost + - name: GF_SECURITY_ADMIN_PASSWORD + value: teste + ports: + - containerPort: 3000 + - name: db + image: tutum/influxdb + env: + - name: ADMIN_USER + value: admin + - name: INFLUXDB_INIT_PWD + value: password + - name: PRE_CREATE_DB + value: speedtest + ports: + - containerPort: 8083 + - containerPort: 8086 + restartPolicy: Always +status: {}