This is part of my homelab. Technically this isn't fixed because I did things wrong but I'm going to write about it anyway.
## Problem
Gitea was always running but I want to be able to push things to my container registry. Why? To keep track of all the things I build. This is a great idea, but I couldn't get docker login to work. It said I needed to be using https so let's start the rabbit hole.
## Solution
So I'm just going to do a tdlr solution with commands next things explain it in detail below.
**NOTE: I'm using CASA OS**
```
openssl req -x509 -newkey rsa:4096 -keyout <name>.key -out <name>.crt -nodes -days 365 -subj "/CN=<domain>" -addext "subjectAltName = IP:<IP>, DNS:<domain>"
volume:
<data-folder>:/app/giea/ssl
env variables:
GITEA__server__PROTOCOL=https
GITEA__server__CERT_FILE=/app/gitea/ssl/<name>.crt
GITEA__server__KEY_FILE=/app/gitea/ssl/<name>.key
```
Ok so let's break this down...
first you want to create a openssl cert and self-sign it by running the following command. I don't recommend running this directly in the container. I'm writing the rest of this.
```
openssl req -x509 -newkey rsa:4096 -keyout <name>.key -out <name>.crt -nodes -days 365 -subj "/CN=<domain>" -addext "subjectAltName = IP:<IP>, DNS:<domain>"
```
After you have the files go ahead and drop the .key and .crt file to you your shared folder. I used a separate `ssl` folder because the `data` folder looked pretty sacred. Didn't want to mess that up.
Lastly you want to go to the settings for your container and add a volume for the new new ssl folder. You also want to add environment variables so that the ini file updates properly. Use the items below for this last step.
```
volume:
<data-folder>:/app/giea/ssl
env variables:
GITEA__server__PROTOCOL=https
GITEA__server__CERT_FILE=/app/gitea/ssl/<name>.crt
GITEA__server__KEY_FILE=/app/gitea/ssl/<name>.key
```
Once you hit save the container will restart. Now you can do `docker login <ip>:port`. Enjoy pushing your containers to your nicely backup registry. (please tell me you have a backup)