Compare commits
2 Commits
3a9bd7c6b3
...
apps/homep
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0ad21a839f | ||
![]() |
62a076b574 |
@@ -2,7 +2,7 @@
|
||||
|
||||
Welcome! So excited you're here!
|
||||
|
||||
_This project is massively in progress. It's not ready to be used yet (even though I am using it as I develop it). This is published publicly for transparency. If you want to help out, please [get in touch](https://forum.civilsociety.dev/c/wild-cloud/5)._
|
||||
_This project is massively in progress. It's not ready to be used yet (even though I am using it as I develop it). This is published publicly for transparency. If you want to help out, please get in touch._
|
||||
|
||||
## Why Build Your Own Cloud?
|
||||
|
||||
|
2
apps/homepage/README.md
Normal file
2
apps/homepage/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# Homepage
|
||||
|
63
apps/homepage/configmap.yaml
Normal file
63
apps/homepage/configmap.yaml
Normal file
@@ -0,0 +1,63 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: homepage-config
|
||||
namespace: homepage
|
||||
labels:
|
||||
app: homepage
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
||||
data:
|
||||
bookmarks.yaml: |
|
||||
- Developer:
|
||||
- Github:
|
||||
- abbr: GH
|
||||
href: https://github.com/
|
||||
kubernetes.yaml: |
|
||||
mode: cluster
|
||||
services.yaml: |
|
||||
- Wild Cloud Services:
|
||||
- Traefik Dashboard:
|
||||
href: https://traefik.example.com
|
||||
description: Traefik reverse proxy dashboard
|
||||
- Longhorn:
|
||||
href: https://longhorn.example.com
|
||||
description: Distributed storage management
|
||||
settings.yaml: |
|
||||
title: Wild Cloud Dashboard
|
||||
theme: dark
|
||||
layout:
|
||||
- Wild Cloud Services:
|
||||
style: row
|
||||
columns: 2
|
||||
widgets.yaml: |
|
||||
- kubernetes:
|
||||
cluster:
|
||||
show: true
|
||||
cpu: true
|
||||
memory: true
|
||||
showLabel: true
|
||||
label: "cluster"
|
||||
nodes:
|
||||
show: true
|
||||
cpu: true
|
||||
memory: true
|
||||
showLabel: true
|
||||
- resources:
|
||||
backend: resources
|
||||
expanded: true
|
||||
cpu: true
|
||||
memory: true
|
||||
network: default
|
||||
- search:
|
||||
provider: duckduckgo
|
||||
target: _blank
|
||||
docker.yaml: |
|
||||
# Docker configuration for homepage
|
||||
# This file is required by the homepage application
|
||||
custom.css: |
|
||||
/* Custom CSS for homepage */
|
||||
/* Add your custom styles here */
|
||||
custom.js: |
|
||||
// Custom JavaScript for homepage
|
||||
// Add your custom scripts here
|
37
apps/homepage/deployment.yaml
Normal file
37
apps/homepage/deployment.yaml
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: homepage
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: homepage
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: homepage
|
||||
spec:
|
||||
serviceAccountName: homepage
|
||||
containers:
|
||||
- name: homepage
|
||||
image: "{{ .apps.homepage.image }}"
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
name: http
|
||||
env:
|
||||
- name: HOMEPAGE_ALLOWED_HOSTS
|
||||
value: "{{ .apps.homepage.domain }}"
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /app/config
|
||||
readOnly: true
|
||||
- name: logs
|
||||
mountPath: /app/config/logs
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: homepage-config
|
||||
- name: logs
|
||||
emptyDir: {}
|
24
apps/homepage/ingress.yaml
Normal file
24
apps/homepage/ingress.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: homepage-public
|
||||
annotations:
|
||||
external-dns.alpha.kubernetes.io/target: "{{ .apps.homepage.domain }}"
|
||||
external-dns.alpha.kubernetes.io/cloudflare-proxied: "false"
|
||||
spec:
|
||||
rules:
|
||||
- host: "{{ .apps.homepage.domain }}"
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: homepage
|
||||
port:
|
||||
number: 3000
|
||||
tls:
|
||||
- secretName: wildcard-wild-cloud-tls
|
||||
hosts:
|
||||
- "{{ .apps.homepage.domain }}"
|
16
apps/homepage/kustomization.yaml
Normal file
16
apps/homepage/kustomization.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: homepage
|
||||
labels:
|
||||
- includeSelectors: true
|
||||
pairs:
|
||||
app: homepage
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- service-account.yaml
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- ingress.yaml
|
||||
- configmap.yaml
|
12
apps/homepage/manifest.yaml
Normal file
12
apps/homepage/manifest.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
name: homepage
|
||||
install: true
|
||||
description: Homepage is a modern, fully static, fast, secure fully proxied, highly customizable application dashboard with integrations for over 100 services.
|
||||
version: 1.0.0
|
||||
icon: https://gethomepage.dev/favicon.ico
|
||||
requires: []
|
||||
defaultConfig:
|
||||
image: ghcr.io/gethomepage/homepage:latest
|
||||
domain: homepage.{{ .cloud.internalDomain }}
|
||||
port: 3000
|
||||
tlsSecretName: wildcard-internal-wild-cloud-tls
|
||||
requiredSecrets: []
|
8
apps/homepage/namespace.yaml
Normal file
8
apps/homepage/namespace.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: homepage
|
||||
labels:
|
||||
app: homepage
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
9
apps/homepage/service-account.yaml
Normal file
9
apps/homepage/service-account.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: homepage
|
||||
namespace: homepage
|
||||
labels:
|
||||
app: homepage
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
17
apps/homepage/service.yaml
Normal file
17
apps/homepage/service.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: homepage
|
||||
namespace: homepage
|
||||
labels:
|
||||
app: homepage
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: 3000
|
||||
targetPort: http
|
||||
name: http
|
||||
selector:
|
||||
app: homepage
|
@@ -28,8 +28,8 @@ Tests project detection and script execution:
|
||||
|
||||
### `test_config_functions.bats`
|
||||
Tests configuration and secret access:
|
||||
- `wild-config` command
|
||||
- `wild-secret` command
|
||||
- `get_current_config()` function
|
||||
- `get_current_secret()` function
|
||||
- Configuration access from subdirectories
|
||||
- Fixture data usage
|
||||
|
||||
|
@@ -36,18 +36,14 @@ teardown() {
|
||||
@test "init_wild_env sets WC_HOME correctly" {
|
||||
mkdir -p "$TEST_PROJECT_DIR/deep/nested"
|
||||
cd "$TEST_PROJECT_DIR/deep/nested"
|
||||
unset WC_HOME
|
||||
export WC_ROOT="$PROJECT_ROOT"
|
||||
export PATH="$PROJECT_ROOT/bin:$PATH"
|
||||
unset WC_HOME WC_ROOT
|
||||
init_wild_env
|
||||
assert_equal "$WC_HOME" "$TEST_PROJECT_DIR"
|
||||
}
|
||||
|
||||
@test "init_wild_env sets WC_ROOT correctly" {
|
||||
cd "$TEST_PROJECT_DIR"
|
||||
unset WC_HOME
|
||||
export WC_ROOT="$PROJECT_ROOT"
|
||||
export PATH="$PROJECT_ROOT/bin:$PATH"
|
||||
unset WC_HOME WC_ROOT
|
||||
init_wild_env
|
||||
# WC_ROOT is set (value depends on test execution context)
|
||||
assert [ -n "$WC_ROOT" ]
|
||||
@@ -62,7 +58,7 @@ teardown() {
|
||||
@test "print functions work correctly" {
|
||||
cd "$TEST_PROJECT_DIR"
|
||||
run bash -c '
|
||||
source "$PROJECT_ROOT/scripts/common.sh"
|
||||
source "$PROJECT_ROOT/bin/wild-common.sh"
|
||||
print_header "Test Header"
|
||||
print_info "Test info message"
|
||||
print_warning "Test warning message"
|
||||
|
@@ -15,47 +15,45 @@ teardown() {
|
||||
teardown_test_project "config-test"
|
||||
}
|
||||
|
||||
@test "wild-config with existing config" {
|
||||
CLUSTER_NAME=$(wild-config "cluster.name")
|
||||
@test "get_current_config with existing config" {
|
||||
CLUSTER_NAME=$(get_current_config "cluster.name")
|
||||
assert_equal "$CLUSTER_NAME" "test-cluster"
|
||||
}
|
||||
|
||||
@test "wild-config with nested path" {
|
||||
VIP=$(wild-config "cluster.nodes.control.vip")
|
||||
@test "get_current_config with nested path" {
|
||||
VIP=$(get_current_config "cluster.nodes.control.vip")
|
||||
assert_equal "$VIP" "192.168.100.200"
|
||||
}
|
||||
|
||||
@test "wild-config with non-existent key" {
|
||||
NONEXISTENT=$(wild-config "nonexistent.key")
|
||||
@test "get_current_config with non-existent key" {
|
||||
NONEXISTENT=$(get_current_config "nonexistent.key")
|
||||
assert_equal "$NONEXISTENT" ""
|
||||
}
|
||||
|
||||
@test "active nodes configuration access - interface" {
|
||||
CONTROL_NODE_INTERFACE=$(wild-config "cluster.nodes.active.\"192.168.100.201\".interface")
|
||||
CONTROL_NODE_INTERFACE=$(get_current_config "cluster.nodes.active.\"192.168.100.201\".interface")
|
||||
assert_equal "$CONTROL_NODE_INTERFACE" "eth0"
|
||||
}
|
||||
|
||||
@test "active nodes configuration access - maintenance IP" {
|
||||
MAINTENANCE_IP=$(wild-config "cluster.nodes.active.\"192.168.100.201\".maintenanceIp")
|
||||
MAINTENANCE_IP=$(get_current_config "cluster.nodes.active.\"192.168.100.201\".maintenanceIp")
|
||||
assert_equal "$MAINTENANCE_IP" "192.168.100.131"
|
||||
}
|
||||
|
||||
@test "wild-secret function" {
|
||||
@test "get_current_secret function" {
|
||||
# Create temporary secrets file for testing
|
||||
cp "$TEST_DIR/fixtures/sample-secrets.yaml" "$TEST_PROJECT_DIR/secrets.yaml"
|
||||
|
||||
SECRET_VAL=$(wild-secret "operator.cloudflareApiToken")
|
||||
SECRET_VAL=$(get_current_secret "operator.cloudflareApiToken")
|
||||
assert_equal "$SECRET_VAL" "test_api_token_123456789"
|
||||
}
|
||||
|
||||
@test "config access from subdirectory" {
|
||||
mkdir -p "$TEST_PROJECT_DIR/config-subdir"
|
||||
cd "$TEST_PROJECT_DIR/config-subdir"
|
||||
unset WC_HOME
|
||||
export WC_ROOT="$PROJECT_ROOT"
|
||||
export PATH="$PROJECT_ROOT/bin:$PATH"
|
||||
unset WC_HOME WC_ROOT
|
||||
init_wild_env
|
||||
|
||||
SUBDIR_CLUSTER=$(wild-config "cluster.name")
|
||||
SUBDIR_CLUSTER=$(get_current_config "cluster.name")
|
||||
assert_equal "$SUBDIR_CLUSTER" "test-cluster"
|
||||
}
|
@@ -29,7 +29,7 @@ setup_test_project() {
|
||||
fi
|
||||
|
||||
# Source wild-common.sh
|
||||
source "$PROJECT_ROOT/scripts/common.sh"
|
||||
source "$PROJECT_ROOT/bin/wild-common.sh"
|
||||
}
|
||||
|
||||
# Clean up test environment
|
||||
|
@@ -59,9 +59,7 @@ teardown() {
|
||||
cd "$TEST_PROJECT_DIR/config-test"
|
||||
|
||||
# Set up environment like the scripts do
|
||||
unset WC_HOME
|
||||
export WC_ROOT="$PROJECT_ROOT"
|
||||
export PATH="$PROJECT_ROOT/bin:$PATH"
|
||||
unset WC_HOME WC_ROOT
|
||||
init_wild_env
|
||||
|
||||
CLUSTER_NAME=$("$PROJECT_ROOT/bin/wild-config" cluster.name 2>/dev/null)
|
||||
@@ -70,10 +68,8 @@ teardown() {
|
||||
|
||||
@test "environment variables from project root" {
|
||||
cd "$TEST_PROJECT_DIR"
|
||||
unset WC_HOME
|
||||
export WC_ROOT="$PROJECT_ROOT"
|
||||
export PATH="$PROJECT_ROOT/bin:$PATH"
|
||||
source "$PROJECT_ROOT/scripts/common.sh"
|
||||
unset WC_HOME WC_ROOT
|
||||
source "$PROJECT_ROOT/bin/wild-common.sh"
|
||||
init_wild_env
|
||||
|
||||
assert_equal "$WC_HOME" "$TEST_PROJECT_DIR"
|
||||
@@ -83,10 +79,8 @@ teardown() {
|
||||
@test "environment variables from nested directory" {
|
||||
mkdir -p "$TEST_PROJECT_DIR/deep/very"
|
||||
cd "$TEST_PROJECT_DIR/deep/very"
|
||||
unset WC_HOME
|
||||
export WC_ROOT="$PROJECT_ROOT"
|
||||
export PATH="$PROJECT_ROOT/bin:$PATH"
|
||||
source "$PROJECT_ROOT/scripts/common.sh"
|
||||
unset WC_HOME WC_ROOT
|
||||
source "$PROJECT_ROOT/bin/wild-common.sh"
|
||||
init_wild_env
|
||||
|
||||
assert_equal "$WC_HOME" "$TEST_PROJECT_DIR"
|
||||
|
Reference in New Issue
Block a user