No description
Find a file
erik 1514a6d822 Implement resource requests and limits
Possibility to set requests and limits for build jobs.
Otherwise a (sensible) default will be used.
2022-11-29 14:05:36 +01:00
doc Update scripts in docker image 2022-11-11 13:27:28 +01:00
infrastructure/c4k-website-build Bugfixes 2022-11-11 16:00:47 +01:00
public Project skeleton 2022-09-08 15:04:17 +02:00
src Implement resource requests and limits 2022-11-29 14:05:36 +01:00
.gitignore Add init-container 2022-11-23 10:14:46 +00:00
.gitlab-ci.yml Add init-container 2022-11-23 10:14:46 +00:00
LICENSE Project skeleton 2022-09-08 15:04:17 +02:00
package.json version bump 2022-11-18 13:34:08 +01:00
project.clj version bump 2022-11-18 13:36:32 +01:00
README.md [Skip-CI] Update Readme 2022-11-23 12:06:43 +01:00
shadow-cljs.edn Bump c4k-common version to v3.1.1 2022-11-18 12:50:31 +01:00
valid-auth.edn Simplify spec 2022-10-14 13:41:21 +02:00
valid-config.edn Update path handling in docker image 2022-11-11 14:01:08 +01:00

convention 4 kubernetes: c4k-website

Clojars Project pipeline status

DeltaChat chat over e-mail | team@social.meissa-gmbh.de team@social.meissa-gmbh.de | Website & Blog

Purpose

Delivering cryogen generated static sites with the push of a few buttons.

c4k-website generates configuration files for multiple nginx webservers, and corresponding cryogen static site generator build containers. This automatically downloads a <branch>.zip from a specified gitea API url. You need an authorization token to access the specified gitea user account. The build container is based on clojure:lein.

Following the example in valid-config.edn and valid-auth.edn you can add as many websites as you like (provided you have the DNS Routes set up). One set of configmaps, deployment, services etc will be created for each element in the :websites and :auth list.

Configs generated by c4k-website consists of the following parts:

  • nginx deployment + configmap + service + ingress + certificate definitions
  • nginx deployment has init container, building the website at startup time
  • cron job for building and build secret for storing auth data
  • respective volume claims

Try out

Click on the image to try out in your browser:

Try it out

Your input will stay in your browser. No server interaction is required.

Usage

You need:

  • DNS routes matching the fqdns in the lists
  • cryogen as a static site generator
  • a cryogen project ready to build
  • a gitea account which holds the buildable project
  • an authorization token for that account
  • and a kubernetes cluster provisioned by provs

Add a unique identifier for each website to config.edn and auth.edn (e.g. domain-name).
Add the list of fqdns, your gitea host, name of the website repo and the respective branch name (usually "main") to config.edn.
Add auth token and gitea user with access to the website repo to auth.edn.
Let c4k-website generate your .yaml file.
Apply this file on your cluster with kubectl apply -f yourApp.yaml.
Done.

Script Execution

Optionally you can specify a trusted script in your config.edn.

  1. sha256sum "/path/to/your/script/file"
  2. copy the output of this command
  3. add the :sha256-output "hash-of-file file.name" :key value pair to the respective collection in :websites.

Also, see the example in valid-config.edn. The script file needs to exist in the <branch>.zip and path specification to the script file should be relative to the root of the unzipped folder. Scripts can be of any type - as long as an according shebang exists in the first line.

sha256sum your-script-file #  use output of this call
sha256sum scripts/your-script-file #  or this
sha256sum scripts/foo/bar/your-script-file #  or this

License

Copyright © 2022 meissa GmbH Licensed under the Apache License, Version 2.0 (the "License") Pls. find licenses of our subcomponents here