Skip to content

Commit

Permalink
Initial release with linuxserver image
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Feurer committed Jan 28, 2024
1 parent 4b432c2 commit fbc51a7
Show file tree
Hide file tree
Showing 24 changed files with 1,047 additions and 164 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SHELL := bash
.SUFFIXES:

include Makefile.vars.mk
include Makefile.custom.mk

.PHONY: help
help: ## Show this help
Expand Down
2 changes: 2 additions & 0 deletions Makefile.custom.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Configure instance alias for commodore component compile
commodore_args += --alias $(instance)
269 changes: 225 additions & 44 deletions class/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,242 @@
parameters:
nextcloud:
=_metadata: {}
=_metadata:
multi_instance: true

namespace: syn-nextcloud
=_config:
redis:
'True':
- name: REDIS_HOST
value: redis-headless
- name: REDIS_HOST_PORT
value: '26379'
- name: REDIS_HOST_PASSWORD
valueFrom:
secretKeyRef:
name: redis
key: redis-password
'False': []

namespace:
annotations: {}
labels: {}
name: app-${_instance}

charts:
nextcloud:
source: https://nextcloud.github.io/helm
version: v4.1.0
version: 4.5.12
postgresql:
source: https://charts.bitnami.com/bitnami
version: 13.4.2
redis:
source: https://charts.bitnami.com/bitnami
version: 18.9.0

admin:
user: admin
password: changeme
images:
kubectl:
registry: docker.io
repository: bitnami/kubectl
tag: v1.28.4

ingress:
host: nextcloud.kube.home
database:
enabled: true
mode: standalone
persistence:
enabled: true
accessMode: ReadWriteOnce
storageClass: ''
size: 5Gi

mail:
redis:
enabled: false
fromAddress: user
domain: domain.com
smtp:
host: domain.com
secure: ssl
port: 465
authtype: LOGIN
name: user
password: pass

storage:
enabled: true
storageClass: null
accessMode: ReadWriteOnce
size: 10Gi
nextcloudData:
mode: replication
persistence:
enabled: false
accessMode: ReadWriteOnce
storageClass: ''
size: 1Gi

nextcloud:
region:
language: 'de'
locale: 'de_CH'
phone: 'CH'
timezone: 'Europe/Zurich'
url: nextcloud.local
persistence:
enabled: true
size: 50Gi
accessMode: ReadWriteOnce
storageClass: ''
size: 10Gi

resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 100m
memory: 128Mi
secrets:
postgresql: ?{vaultkv:${cluster:tenant}/${cluster:name}/nextcloud/${_instance}/postgresql}
redis: ?{vaultkv:${cluster:tenant}/${cluster:name}/nextcloud/${_instance}/redis}
nextcloud: ?{vaultkv:${cluster:tenant}/${cluster:name}/nextcloud/${_instance}/nextcloud}
token: ?{vaultkv:${cluster:tenant}/${cluster:name}/nextcloud/${_instance}/token}

helmValues:
postgresql:
architecture: ${nextcloud:database:mode}
auth:
enablePostgresUser: false
username: nextcloud
database: nextcloud
existingSecret: nextcloud
secretKeys:
adminPasswordKey: postgres-password
userPasswordKey: postgres-password
replicationPasswordKey: replication-password
commonLabels:
app.kubernetes.io/managed-by: commodore
primary:
resources:
limits: {}
requests: {}
podAntiAffinityPreset: soft
persistence:
enabled: ${nextcloud:database:persistence:enabled}
accessMode: ${nextcloud:database:persistence:accessMode}
storageClass: ${nextcloud:database:persistence:storageClass}
size: ${nextcloud:database:persistence:size}
tls:
enabled: false
serviceAccount:
create: false

redis:
architecture: ${nextcloud:redis:mode}
auth:
existingSecret: nextcloud
existingSecretPasswordKey: redis-password
commonLabels:
app.kubernetes.io/managed-by: commodore
master:
resources:
limits: {}
requests: {}
persistence:
enabled: ${nextcloud:redis:persistence:enabled}
replica:
resources:
limits: {}
requests: {}
persistence:
enabled: ${nextcloud:redis:persistence:enabled}
accessMode: ${nextcloud:redis:persistence:accessMode}
podAntiAffinityPreset: hard
sentinel:
enabled: true
resources:
limits: {}
requests: {}
persistence:
enabled: ${nextcloud:redis:persistence:enabled}
pdb:
create: true
minAvailable: ""
maxUnavailable: 1
tls:
enabled: false
autoGenerated: false
serviceAccount:
create: false

nextcloud:
host: ${nextcloud:ingress:host}
username: ${nextcloud:admin:user}
passowrd: ${nextcloud:admin:password}
mail: ${nextcloud:mail}
cronjob:
enabled: true
persistence: ${nextcloud:storage}
resources: ${nextcloud:resources}
metrics:
enabled: false
serviceMonitor:
deploymentLabels:
app.kubernetes.io/managed-by: commodore
internalDatabase:
enabled: false
externalDatabase:
enabled: ${nextcloud:database:enabled}
type: postgresql
host: postgresql
existingSecret:
enabled: true
secretName: nextcloud
usernameKey: postgres-username
passwordKey: postgres-password
nginx:
enabled: true
image:
flavor: fpm
postgresql:
enabled: false
redis:
enabled: false
ingress:
enabled: true
labels:
app.kubernetes.io/managed-by: commodore
nextcloud:
host: ${nextcloud:nextcloud:url}
existingSecret:
enabled: true
secretName: nextcloud
extraEnv: ${nextcloud:_config:redis:${nextcloud:redis:enabled}}
configs:
language.config.php: |-
<?php
$CONFIG = [
'default_language' => '${nextcloud:nextcloud:region:language}',
'default_locale' => '${nextcloud:nextcloud:region:locale}',
'default_phone_region' => '${nextcloud:nextcloud:region:phone}',
'default_timezone' => '${nextcloud:nextcloud:region:timezone}',
];
persistence:
enabled: ${nextcloud:nextcloud:persistence:enabled}
accessMode: ${nextcloud:nextcloud:persistence:accessMode}
storageClass: ${nextcloud:nextcloud:persistence:storageClass}
size: ${nextcloud:nextcloud:persistence:size}

