Files
catalog26/README.md
2026-01-31 01:49:08 -08:00

220 lines
4.3 KiB
Markdown

# Catalog - Pricing and Availability
## SQL
## Docker
### Create a Local Docker Registry with TLS
On one of the VMs (e.g oahu.chopark.home), set up a local Docker registry.
Skip if a local registry already exists.
Prerequisite: Create a CA and a self-signed cert.
```bash
docker run -d --restart=always --name registry \
-v /opt/registry/certs:/certs \
-v /opt/registry/data:/var/lib/registry \
-e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/registry.key \
-p 443:443 \
registry:2
```
### Build a Docker Image
1. Create a `Dockerfile`. Refer to the `Dockerfile` in the root of this project.
2. Then build the image.
```powershell
# build an image
docker build -t catalog26 .
# verify the image
docker images | grep catalog26
# also try running it
docker run -d -p 5000:8080 -n catalog26 catalog26
```
3. Tag for my registry.
```powershell
docker tag catalog26 registry.chopark.home/catalog26
```
4. Push to Registry
```powershell
docker login registry.chopark.home
docker push registry.chopark.home/catalog26
```
Optional: If an https error is returned, make the following adjustments.
On Linux, edit `/etc/docker/daemon.json`:
```json
{
"insecure-registries": ["registry.chopark.home"]
}
```
```bash
sudo systemctl restart docker
```
On Windows (Docker Desktop):
- Open Docker Desktop
- Go to Settings > Docker Engine
- Add to the JSON configuration
```json
{
"insecure-registries": ["registry.chopark.home"]
}
```
## Kubernetes
1. Containerd (on all K8s nodes) for https connection problem
```toml
sudo tee /etc/containerd/certs.d/registry.chopark.home/hosts.toml <<EOF
server = "https://registry.chopark.home"
[host."https://registry.choparkhome"]
ca = "/usr/local/share/ca-certificates/regisry.chopark.home-ca.crt"
skip_verify = false
EOF
```
3. Optional Image Pull - create crictl config
```bash
# Create crictl config
sudo tee /etc/crictl.yaml > /dev/null <<EOF
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
EOF
# Test crictl
sudo crictl version
# Pull image
sudo crictl pull registry.chopark.home/catalog26
```
## Push Code to Gitea
Push code to `git.chopark.home` and get the result.
### Generate a New ssh Key
```bash
ssh-keygen -t ed2551 -C "<EMAIL>" -f ~/.ssh/id_ed25519
```
### Update ssh config
Update the config file for ssh: `~/.ssh/config`
```bash
# Append the following
Host git.chopark.home
Hostname git.chopark.home
User git
Port 2222
IdentityFile ~/.ssh/id_ed25519
```
### Push code to Gitea
Create a new repository in git.chopark.home.
From the local machine, add gitea as a remote.
```bash
git remote add gitea git@git.chopark.home:wesscho/Catalog26.git
git push -u gitea master
```
## Push a Docker Image to Gitea Container Registry
### Update your app.ini
Open the `gitea/gitea/conf/app.ini` file and look for or add the following:
```Ini, TOML
[packages]
ENABLED = true
[repository]
; This allows the 'Packages' tab to show up on your repo page
ENABLE_PACKAGES = true
```
### Configure the Max Upload Size
Docker images are huge. By default, Gitea might limit uploads to 32MB, which will cause your docker push to fail. Add or update this section:
```Ini, TOML
[attachment]
; Increase to 5GB or whatever fits your needs
MAX_SIZE = 5120
```
### Adjust Nginx Proxy Manager (NPM)
Since you are using NPM, it has its own upload limit. If you don't change this, Nginx will give you a 413 Request Entity Too Large error when you push an image.
1. Open your NPM Admin UI.
2. Edit your Gitea Proxy Host.
3. Go to the Advanced tab.
4. Paste this line into the "Custom Nginx Configuration" box:
```Nginx
client_max_body_size 5G;
```
### Restart Gitea
For the app.ini changes to take effect, restart your container:
```bash
docker compose restart server
```
### Verify and Login
```bash
docker login git.chopark.home
```
### Push an Image
If necessary, pull down the image from the `registry.chopark.home` registry.
```bash
docker pull registry.chopark.home/catalog26
```
Tag the image for the Gitea registry
```bash
docker tag registry.chopark.home/catalog26 git.chopark.home/wesscho/catalog26
```
Push it to your Gitea instance.
```bash
docker push git.chopark.home/wesscho/catalog26
```
third comment