Skip to content
Snippets Groups Projects
Commit 2a627e64 authored by Tóth Miklós Tibor's avatar Tóth Miklós Tibor :shrug:
Browse files

Move to KSZKlaszter

parent 0578d20f
No related branches found
No related tags found
No related merge requests found
.idea
.vs
.code
app
\ No newline at end of file
FROM alpine:latest
WORKDIR /app
ADD app /app/app
EXPOSE 8080
ENTRYPOINT ["/app/app"]
\ No newline at end of file
......@@ -28,4 +28,4 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
)
require github.com/eddieowens/go-enum v0.0.0-20181019003204-293c5c17ac0c // indirect
require github.com/eddieowens/go-enum v0.0.0-20181019003204-293c5c17ac0c
secret.env
\ No newline at end of file
apiVersion: v2
name: power-meme
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
#!/bin/bash
set -o allexport
source secret.env
set +o allexport
envsubst < values.yaml | helm install power-meme . --values -
\ No newline at end of file
apiVersion: v1
kind: Secret
metadata:
name: arangodb-creds
stringData:
ARANGO: "{{ .Values.arango.url }}"
ARANGO_USER: "{{ .Values.arango.user }}"
ARANGO_PASSWORD: "{{ .Values.arango.password }}"
DATABASE: "{{ .Values.arango.db }}"
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: power-distribution
spec:
selector:
matchLabels:
app: power-distribution
template:
metadata:
labels:
app: power-distribution
spec:
imagePullSecrets:
- name: harbor
containers:
- name: talker
image: "harbor.sch.bme.hu/kszk/power-distribution:{{ .Values.tag }}"
imagePullPolicy: Always
envFrom:
- secretRef:
name: arangodb-creds
resources:
requests:
memory: 200Mi
limits:
memory: 200Mi
---
apiVersion: v1
kind: Service
metadata:
name: power-distribution
spec:
selector:
app: power-distribution
ports:
- port: 80
targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: power-distribution
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: "{{ .Values.IngressClass }}"
kubernetes.io/tls-acme: 'true'
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
tls:
- hosts:
- {{ .Values.Domain }}
secretName: power-distribution-tls
rules:
- host: {{ .Values.Domain }}
http:
paths:
- pathType: Prefix
path: "/{{ .Values.tmpPass }}(/|$)(.*)"
backend:
service:
name: power-distribution
port:
number: 80
#!/bin/bash
set -o allexport
source secret.env
set +o allexport
envsubst < values.yaml | helm upgrade power-meme . --values -
replicas: 1
arango:
url: https://kszk-arangodb.kszk-arangodb.svc:8529
user: power
password: ${ARANGO_PASS}
db: power
Domain: power-distribution.k8s-01.sch.bme.hu
IngressClass: nginx
tag: latest
tmpPass: ${TMPPASS}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package models
import (
"context"
"crypto/tls"
"encoding/json"
"github.com/arangodb/go-driver"
"github.com/arangodb/go-driver/http"
......@@ -22,7 +23,10 @@ var power driver.Graph
func init() {
conn, err := http.NewConnection(http.ConnectionConfig{
Endpoints: []string{env.String("ARANGO", "http://localhost:8529")},
Endpoints: []string{env.String("ARANGO", "https://localhost:8529")},
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
},
})
if err != nil {
panic(err)
......
......@@ -39,7 +39,7 @@
console.log("alma")
reloadBtn.innerText = "reloading...";
reloadBtn.disabled = true;
const response = await fetch('/api/visjs')
const response = await fetch('api/visjs')
data = await response.json()
nodes.update(data.nodes);
......@@ -96,7 +96,7 @@
const name = prompt("Name?", "node69")
const power = prompt("Power usage?", "420")
const location = prompt("Location? {{ .locations }}", "rack1")
const resp = await fetch("/api/devices", {
const resp = await fetch("api/devices", {
method: "POST",
body: JSON.stringify({
Type: type,
......@@ -110,7 +110,7 @@
}
},
deleteNode: async function (nodeData, callback) {
const resp = await fetch(`/api/${nodeData.nodes[0]}`, {
const resp = await fetch(`api/${nodeData.nodes[0]}`, {
method: "DELETE"
})
if (resp.ok) {
......@@ -118,7 +118,7 @@
}
},
deleteEdge: async function (edgeData, callback) {
const resp = await fetch(`/api/${edgeData.edges[0]}`, {
const resp = await fetch(`api/${edgeData.edges[0]}`, {
method: "DELETE"
})
if (resp.ok) {
......@@ -127,7 +127,7 @@
},
addEdge: async function(edgeData,callback) {
if (edgeData.from !== edgeData.to) {
const resp = await fetch(`/api/plugs`, {
const resp = await fetch(`api/plugs`, {
method: "POST",
body: JSON.stringify({
"_from": edgeData.from,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment