Compare commits
41 Commits
0a60d8831c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 91755e8744 | |||
| ee6ec82157 | |||
| fa11c50687 | |||
| 21e158737d | |||
| 515b4a4483 | |||
| a3c1b2d1f7 | |||
| 2ab0db6c2a | |||
| d6d70af0ad | |||
| 75881c4c3f | |||
| 3cd4b3102c | |||
| 11ae884dea | |||
| 6785287227 | |||
| d4784e9787 | |||
| da278556ed | |||
| 4dd0f4b844 | |||
| b6894598a6 | |||
| 972bbedb87 | |||
| db396d6ee1 | |||
| d821e02dec | |||
| 2f02ddb79d | |||
|
|
90cb219d79 | ||
|
|
9c36ebeb14 | ||
|
|
5f3b80ab9e | ||
| b00931352f | |||
|
|
f8d964f8d2 | ||
| 810482c755 | |||
|
|
4e225ab1af | ||
| 1f6e0b7d57 | |||
|
|
a3fa72bb56 | ||
|
|
9f4a5b452c | ||
| 12fc74d8ff | |||
|
|
1d69fad451 | ||
|
|
f73c58d7ee | ||
|
|
68771a8e61 | ||
|
|
e3de3af82f | ||
| 490248909b | |||
|
|
e0741b4438 | ||
|
|
8050126d2d | ||
|
|
b5bbc5fa34 | ||
| 915fd7db8a | |||
|
|
bbfa3f2964 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
|||||||
/kubernetes/custom/config/
|
/kubernetes/config/
|
||||||
|
|||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "vendor/ark"]
|
|
||||||
path = vendor/ark
|
|
||||||
url = git@github.com:heptio/ark.git
|
|
||||||
10
README.md
10
README.md
@@ -1,9 +1,9 @@
|
|||||||
# gitea.kosmos.org
|
# gitea.kosmos.org
|
||||||
|
|
||||||
This repository contains configuration files and other assets, that are used to
|
This repository contains configuration files and other assets, that are used to
|
||||||
deploy and operate this Gitea instance.
|
deploy and operate this Gitea instance. Feel free to [open
|
||||||
|
issues](https://gitea.kosmos.org/kosmos/gitea.kosmos.org/issues) for questions,
|
||||||
|
suggestions, bugs, to-do items, and whatever else you want to discuss or
|
||||||
|
resolve.
|
||||||
|
|
||||||
Feel free to [open issues] for questions, suggestions, bugs, to-do items, and
|
See `doc/` folder for some technical info.
|
||||||
whatever else you want to discuss or resolve.
|
|
||||||
|
|
||||||
[open issues]: https://gitea.kosmos.org/kosmos/gitea.kosmos.org/issues
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#db231d bug ; Something is not working
|
#db231d bug ; Something is not working
|
||||||
|
#ead746 docs ; Documentation
|
||||||
#76db1d enhancement ; Improving existing functionality
|
#76db1d enhancement ; Improving existing functionality
|
||||||
#1d76db feature ; New functionality
|
#1d76db feature ; New functionality
|
||||||
#db1d76 idea ; Something to consider
|
#db1d76 idea ; Something to consider
|
||||||
@@ -1,36 +1,28 @@
|
|||||||
# Backups
|
# Backups
|
||||||
|
|
||||||
We're using [Ark][1] for backing up Kubernetes config and GKE resources. It is
|
We're using [Velero][1] (formerly Ark) for backing up Kubernetes config and GKE
|
||||||
available as a Git submodule in the `vendor/` folder (incl. the `ark`
|
resources. It is available as a compiled binary for your platform [on GitHub][2]
|
||||||
executable).
|
|
||||||
|
|
||||||
In order to initialize and update submodules in your local repo, run once:
|
The Velero service is running on the Sidamo cluster and was set up using the
|
||||||
|
[official docs' GCP instructions][3]. There's a daily backup
|
||||||
git submodule update --init
|
|
||||||
|
|
||||||
Then, to fetch/update the modules, run:
|
|
||||||
|
|
||||||
git submodule update
|
|
||||||
|
|
||||||
The Ark service is running on the Sidamo cluster and was set up using the
|
|
||||||
[official docs' GCP instructions and config files][4]. There's a daily backup
|
|
||||||
schedule in effect for Gitea (using the label `app=gitea`).
|
schedule in effect for Gitea (using the label `app=gitea`).
|
||||||
|
|
||||||
Please refer to Ark's [ Getting Started ][5] doc for all backup and restore
|
Please refer to Velero's [ Getting Started ][4] doc for all backup and restore
|
||||||
commands.
|
commands.
|
||||||
|
|
||||||
## Backup location
|
## Backup location
|
||||||
|
|
||||||
Cluster configuration (including all live resources) is backed up to [a Google
|
Cluster configuration (including all live resources) is backed up to [a Google
|
||||||
Cloud Storage container][3].
|
Cloud Storage container][5].
|
||||||
|
|
||||||
## Persistent volumes
|
## Persistent volumes
|
||||||
|
|
||||||
Persistent volumes are just GCE disks. Thus, with the current config, Ark
|
Persistent volumes are just GCE disks. Thus, with the current config, Velero
|
||||||
creates volume snapshots as native [GCE disk snapshots][2].
|
creates volume snapshots as native [GCE disk snapshots][6].
|
||||||
|
|
||||||
[1]: https://heptio.github.io/ark/v0.10.0
|
[1]: https://velero.io/docs/v1.0.0
|
||||||
[2]: https://console.cloud.google.com/compute/snapshots?organizationId=772167872692&project=fluted-magpie-218106&tab=snapshots&snapshotssize=50
|
[2]: https://github.com/heptio/velero/releases/tag/v1.0.0
|
||||||
[3]: https://console.cloud.google.com/storage/browser/sidamo-backups?project=fluted-magpie-218106&organizationId=772167872692
|
[3]: https://velero.io/docs/v1.0.0/gcp-config/
|
||||||
[4]: https://heptio.github.io/ark/v0.10.0/gcp-config
|
[4]: https://velero.io/docs/v1.0.0/about/
|
||||||
[5]: https://heptio.github.io/ark/v0.10.0/get-started
|
[5]: https://console.cloud.google.com/storage/browser/sidamo-backups-new?project=fluted-magpie-218106&organizationId=772167872692
|
||||||
|
[6]: https://console.cloud.google.com/compute/snapshots?organizationId=772167872692&project=fluted-magpie-218106&tab=snapshots&snapshotssize=50
|
||||||
|
|||||||
20
doc/customizations-image.md
Normal file
20
doc/customizations-image.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
## Customizations image
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
To create a new Docker image containing our Gitea customizations (label sets,
|
||||||
|
styles, page content, etc.):
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
### Deploy
|
||||||
|
|
||||||
|
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
|
||||||
@@ -32,13 +32,19 @@ spec:
|
|||||||
value: gitea
|
value: gitea
|
||||||
image: mariadb:10.3.10
|
image: mariadb:10.3.10
|
||||||
name: gitea-db
|
name: gitea-db
|
||||||
resources: {}
|
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3306
|
- containerPort: 3306
|
||||||
name: mysql
|
name: mysql
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /var/lib/mysql
|
- mountPath: /var/lib/mysql
|
||||||
name: gitea-db-data
|
name: gitea-db-data
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 150Mi
|
||||||
|
limits:
|
||||||
|
cpu: 500m
|
||||||
|
memory: 300Mi
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
volumes:
|
volumes:
|
||||||
- name: gitea-db-data
|
- name: gitea-db-data
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: gitea-server
|
name: gitea-server
|
||||||
@@ -6,6 +6,9 @@ metadata:
|
|||||||
app: gitea
|
app: gitea
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: gitea
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@@ -14,24 +17,22 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
initContainers:
|
initContainers:
|
||||||
- name: init-config
|
- name: init-config
|
||||||
image: busybox
|
# 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.2
|
||||||
command: [
|
command: [
|
||||||
'sh', '-c',
|
'sh', '-c',
|
||||||
'mkdir -p /data/gitea/conf && mkdir -p /data/gitea/https && mkdir -p /data/gitea/options/label && 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 /root/options/label/* /data/gitea/options/label/ && chown -R 1000:1000 /data/gitea'
|
'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:
|
volumeMounts:
|
||||||
- mountPath: /data
|
- mountPath: /data
|
||||||
name: gitea-server-data
|
name: gitea-server-data
|
||||||
- mountPath: /root/conf
|
- mountPath: /root/conf
|
||||||
name: config
|
name: config
|
||||||
# The labels have been created as a ConfigMap from local files using this command:
|
|
||||||
#
|
|
||||||
# kubectl create configmap gitea-options-label --from-file=custom/options/label/
|
|
||||||
- mountPath: /root/options/label
|
|
||||||
name: label
|
|
||||||
containers:
|
containers:
|
||||||
- name: gitea-server
|
- name: gitea-server
|
||||||
image: gitea/gitea:1.7.2
|
image: gitea/gitea:1.11.2
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
- containerPort: 3001
|
- containerPort: 3001
|
||||||
@@ -39,6 +40,13 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /data
|
- mountPath: /data
|
||||||
name: gitea-server-data
|
name: gitea-server-data
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 150m
|
||||||
|
memory: 256Mi
|
||||||
|
limits:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 512Mi
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
volumes:
|
volumes:
|
||||||
- name: gitea-server-data
|
- name: gitea-server-data
|
||||||
@@ -57,9 +65,6 @@ spec:
|
|||||||
- key: key.pem
|
- key: key.pem
|
||||||
path: key.pem
|
path: key.pem
|
||||||
mode: 256
|
mode: 256
|
||||||
- name: label
|
|
||||||
configMap:
|
|
||||||
name: gitea-options-label
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
|
|||||||
29
packer/custom.json
Normal file
29
packer/custom.json
Normal file
@@ -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.2"
|
||||||
|
},
|
||||||
|
"docker-push"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
7
script/build_customizations_image
Executable file
7
script/build_customizations_image
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# fail fast
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd packer/
|
||||||
|
packer build custom.json
|
||||||
|
cd -
|
||||||
@@ -7,7 +7,7 @@ secret = `kubectl get secret gitea-config -o yaml`
|
|||||||
yaml = YAML.load(secret)
|
yaml = YAML.load(secret)
|
||||||
|
|
||||||
yaml['data'].each do |key, data|
|
yaml['data'].each do |key, data|
|
||||||
filename = File.join('kubernetes', 'custom', 'config', key)
|
filename = File.join('kubernetes', 'config', key)
|
||||||
File.open(filename, "w+") do |f|
|
File.open(filename, "w+") do |f|
|
||||||
puts "Writing #{filename}"
|
puts "Writing #{filename}"
|
||||||
f.write Base64.decode64(data)
|
f.write Base64.decode64(data)
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Delete the gitea-config secrets
|
# Delete the gitea-config secrets
|
||||||
kubectl delete secret gitea-config
|
kubectl delete secret gitea-config
|
||||||
# Replace it from the local files in kubernetes/custom/config/* (acquired by running
|
# Replace it from the local files in kubernetes/config/* (acquired by running
|
||||||
# ./script/get_secrets)
|
# ./script/get_secrets)
|
||||||
kubectl create secret generic gitea-config --from-file=cert.pem=kubernetes/custom/config/cert.pem --from-file=key.pem=kubernetes/custom/config/key.pem --from-file=app.ini=kubernetes/custom/config/app.ini
|
kubectl create secret generic gitea-config --from-file=cert.pem=kubernetes/config/cert.pem --from-file=key.pem=kubernetes/config/key.pem --from-file=app.ini=kubernetes/config/app.ini
|
||||||
# Force the pod to restart by patching the deployment resource
|
# Force the pod to restart by patching the deployment resource
|
||||||
kubectl patch deployment gitea-server -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"
|
kubectl patch deployment gitea-server -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"`date +'%s'`\"}}}}}"
|
||||||
|
|||||||
1
vendor/ark
vendored
1
vendor/ark
vendored
Submodule vendor/ark deleted from 0fd7872ef4
Reference in New Issue
Block a user