Commit ce0416af authored by Mitchell Monahan's avatar Mitchell Monahan
Browse files

i forgot everything i did

parent 28f7b58e
local kube = import "../kube-libsonnet/kube.libsonnet";
{
new(name): {
local deluge = self,
name:: name,
image:: "ghcr.io/linuxserver/deluge",
storageClass:: error "storageClass must be defined for config volume",
settings:: {
puid: 1000,
pgid: 1000,
tz: error "tz must be defined",
loglevel: "error"
},
ingressCfg:: error "Ingress options must be defined",
pvc: error "pvc must be defined for storage",
configPvc: kube.PersistentVolumeClaim(name + "-config") {
storageClass: deluge.storageClass,
storage: "50Mi"
},
deployment: kube.Deployment(deluge.name) {
spec+: {
replicas: 1,
template+: {
spec+: {
volumes_+: {
config: kube.PersistentVolumeClaimVolume(deluge.configPvc),
data: kube.PersistentVolumeClaimVolume(deluge.pvc)
},
containers_+: {
deluge: kube.Container("deluge") {
image: deluge.image,
resources: {
requests: { cpu: "100m", memory: "128Mi" },
limits: { cpu: "500m", memory: "512Mi" },
},
ports_+: { http: { containerPort: 8112 } },
env_: {
PUID: std.toString(deluge.settings.puid),
PGID: std.toString(deluge.settings.pgid),
TZ: deluge.settings.tz,
DELUGE_LOGLEVEL: deluge.settings.loglevel
},
volumeMounts_: {
config: { mountPath: "/config" },
data: { mountPath: "/downloads" },
}}}}}}},
svc: kube.Service(deluge.name) {
target_pod: deluge.deployment.spec.template
},
ingress: kube.Ingress(deluge.name) {
metadata+: {
annotations+: if deluge.ingressCfg.annotations != null then deluge.ingressCfg.annotations else [],
},
spec+: {
[if std.objectHas(deluge.ingressCfg, "class") then "ingressClassName"]: deluge.ingressCfg.class,
[if std.objectHas(deluge.ingressCfg, "tls") then "tls"]: deluge.ingressCfg.tls,
rules: [
{
host: deluge.ingressCfg.host,
http: {
paths: [
{
path: "/",
backend: {
serviceName: deluge.svc.metadata.name,
servicePort: deluge.svc.port
}}]}}]}}
},
}
\ No newline at end of file
local kube = import "../kube-libsonnet/kube.libsonnet";
{
new(name): {
local filebrowser = self,
name:: name,
image:: "hurlenko/filebrowser",
storageClass:: error "storageClass must be defined for config volume",
settings:: {
puid: 1000,
pgid: 1000,
},
ingressCfg:: error "Ingress options must be defined",
pvc: error "pvc must be defined for storage",
configPvc: kube.PersistentVolumeClaim(name + "-config") {
storageClass: filebrowser.storageClass,
storage: "50Mi"
},
deployment: kube.Deployment(filebrowser.name) {
spec+: {
replicas: 1,
template+: {
spec+: {
volumes_+: {
config: kube.PersistentVolumeClaimVolume(filebrowser.configPvc),
data: kube.PersistentVolumeClaimVolume(filebrowser.pvc)
},
containers_+: {
filebrowser: kube.Container("filebrowser") {
image: filebrowser.image,
resources: {
requests: { cpu: "100m", memory: "128Mi" },
limits: { cpu: "500m", memory: "128Mi" },
},
securityContext: {
runAsUser: filebrowser.settings.puid,
runAsGroup: filebrowser.settings.pgid
},
ports_+: { http: { containerPort: 8080 } },
volumeMounts_: {
config: { mountPath: "/config" },
data: { mountPath: "/data" },
}}}}}}},
svc: kube.Service(filebrowser.name) {
target_pod: filebrowser.deployment.spec.template
},
ingress: kube.Ingress(filebrowser.name) {
metadata+: {
annotations+: if filebrowser.ingressCfg.annotations != null then filebrowser.ingressCfg.annotations else [],
},
spec+: {
[if std.objectHas(filebrowser.ingressCfg, "class") then "ingressClassName"]: filebrowser.ingressCfg.class,
[if std.objectHas(filebrowser.ingressCfg, "tls") then "tls"]: filebrowser.ingressCfg.tls,
rules: [
{
host: filebrowser.ingressCfg.host,
http: {
paths: [
{
path: "/",
backend: {
serviceName: filebrowser.svc.metadata.name,
servicePort: filebrowser.svc.port
}}]}}]}}
},
}
\ No newline at end of file
local kube = import "../kube-libsonnet/kube.libsonnet";
local postgres = import "postgresql.libsonnet";
{
new(name): {
local hedgedoc = self,
name:: name,
image:: "quay.io/hedgedoc/hedgedoc:1.7.1-alpine",
dbPass:: error "Database password must be defined",
storageClass:: error "Storage class must be defined",
dbSize:: error "Database size must be defined",
dbName:: hedgedoc.name,
dbUsername:: hedgedoc.name,
ingressCfg:: error "Ingress options must be defined",
useGravatar:: false,
useCdn:: false,
allowAnonymous:: true,
allowFreeUrl:: true,
defaultPermission:: "protected",
deployment: kube.Deployment(hedgedoc.name) {
spec+: {
replicas: 1,
template+: {
spec+: {
containers_+: {
hedgedoc: kube.Container(hedgedoc.name) {
image: hedgedoc.image,
resources: {
requests: { cpu: "0m", memory: "64Mi" },
limits: { cpu: "256m", memory: "256Mi" }
},
ports_+: { http: { containerPort: 3000 } },
readinessProbe: {
httpGet: {
path: "/",
port: "http"
},
initialDelaySeconds: 10,
periodSeconds: 5
},
env_: {
CMD_DB_URL: kube.SecretKeyRef(hedgedoc.db.secret, "uri"),
CMD_LOGLEVEL: "info",
CMD_ALLOW_GRAVATAR: if hedgedoc.useGravatar == true then "true" else "false",
CMD_USECDN: if hedgedoc.useCdn == true then "true" else "false",
CMD_ALLOW_ANONYMOUS: if hedgedoc.allowAnonymous == true then "true" else "false",
CMD_ALLOW_FREEURL: if hedgedoc.allowFreeUrl == true then "true" else "false",
CMD_DEFAULT_PERMISSION: hedgedoc.defaultPermission
},
}
}
}
}
}
},
db: postgres.new(hedgedoc.dbName) {
storageClass: hedgedoc.storageClass,
size: hedgedoc.dbSize,
user: hedgedoc.dbUsername,
password: hedgedoc.dbPass
},
service: kube.Service(hedgedoc.name) {
target_pod: hedgedoc.deployment.spec.template
},
ingress: kube.Ingress(hedgedoc.name) {
metadata+: {
annotations+: if hedgedoc.ingressCfg.annotations != null then hedgedoc.ingressCfg.annotations else [],
},
spec+: {
[if std.objectHas(hedgedoc.ingressCfg, "class") then "ingressClassName"]: hedgedoc.ingressCfg.class,
[if std.objectHas(hedgedoc.ingressCfg, "tls") then "tls"]: hedgedoc.ingressCfg.tls,
rules: [
{
host: hedgedoc.ingressCfg.host,
http: {
paths: [
{
path: "/",
backend: {
serviceName: hedgedoc.service.metadata.name,
servicePort: hedgedoc.service.port
}}]}}]}}
}
}
\ No newline at end of file
local kube = import "../kube-libsonnet/kube.libsonnet";
{
new(name): {
local plex = self,
name:: name,
image:: "ghcr.io/linuxserver/plex",
storageClass:: error "storageClass must be defined for config volume",
settings:: {
puid: 1000,
pgid: 1000,
},
ingressCfg:: error "Ingress options must be defined",
pvc: error "pvc must be defined for storage",
configPvc: kube.PersistentVolumeClaim(name + "-config") {
storageClass: plex.storageClass,
storage: "50Mi"
},
deployment: kube.Deployment(plex.name) {
spec+: {
replicas: 1,
template+: {
spec+: {
volumes_+: {
config: kube.PersistentVolumeClaimVolume(plex.configPvc),
data: kube.PersistentVolumeClaimVolume(plex.pvc)
},
containers_+: {
plex: kube.Container("plex") {
image: plex.image,
resources: {
requests: { cpu: "100m", memory: "128Mi" },
limits: { cpu: "5000m", memory: "2Gi" },
},
ports_+: {
http: { containerPort: 32400 },
udp1: { containerPort: 32400, protocol: "UDP" },
plex2: { containerPort: 32469 },
udp2: { containerPort: 32469, protocol: "UDP" },
udp3: { containerPort: 5353, protocol: "UDP" },
udp4: { containerPort: 1900, protocol: "UDP" },
},
env_: {
PUID: std.toString(plex.settings.puid),
PGID: std.toString(plex.settings.pgid),
CLAIM_CODE: "claim-UijZXq_Xg2NWizMa_e57",
},
volumeMounts_: {
config: { mountPath: "/config" },
data: { mountPath: "/data" },
}}}}}}},
svc: kube.Service(plex.name) {
target_pod: plex.deployment.spec.template,
spec+: {
type: "LoadBalancer",
externalIPs: [ "172.23.0.167" ],
},
},
ingress: kube.Ingress(plex.name) {
metadata+: {
annotations+: if plex.ingressCfg.annotations != null then plex.ingressCfg.annotations else [],
},
spec+: {
[if std.objectHas(plex.ingressCfg, "class") then "ingressClassName"]: plex.ingressCfg.class,
[if std.objectHas(plex.ingressCfg, "tls") then "tls"]: plex.ingressCfg.tls,
rules: [
{
host: plex.ingressCfg.host,
http: {
paths: [
{
path: "/",
backend: {
serviceName: plex.svc.metadata.name,
servicePort: plex.svc.port
}}]}}]}}
},
}
\ No newline at end of file
local kube = import "../kube-libsonnet/kube.libsonnet";
{
new(name): {
local db = self,
name:: name,
storageClass:: error "storageClass must be defined",
size:: error "size must be defined",
user:: error "user must be defined",
password:: error "password must be defined",
replicas:: 1,
image:: "postgres:latest",
resources:: {
requests: { cpu: "100m", memory: "64Mi" },
limits: { cpu: "500m", memory: "512Mi" },
},
volume: kube.PersistentVolumeClaim(name + "-postgres-pvc") {
storageClass: db.storageClass,
storage: db.size
},
deployment: kube.Deployment(name + "-postgres") {
spec+: {
replicas: db.replicas,
template+: {
spec+: {
volumes_+: {
storage: kube.PersistentVolumeClaimVolume(db.volume)
},
containers_+: {
postgres: kube.Container("postgres") {
image: db.image,
resources: db.resources,
ports_+: { mysql: { containerPort: 3306 } },
env_: {
POSTGRES_DB: kube.SecretKeyRef(db.secret, "name"),
POSTGRES_USER: kube.SecretKeyRef(db.secret, "user"),
POSTGRES_PASSWORD: kube.SecretKeyRef(db.secret, "password"),
},
volumeMounts_: {
storage: { mountPath: "/var/lib/postgresql/data" },
}}}}}}},
service: kube.Service(name + "-postgres-svc") {
target_pod: db.deployment.spec.template
},
secret: kube.Secret(name + "-postgres-creds") {
data_: {
name: db.name,
user: db.user,
password: db.password,
uri: "postgres://" + db.user + ":" + db.password + "@" + db.service.metadata.name + "/" + db.name
},
},
}
}
\ No newline at end of file
local kube = import "../kube-libsonnet/kube.libsonnet";
{
envValueIfNotNull(name, value):: {
[if value != null then name]: std.toString(value),
},
new(name): {
local transfersh = self,
name:: name,
image:: "dutchcoders/transfer.sh:latest",
storageClass:: error "storageClass must be defined for data volume",
storageSize:: error "storageSize must be defined for data volume",
settings:: {
listener: 80,
httpAuthUser: null,
httpAuthPass: null,
gaKey: null,
provider: error "provider must be set (valid options: s3, storj, gdrive, local)",
uservoiceKey: null,
s3: {
awsAccessKey: null,
awsSecretKey: null,
bucket: null,
endpoint: null,
region: null,
noMultipart: null,
pathStyle: false
},
storj: {
access: null,
bucket: null,
},
basedir: if (transfersh.settings.provider == "gdrive" || transfersh.settings.provider == "local") then "/data" else null,
gdrive: {
clientJsonFilepath: null,
localConfigPath: null,
chunkSize: null
},
rateLimit: null,
maxUploadSize: null,
purgeDays: null,
purgeInterval: null
},
ingressCfg:: error "Ingress options must be defined",
pvc: kube.PersistentVolumeClaim(name + "-storage") {
storageClass: transfersh.storageClass,
storage: transfersh.storageSize
},
deployment: kube.Deployment(transfersh.name) {
spec+: {
replicas: 1,
template+: {
spec+: {
volumes_+: {
data: kube.PersistentVolumeClaimVolume(transfersh.pvc)
},
containers_+: {
transfersh: kube.Container("transfersh") {
image: transfersh.image,
resources: {
requests: { cpu: "100m", memory: "128Mi" },
limits: { cpu: "500m", memory: "512Mi" },
},
ports_+: { http: { containerPort: transfersh.settings.listener } },
env_: {
LISTENER: transfersh.settings.listener,
PROVIDER: transfersh.settings.provider,
}
+ $.envValueIfNotNull("HTTP_AUTH_USER", transfersh.settings.httpAuthUser)
+ $.envValueIfNotNull("HTTP_AUTH_PASS", transfersh.settings.httpAuthPass)
+ $.envValueIfNotNull("GA_KEY", transfersh.settings.gaKey)
+ $.envValueIfNotNull("USERVOICE_KEY", transfersh.settings.uservoiceKey)
+ $.envValueIfNotNull("AWS_SECRET_KEY", transfersh.settings.s3.awsSecretKey)
+ $.envValueIfNotNull("BUCKET", transfersh.settings.s3.bucket)
+ $.envValueIfNotNull("S3_ENDPOINT", transfersh.settings.s3.endpoint)
+ $.envValueIfNotNull("S3_REGION", transfersh.settings.s3.region)
+ $.envValueIfNotNull("S3_NO_MULTIPART", transfersh.settings.s3.noMultipart)
+ $.envValueIfNotNull("S3_PATH_STYLE", transfersh.settings.s3.pathStyle)
+ $.envValueIfNotNull("STORJ_ACCESS", transfersh.settings.storj.access)
+ $.envValueIfNotNull("STORJ_BUCKET", transfersh.settings.storj.bucket)
+ $.envValueIfNotNull("BASEDIR", transfersh.settings.basedir)
+ $.envValueIfNotNull("GDRIVE_CLIENT_JSON_FILEPATH", transfersh.settings.gdrive.clientJsonFilepath)
+ $.envValueIfNotNull("GDRIVE_LOCAL_CONFIG_PATH", transfersh.settings.gdrive.localConfigPath)
+ $.envValueIfNotNull("GDRIVE_CHUNK_SIZE", transfersh.settings.gdrive.chunkSize)
+ $.envValueIfNotNull("RATE_LIMIT", transfersh.settings.rateLimit)
+ $.envValueIfNotNull("MAX_UPLOAD_SIZE", transfersh.settings.maxUploadSize)
+ $.envValueIfNotNull("PURGE_DAYS", transfersh.settings.purgeDays)
+ $.envValueIfNotNull("PURGE_INTERVAL", transfersh.settings.purgeInterval),
volumeMounts_: {
data: { mountPath: "/downloads" },
}}}}}}},
svc: kube.Service(transfersh.name) {
target_pod: transfersh.deployment.spec.template
},
ingress: kube.Ingress(transfersh.name) {
metadata+: {
annotations+: (if transfersh.ingressCfg.annotations != null then transfersh.ingressCfg.annotations else {}) + {
"nginx.ingress.kubernetes.io/proxy-body-size": if transfersh.settings.maxUploadSize != null then transfersh.settings.maxUploadSize else "100g"
},
},
spec+: {
[if std.objectHas(transfersh.ingressCfg, "class") then "ingressClassName"]: transfersh.ingressCfg.class,
[if std.objectHas(transfersh.ingressCfg, "tls") then "tls"]: transfersh.ingressCfg.tls,
rules: [
{
host: transfersh.ingressCfg.host,
http: {
paths: [
{
path: "/",
backend: {
serviceName: transfersh.svc.metadata.name,
servicePort: transfersh.svc.port
}}]}}]}}
},
}
\ No newline at end of file
......@@ -3,10 +3,10 @@ local ghost = import "apps/ghost.libsonnet";
{
ghost: ghost.new("ghost") {
dbPass: "ACfKp5exBmLZq7Fh",
storageClass: "local-path",
storageClass: "microk8s-hostpath",
storageSize: "1Gi",
dbSize: "1Gi",
url: "nofla.me",
url: "https://nofla.me",
ingressCfg: {
host: "nofla.me",
annotations: {
......
local hedgedoc = import "apps/hedgedoc.libsonnet";
{
hedgedoc: hedgedoc.new("codimd") {
dbPass: "ACfKp5exBmLZq7Fh",
storageClass: "local-path",
dbSize: "1Gi",
ingressCfg: {
host: "notes-test.nofla.me",
annotations: {
"cert-manager.io/cluster-issuer": "letsencrypt-production",
"traefik.ingress.kubernetes.io/redirect-entry-point": "https"
},
tls: [
{
hosts: ["notes.nofla.me"],
secretName: "notes-nofla-me-tls",
}
]
}
}
}
\ No newline at end of file
local kube = import "kube-libsonnet/kube.libsonnet";
local deluge = import "apps/deluge.libsonnet";
local plex = import "apps/plex.libsonnet";
local filebrowser = import "apps/filebrowser.libsonnet";
{
data: kube.PersistentVolumeClaim("media-vol") {
storageClass: "microk8s-hostpath",
storage: "100Gi"
},
deluge: deluge.new("deluge") {
storageClass: "microk8s-hostpath",
settings+: {
tz: "America/New_York"
},
pvc: $.data,
ingressCfg: {
host: "deluge.nofla.me",
annotations: {
"cert-manager.io/cluster-issuer": "letsencrypt-production",
"kubernetes.io/ingress.class": "nginx",
"nginx.ingress.kubernetes.io/proxy-body-size": "100g"
},
tls: [
{
hosts: ["deluge.nofla.me"],
secretName: "deluge-nofla-me-tls",
}
]
}
},
plex: plex.new("plex") {
storageClass: "microk8s-hostpath",
pvc: $.data,
ingressCfg: {
host: "plex.nofla.me",
annotations: {
"cert-manager.io/cluster-issuer": "letsencrypt-production",
"kubernetes.io/ingress.class": "nginx",
"nginx.ingress.kubernetes.io/proxy-body-size": "100g"
},
tls: [
{
hosts: ["plex.nofla.me"],
secretName: "plex-nofla-me-tls",
}
]
}
},
filebrowser: filebrowser.new("filebrowser") {
storageClass: "microk8s-hostpath",
pvc: $.data,
ingressCfg: {
host: "media-files.nofla.me",
annotations: {
"cert-manager.io/cluster-issuer": "letsencrypt-production",
"kubernetes.io/ingress.class": "nginx",
"nginx.ingress.kubernetes.io/proxy-body-size": "100g"
},
tls: [
{
hosts: ["media-files.nofla.me"],
secretName: "media-files-nofla-me-tls",
}
]
}
},
}
\ No newline at end of file
local transfersh = import "apps/transfer.sh.libsonnet";
{
transfersh: transfersh.new("transfersh") {
storageClass: "microk8s-hostpath",
storageSize: "25Gi",
settings+: {
provider: "local",