hackyhacky
This commit is contained in:
parent
07a2c46227
commit
0ca64316f4
8 changed files with 61 additions and 44 deletions
|
@ -1,5 +0,0 @@
|
|||
STACK_NAME=dashboard
|
||||
DOCKER_CONTEXT=dev.local-it.cloud
|
||||
DOMAIN=dashboard.dev.local-it.cloud
|
||||
LETS_ENCRYPT_ENV=production
|
||||
REACT_APP_API_URL=http://127.0.0.1:5000/api/v1
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,6 +14,7 @@
|
|||
# misc
|
||||
.DS_Store
|
||||
.env
|
||||
.envrc
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
|
|
|
@ -19,14 +19,13 @@ CONFIG_DATA = [
|
|||
]
|
||||
|
||||
@api_v1.route('/apps', methods=['GET'])
|
||||
@jwt_required()
|
||||
# @jwt_required()
|
||||
@cross_origin()
|
||||
def get_apps():
|
||||
"""Return data about all apps"""
|
||||
apps = AppsService.get_all_apps()
|
||||
return jsonify(apps)
|
||||
|
||||
|
||||
@api_v1.route('/apps/<string:slug>', methods=['GET'])
|
||||
@jwt_required()
|
||||
def get_app(slug):
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
from .models_lit import LITApp
|
||||
from .models import App, AppRole
|
||||
|
||||
class AppsService:
|
||||
@staticmethod
|
||||
def get_all_apps():
|
||||
apps = App.query.all()
|
||||
apps = [
|
||||
LITApp(id=1, name="Dateiablage", slug="nextcloud", external=True, url="https://cloud.dev.local-it.cloud"),
|
||||
LITApp(id=2, name="Projekte", slug="vikunja", external=True, url="https://vikunja.dev.local-it.cloud"),
|
||||
]
|
||||
# App.query.all()
|
||||
return [app.to_dict() for app in apps]
|
||||
|
||||
@staticmethod
|
||||
|
@ -14,4 +19,4 @@ class AppsService:
|
|||
@staticmethod
|
||||
def get_app_roles():
|
||||
app_roles = AppRole.query.all()
|
||||
return [{"user_id": app_role.user_id, "app_id": app_role.app_id, "role_id": app_role.role_id} for app_role in app_roles]
|
||||
return [{"user_id": app_role.user_id, "app_id": app_role.app_id, "role_id": app_role.role_id} for app_role in app_roles]
|
46
backend/areas/apps/models_lit.py
Normal file
46
backend/areas/apps/models_lit.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
"""Everything to do with Apps"""
|
||||
|
||||
import os
|
||||
import base64
|
||||
|
||||
from sqlalchemy import ForeignKey, Integer, String, Boolean
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from database import db
|
||||
from .models import App
|
||||
# import helpers.kubernetes as k8s
|
||||
|
||||
|
||||
DEFAULT_APP_SUBDOMAINS = {
|
||||
"nextcloud": "files",
|
||||
"wordpress": "www",
|
||||
"monitoring": "grafana",
|
||||
}
|
||||
|
||||
class LITApp(App):
|
||||
"""
|
||||
"""
|
||||
|
||||
def get_url(self):
|
||||
return self.url
|
||||
|
||||
def to_dict(self):
|
||||
"""
|
||||
represent this object as a dict, compatible for JSON output
|
||||
"""
|
||||
return {"id": self.id,
|
||||
"name": self.name,
|
||||
"slug": self.slug,
|
||||
"external": self.external,
|
||||
"status": self.get_status(),
|
||||
"url": self.get_url()}
|
||||
|
||||
|
||||
|
||||
def get_status(self):
|
||||
"""Returns an AppStatus object that describes the current cluster state"""
|
||||
return {
|
||||
"installed": "",
|
||||
"ready": "",
|
||||
"message": "",
|
||||
}
|
|
@ -19,4 +19,4 @@ SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|||
# Set this to "true" to load the config from a Kubernetes serviceaccount
|
||||
# running in a Kubernetes pod. Set it to "false" to load the config from the
|
||||
# `KUBECONFIG` environment variable.
|
||||
LOAD_INCLUSTER_CONFIG = os.environ.get("LOAD_INCLUSTER_CONFIG").lower() == "true"
|
||||
LOAD_INCLUSTER_CONFIG = os.environ.get("LOAD_INCLUSTER_CONFIG") == "true"
|
||||
|
|
|
@ -20,11 +20,11 @@ from config import LOAD_INCLUSTER_CONFIG
|
|||
#
|
||||
# By default this loads whatever we define in the `KUBECONFIG` env variable,
|
||||
# otherwise loads the config from default locations, similar to what kubectl
|
||||
# does.
|
||||
if LOAD_INCLUSTER_CONFIG:
|
||||
config.load_incluster_config()
|
||||
else:
|
||||
config.load_kube_config()
|
||||
# # does.
|
||||
# if LOAD_INCLUSTER_CONFIG:
|
||||
# config.load_incluster_config()
|
||||
# else:
|
||||
# config.load_kube_config()
|
||||
|
||||
def create_variables_secret(app_slug, variables_filepath):
|
||||
"""Checks if a variables secret for app_name already exists, generates it if necessary.
|
||||
|
|
29
compose.yml
29
compose.yml
|
@ -1,29 +0,0 @@
|
|||
version: "3.8"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: yksflip/dashboard:latest
|
||||
build: .
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 1m
|
||||
networks:
|
||||
- proxy
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
|
||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
|
||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||
- "traefik.http.middlewares.${STACK_NAME}.headers.customFrameOptionsValue=sameorigin"
|
||||
- "coop-cloud.${STACK_NAME}.app.version=1.0.0+v0.1"
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
Loading…
Reference in a new issue