feat: Upgrade configuration for production

This commit is contained in:
Tanguy Herbron 2024-11-11 13:45:31 +01:00
parent fc49a6f412
commit 3525387799
7 changed files with 57 additions and 15 deletions

View File

@ -3,3 +3,47 @@
Front end for Git, with integrated Container Registry and CI/CD capabilities.
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
namespace: gitea
data:
APP_NAME: Halia hosted git solution
APP_NAME: Halis hosted git solution
RUN_MODE: prod
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__service__DISABLE_REGISTRATION: "true"
GITEA__metrics__ENABLED: "true"
GITEA__queue__TYPE: "level"
#GITEA__indexer__REPO_INDEXER_ENABLED: "false"
#app.ini: |
# APP_NAME = K8s implementation
# RUN_MODE = prod

View File

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

View File

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

View File

@ -20,7 +20,7 @@ spec:
entryPoints:
- websecure
routes:
- match: Host(`git.beta.halia.dev`) && PathPrefix(`/`)
- match: Host(`git.halis.io`) && PathPrefix(`/`)
kind: Rule
middlewares:
- name: replace-regex

View File

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

View File

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