Compare commits

..

2 Commits

7 changed files with 59 additions and 15 deletions

View File

@ -3,3 +3,47 @@
Front end for Git, with integrated Container Registry and CI/CD capabilities. Front end for Git, with integrated Container Registry and CI/CD capabilities.
This repository only contains configuration used for Kubernetes. This repository only contains configuration used for Kubernetes.
## From Docker to Gitea
Get a dump of your current Docker instance:
```bash
gitea dump -c /data/gitea/conf/app.ini
```
In this context, my `/data` path is mounted to the host.
Then modify the `deployment.yaml` file to only start a "sleeping" container:
```yaml
[...]
image: gitea/gitea:1.22.3
ports:
- containerPort: 3000
command: ["/bin/sh", "-c", "sleep 1000000000"] # Add this line
env:
- name: GITEA__database__DB_TYPE
value: "postgres"
[...]
```
Then, copy the dump to the container:
```bash
kubectl cp <dump file> <namespace>/<pod name>:/data/dump
```
Get into the pod and go as follows.
Unzip the dump
```bash
unzip <dump file>
```
Then, restore the dump
```bash
mv repo/* /data/git/repositories
mv lfs/* /data/git/lfs
mv data/* /data/gitea
```
And finally, restore the database
```bash
PGPASSWORD=$GITEA__database_PASSWD psql -h $GITEA__database_HOST -U $GITEA__database_USER < gitea-db.sql
```

View File

@ -4,13 +4,15 @@ metadata:
name: gitea-config name: gitea-config
namespace: gitea namespace: gitea
data: data:
APP_NAME: Halia hosted git solution APP_NAME: Halis hosted git solution
RUN_MODE: prod RUN_MODE: prod
GITEA__server__DISABLE_SSH: "true" GITEA__server__DISABLE_SSH: "true"
GITEA__server__ROOT_URL: "https://git.beta.halia.dev" GITEA__server__ROOT_URL: "https://git.halis.io"
GITEA__security__INSTALL_LOCK: "true" GITEA__security__INSTALL_LOCK: "true"
GITEA__service__DISABLE_REGISTRATION: "true" GITEA__service__DISABLE_REGISTRATION: "true"
GITEA__metrics__ENABLED: "true" GITEA__metrics__ENABLED: "true"
GITEA__queue__TYPE: "level"
#GITEA__indexer__REPO_INDEXER_ENABLED: "false"
#app.ini: | #app.ini: |
# APP_NAME = K8s implementation # APP_NAME = K8s implementation
# RUN_MODE = prod # RUN_MODE = prod

View File

@ -9,7 +9,7 @@ spec:
storage: storage:
size: 1Gi size: 1Gi
storageClass: flat-storage-class storageClass: redundant-storage-class
bootstrap: bootstrap:
initdb: initdb:

View File

@ -4,7 +4,7 @@ metadata:
name: gitea name: gitea
namespace: gitea namespace: gitea
spec: spec:
replicas: 2 replicas: 1
selector: selector:
matchLabels: matchLabels:
app: gitea app: gitea
@ -17,13 +17,9 @@ spec:
subdomain: gitea subdomain: gitea
containers: containers:
- name: gitea - name: gitea
image: gitea/gitea:1.19.3 image: gitea/gitea:1.22.3
ports: ports:
- containerPort: 3000 - containerPort: 3000
lifecycle:
postStart:
exec:
command: ["sh", "-c", "sleep 1 && su git -c 'sh /admin-creator.sh'"]
env: env:
- name: GITEA__database__DB_TYPE - name: GITEA__database__DB_TYPE
value: "postgres" value: "postgres"

View File

@ -20,10 +20,12 @@ spec:
entryPoints: entryPoints:
- websecure - websecure
routes: routes:
- match: Host(`git.beta.halia.dev`) && PathPrefix(`/`) - match: Host(`git.halis.io`) && PathPrefix(`/`)
kind: Rule kind: Rule
middlewares: middlewares:
- name: replace-regex - name: replace-regex
services: services:
- name: gitea-svc - name: gitea-svc
port: 80 port: 80
tls:
certResolver: letsencrypt

View File

@ -5,8 +5,8 @@ metadata:
namespace: gitea namespace: gitea
spec: spec:
accessModes: accessModes:
- ReadWriteOnce - ReadWriteMany
resources: resources:
requests: requests:
storage: 5Gi storage: 15Gi
storageClassName: flat-storage-class storageClassName: redundant-storage-class

View File

@ -8,8 +8,8 @@ metadata:
spec: spec:
project: default project: default
source: source:
repoURL: https://git.halis.io/athens-school/k3s-secrets.git repoURL: https://git.halia.dev/athens-school/k3s-secrets.git
targetRevision: dev targetRevision: prod-migration
path: gitea path: gitea
syncPolicy: syncPolicy:
automated: automated: