diff --git a/README.md b/README.md index f9bc1dc..af0054b 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,24 @@ This repository contains configuration files and other assets, that are used to deploy and operate this Gitea instance. +To create a new image containing the customizations: + +Edit `packer/custom.json` to increment the tag, then run this script (needs +[Packer](https://www.packer.io/) in your path) + +``` +./script/build_customizations_image +``` + +Then edit `kubernetes/gitea-server.yaml` to use the new tag +(`image: eu.gcr.io/fluted-magpie-218106/gitea_custom:$VERSION`) and apply the +change: + +``` +cd kubernetes +kubectl apply -f gitea-server.yaml +``` + Feel free to [open issues] for questions, suggestions, bugs, to-do items, and whatever else you want to discuss or resolve. diff --git a/custom/options/label/Default b/custom/options/label/Default new file mode 100644 index 0000000..0bdfe06 --- /dev/null +++ b/custom/options/label/Default @@ -0,0 +1,11 @@ +#db231d bug ; Something is not working +#76db1d enhancement ; Improving existing functionality +#1d76db feature ; New functionality +#db1d76 idea ; Something to consider +#db1d76 question ; Looking for an answer +#fbca04 security ; All your base are belong to us +#1dd5db ui/ux ; User interface, process design, etc. +#333333 dev environment ; Config, builds, CI, deployment, etc. +#cccccc duplicate ; This issue or pull request already exists +#cccccc invalid ; Not a bug +#cccccc wontfix ; This won't be fixed diff --git a/custom/options/label/Kosmos b/custom/options/label/Kosmos new file mode 100644 index 0000000..5b29e23 --- /dev/null +++ b/custom/options/label/Kosmos @@ -0,0 +1,14 @@ +#db231d bug ; Something is not working +#76db1d enhancement ; Improving existing functionality +#1d76db feature ; New functionality +#db1d76 idea ; Something to consider +#db1d76 question ; Looking for an answer +#fbca04 security ; All your base are belong to us +#1dd5db ui/ux ; User interface, process design, etc. +#333333 dev environment ; Config, builds, CI, deployment, etc. +#008080 kredits-1 ; Small contribution +#008080 kredits-2 ; Medium contribution +#008080 kredits-3 ; Large contribution +#cccccc duplicate ; This issue or pull request already exists +#cccccc invalid ; Not a bug +#cccccc wontfix ; This won't be fixed diff --git a/kubernetes/gitea-server.yaml b/kubernetes/gitea-server.yaml index dad74cd..bc5bc86 100644 --- a/kubernetes/gitea-server.yaml +++ b/kubernetes/gitea-server.yaml @@ -14,17 +14,20 @@ spec: spec: initContainers: - name: init-config - image: busybox - command: ['sh', '-c', 'mkdir -p /data/gitea/conf && mkdir -p /data/gitea/https && cp /root/conf/app.ini /data/gitea/conf/app.ini && chown 1000:1000 /data/gitea/conf/app.ini && chmod 660 /data/gitea/conf/app.ini && cp /root/conf/*.pem /data/gitea/https && chmod 600 /data/gitea/https/*.pem && chown -R 1000:1000 /data/gitea'] + # This is a busybox image with our gitea customizations saved to + # /custom, built using ./script/build_customizations_image from the + # root of the repo + image: eu.gcr.io/fluted-magpie-218106/gitea_custom:0.1 + command: [ + 'sh', '-c', + 'mkdir -p /data/gitea/conf && mkdir -p /data/gitea/https && cp /root/conf/app.ini /data/gitea/conf/app.ini && chown 1000:1000 /data/gitea/conf/app.ini && chmod 660 /data/gitea/conf/app.ini && cp /root/conf/*.pem /data/gitea/https && chmod 600 /data/gitea/https/*.pem && cp -R /custom/* /data/gitea && chown -R 1000:1000 /data/gitea' + ] volumeMounts: - mountPath: /data name: gitea-server-data - mountPath: /root/conf name: config containers: - # This is only used for the initial setup, it does nothing once a app.ini - # file exists in the conf/ directory of the data directory - # (/data/gitea/conf in our case) - name: gitea-server image: gitea/gitea:1.7.5 ports: diff --git a/packer/custom.json b/packer/custom.json new file mode 100644 index 0000000..cbbffad --- /dev/null +++ b/packer/custom.json @@ -0,0 +1,29 @@ +{ + "builders": [{ + "type": "docker", + "image": "busybox", + "run_command": ["-d", "-i", "-t", "{{.Image}}", "/bin/sh"], + "commit": true + }], + "provisioners": [ + { + "inline": ["mkdir /custom"], + "type": "shell" + }, + { + "type": "file", + "source": "../custom/", + "destination": "/custom" + } + ], + "post-processors": [ + [ + { + "type": "docker-tag", + "repository": "eu.gcr.io/fluted-magpie-218106/gitea_custom", + "tag": "0.1" + }, + "docker-push" + ] + ] +} diff --git a/script/build_customizations_image b/script/build_customizations_image new file mode 100755 index 0000000..da61186 --- /dev/null +++ b/script/build_customizations_image @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# fail fast +set -e + +cd packer/ +packer build custom.json +cd -