eslopemap / eslope

Enhanced slope overlays for the alps
Creative Commons Zero v1.0 Universal
3 stars 0 forks source link

VPS infra for tile hosting and elevation API #10

Open eddy-geek opened 1 year ago

eddy-geek commented 1 year ago

2 topics but basically mostly caddy and go-pmtiles at first:

eddy-geek commented 1 year ago

Resources

Caddy on docker

(comparisons with Traefik/nginx/... tends to be infavour of Caddy for certif handling)

Docker compose on VPS

With Github actions:

With Podman :

Actual setup

I chose podman + docker compose

# first part from the oracle tuto
sudo dnf install container-tools  # get podman v4.2.0 (not 4.3) and podman-docker
sudo curl -SL https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-$(uname -i) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo systemctl enable --now podman.socket
sudo systemctl status podman.socket

Before the more advanced examples, a simple file_server using external files should look like this for Caddyfile and docker-compose.yml

file_server /data/*
services:
    caddy:
        image: caddy:2
        container_name: caddy
        restart: unless-stopped
        ports:
            - 80:80
            - 443:443
        volumes:
            - ./Caddyfile:/etc/caddy/Caddyfile
            - srv:/srv
         user: "1000"

volumes:
    srv:

networks:
    default:
        name: caddy-net

With these 2 files in the current directory, run

sudo /usr/local/bin/docker-compose up -d -u $UID

It failed fro me despite additional user trick to allow read to Caddyfile as per podman#8057 / How to set user and group in Docker Compose - g-dem's blog)

So I went back to the no-docker solution

sudo dnf copr enable @caddy/caddy
sudo dnf install caddy
sudo mkdir -p /etc/caddy ; sudo cp Caddyfile /etc/caddy/
sudo systemctl enable caddy
sudo systemctl start caddy

but then I hit caddy#4058 about configuring certificates and got stuck.

eddy-geek commented 1 year ago

echo 'caddy ALL=(ALL) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/92-caddy