# Gitea

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-db-rw.gitea.svc.cluster.local -U $GITEA__database__USER < halis_gitea.sql
```