Back Original

Hosted Go Urls

#780—

I recently read Don't couple your Go code to GitHub. I still like Github, and think the GitHub hate for its instability is overblown. Like not being able to code for a few hours is really not that big of deal.

But! I think it's still a good point to allow for migrations off of GitHub. So, I am moving all of my Golang packages to go.icco.me. If you're using my packages, nothing will change, but I'll start recommending in code to use the domain.

If you previously read my Homelab 2024 post about how I use the caddy2 docker compose plugin, I am still using it! Here is how I am deploying this with docker annotations instead of nginx.

  go-vanity:
    container_name: go-vanity
    logging:
      driver: journald
    image: alpine:latest
    restart: unless-stopped
    command:
      - sleep
      - infinity
    networks:
      - caddy
    labels:
      prometheus.io/scrape: false
      caddy: go.icco.me
      caddy.@goget.query: go-get=1
      caddy.@goget.path_regexp: repo ^/([A-Za-z0-9._-]+)
      caddy.@repo.not.query: go-get=1
      caddy.@repo.path_regexp: repo ^/([A-Za-z0-9._-]+)
      caddy.handle_0: '@goget'
      caddy.handle_0.header: Content-Type "text/html; charset=utf-8"
      caddy.handle_0.respond: '`<!doctype html><meta name="go-import" content="go.icco.me/{re.repo.1} git https://github.com/icco/{re.repo.1}">` 200'
      caddy.handle_1: '@repo'
      caddy.handle_1.redir: https://github.com/icco/{re.repo.1}
      caddy.handle_2.redir: https://github.com/icco
      caddy.log:

Hope you find this useful!

/Nat