## Redis Cluster Configs, maybe...
# phpConfigs:
# redis-cluster.ini: |-
# session.save_handler = rediscluster
# session.save_path = "seed[]=redis-cluster-endpoint&timeout=2&read_timeout=2&failover=error&persistent=1&auth[user]=redis-user&auth[pass]=redis-password"
# configs:
# redis-cluster.config.php: |-
# <?php
# $CONFIG = [
# 'memcache.local' => '\OC\Memcache\APCu',
# 'memcache.distributed' => '\\OC\\Memcache\\Redis',
# 'memcache.locking' => '\\OC\\Memcache\\Redis',
# 'redis' => [
# 'host' => 'redis-headless',
# 'port' => 6379,
# ],
# ];

# redis-cluster.config.php: |-
# <?php
# $CONFIG = [
# 'memcache.local' => '\OC\Memcache\APCu',
# 'memcache.distributed' => '\\OC\\Memcache\\Redis',
# 'memcache.locking' => '\\OC\\Memcache\\Redis',
# 'redis.cluster' => [
# 'seeds' => [
# 'redis-node-0.redis-headless.svc',
# 'redis-node-1.redis-headless.svc',
# 'redis-node-2.redis-headless.svc',
# ],
# ],
# ];

# redis-cluster.config.php: |-
# <?php
# $CONFIG = [
# 'memcache.distributed' => '\\OC\\Memcache\\Redis',
# 'memcache.locking' => '\\OC\\Memcache\\Redis',
# 'redis.cluster' => [
# 'seeds' => [
# 'redis-cluster-endpoint',
# ],
# 'timeout' => 0.0,
# 'read_timeout' => 0.0,
# 'failover_mode' => \RedisCluster::FAILOVER_ERROR,
# 'user' => 'redis-user',
# 'password' => 'redis-password'
# ],
# ];
#ALTER DATABASE nextcloud SET serial_normalization = virtual_sequence
61 changes: 49 additions & 12 deletions class/nextcloud.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,48 @@
parameters:
=_config:
database:
'True':
input_paths:
- ${_base_directory}/helmcharts/postgresql/${nextcloud:charts:postgresql:version}
input_type: helm
output_path: ${_instance}//10_helmchart/
helm_values: ${nextcloud:helmValues:postgresql}
helm_params:
name: postgresql
namespace: ${nextcloud:namespace:name}
dependency_update: false
'False':
input_paths: []
input_type: jsonnet
output_path: ''
redis:
'True':
input_paths:
- ${_base_directory}/helmcharts/redis/${nextcloud:charts:redis:version}
input_type: helm
output_path: ${_instance}//10_helmchart/
helm_values: ${nextcloud:helmValues:redis}
helm_params:
name: redis
namespace: ${nextcloud:namespace:name}
dependency_update: false
'False':
input_paths: []
input_type: jsonnet
output_path: ''

kapitan:
dependencies:
- type: helm
source: ${nextcloud:charts:redis:source}
chart_name: redis
version: ${nextcloud:charts:redis:version}
output_path: ${_base_directory}/helmcharts/redis/${nextcloud:charts:redis:version}/
- type: helm
source: ${nextcloud:charts:postgresql:source}
chart_name: postgresql
version: ${nextcloud:charts:postgresql:version}
output_path: ${_base_directory}/helmcharts/postgresql/${nextcloud:charts:postgresql:version}/
- type: helm
source: ${nextcloud:charts:nextcloud:source}
chart_name: nextcloud
Expand All @@ -14,20 +56,15 @@ parameters:
- input_paths:
- ${_base_directory}/component/main.jsonnet
input_type: jsonnet
output_path: nextcloud/
# Helmchart
output_path: ${_instance}/
- ${_config:database:${nextcloud:database:enabled}}
- ${_config:redis:${nextcloud:redis:enabled}}
- input_paths:
- ${_base_directory}/helmcharts/nextcloud/${nextcloud:charts:nextcloud:version}
input_type: helm
output_path: nextcloud/10_helmchart
helm_values: ${nextcloud:helmValues}
output_path: ${_instance}//10_helmchart/
helm_values: ${nextcloud:helmValues:nextcloud}
helm_params:
name: nextcloud
namespace: ${nextcloud:namespace}
dependency_update: true
commodore:
postprocess:
filters:
- type: jsonnet
path: nextcloud/10_helmchart/nextcloud/templates
filter: postprocess/patch_labels.jsonnet
namespace: ${nextcloud:namespace:name}
dependency_update: false
4 changes: 2 additions & 2 deletions component/app.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ local inv = kap.inventory();
local params = inv.parameters.nextcloud;
local argocd = import 'lib/argocd.libjsonnet';

local app = argocd.App('nextcloud', params.namespace);
local app = argocd.App(inv.parameters._instance, params.namespace.name);

{
nextcloud: app,
[inv.parameters._instance]: app,
}
Loading

0 comments on commit fbc51a7

Please sign in to comment.