feat(config): add gordon_domain as preferred alias for registry_domain
- Add gordon_domain config option that takes precedence over registry_domain - registry_domain remains supported for backwards compatibility - Update docs to use gordon_domain in all examples - Clarify that this domain serves both registry and admin API
- commit
- 9a1176c8807faae05522fabccb8949ca59b2af52
- author
- bnema · · 2026-01-16 21:27 UTC
- parent
- ee1db19
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +40 -14
M docs/cli/commands.md +4 -2
| @@ -55,10 +55,12 @@ gordon auth internal | |||
| 55 | 55 | ||
| 56 | 56 | ### Remote Targeting | |
| 57 | 57 | ||
| 58 | - | The CLI can target remote Gordon instances using the `--remote` flag or `GORDON_REMOTE` environment variable: | |
| 58 | + | The CLI can target remote Gordon instances using the `--remote` flag or `GORDON_REMOTE` environment variable. | |
| 59 | + | ||
| 60 | + | **Important:** The remote URL must be the `gordon_domain` configured on the remote Gordon instance. This is the domain that serves both the container registry and the Admin API. | |
| 59 | 61 | ||
| 60 | 62 | ```bash | |
| 61 | - | # Using flags | |
| 63 | + | # Using flags (use the gordon_domain from remote Gordon config) | |
| 62 | 64 | gordon routes list --remote https://gordon.mydomain.com --token $TOKEN | |
| 63 | 65 | ||
| 64 | 66 | # Using environment variables | |
| @@ -55,10 +55,12 @@ gordon auth internal | |||||
| 55 | 55 | ||||
| 56 | ### Remote Targeting | 56 | ### Remote Targeting | ||
| 57 | 57 | ||||
| 58 | - | The CLI can target remote Gordon instances using the `--remote` flag or `GORDON_REMOTE` environment variable: | 58 | + | The CLI can target remote Gordon instances using the `--remote` flag or `GORDON_REMOTE` environment variable. |
| 59 | + | ||||
| 60 | + | **Important:** The remote URL must be the `gordon_domain` configured on the remote Gordon instance. This is the domain that serves both the container registry and the Admin API. | |||
| 59 | 61 | ||||
| 60 | ```bash | 62 | ```bash | ||
| 61 | - | # Using flags | 63 | + | # Using flags (use the gordon_domain from remote Gordon config) |
| 62 | gordon routes list --remote https://gordon.mydomain.com --token $TOKEN | 64 | gordon routes list --remote https://gordon.mydomain.com --token $TOKEN | ||
| 63 | 65 | ||||
| 64 | # Using environment variables | 66 | # Using environment variables | ||
M docs/config/server.md +17 -11
| @@ -8,7 +8,7 @@ Core server settings for Gordon. | |||
| 8 | 8 | [server] | |
| 9 | 9 | port = 8080 # HTTP proxy port | |
| 10 | 10 | registry_port = 5000 # Container registry port | |
| 11 | - | registry_domain = "registry.mydomain.com" # Registry domain (required) | |
| 11 | + | gordon_domain = "gordon.mydomain.com" # Gordon domain (required) | |
| 12 | 12 | # data_dir = "~/.gordon" # Data storage directory (default) | |
| 13 | 13 | ``` | |
| 14 | 14 | ||
| @@ -18,7 +18,8 @@ registry_domain = "registry.mydomain.com" # Registry domain (required) | |||
| 18 | 18 | |--------|------|---------|-------------| | |
| 19 | 19 | | `port` | int | `80` | HTTP proxy port for routing traffic to containers | | |
| 20 | 20 | | `registry_port` | int | `5000` | Docker registry port for image push/pull | | |
| 21 | - | | `registry_domain` | string | **required** | Domain for the container registry | | |
| 21 | + | | `gordon_domain` | string | **required** | Domain for Gordon (registry + admin API) | | |
| 22 | + | | `registry_domain` | string | - | Deprecated alias for `gordon_domain` | | |
| 22 | 23 | | `data_dir` | string | `~/.gordon` | Directory for registry data, logs, and env files | | |
| 23 | 24 | ||
| 24 | 25 | ## Port Configuration | |
| @@ -54,19 +55,24 @@ Docker/Podman clients push to this port: | |||
| 54 | 55 | docker push registry.mydomain.com:5000/myapp:latest | |
| 55 | 56 | ``` | |
| 56 | 57 | ||
| 57 | - | ## Registry Domain | |
| 58 | + | ## Gordon Domain | |
| 58 | 59 | ||
| 59 | - | The `registry_domain` is required and must match your DNS configuration: | |
| 60 | + | The `gordon_domain` is required and must match your DNS configuration: | |
| 60 | 61 | ||
| 61 | 62 | ```toml | |
| 62 | 63 | [server] | |
| 63 | - | registry_domain = "registry.mydomain.com" | |
| 64 | + | gordon_domain = "gordon.mydomain.com" | |
| 64 | 65 | ``` | |
| 65 | 66 | ||
| 66 | 67 | This domain is used for: | |
| 67 | - | - Docker login authentication | |
| 68 | - | - Image push/pull operations | |
| 69 | - | - Internal registry references | |
| 68 | + | - Docker login and image push/pull operations | |
| 69 | + | - Admin API access (`/admin/*` endpoints) | |
| 70 | + | - CLI remote targeting (`gordon routes --remote https://gordon.mydomain.com`) | |
| 71 | + | - Token endpoint for authentication (`/v2/token`) | |
| 72 | + | ||
| 73 | + | When requests arrive on the proxy port with this domain as the Host header, Gordon routes them to the backend services (registry and admin API). | |
| 74 | + | ||
| 75 | + | > **Note:** `registry_domain` is supported as a deprecated alias for backwards compatibility. | |
| 70 | 76 | ||
| 71 | 77 | ## Data Directory | |
| 72 | 78 | ||
| @@ -108,7 +114,7 @@ Gordon creates directories with secure permissions: | |||
| 108 | 114 | [server] | |
| 109 | 115 | port = 8080 | |
| 110 | 116 | registry_port = 5000 | |
| 111 | - | registry_domain = "registry.local" | |
| 117 | + | gordon_domain = "gordon.local" | |
| 112 | 118 | data_dir = "./dev-data" | |
| 113 | 119 | ``` | |
| 114 | 120 | ||
| @@ -118,7 +124,7 @@ data_dir = "./dev-data" | |||
| 118 | 124 | [server] | |
| 119 | 125 | port = 8080 | |
| 120 | 126 | registry_port = 5000 | |
| 121 | - | registry_domain = "registry.company.com" | |
| 127 | + | gordon_domain = "gordon.company.com" | |
| 122 | 128 | data_dir = "/var/lib/gordon" | |
| 123 | 129 | ``` | |
| 124 | 130 | ||
| @@ -128,7 +134,7 @@ data_dir = "/var/lib/gordon" | |||
| 128 | 134 | [server] | |
| 129 | 135 | port = 8080 # High port for rootless | |
| 130 | 136 | registry_port = 5000 | |
| 131 | - | registry_domain = "registry.mydomain.com" | |
| 137 | + | gordon_domain = "gordon.mydomain.com" | |
| 132 | 138 | ``` | |
| 133 | 139 | ||
| 134 | 140 | With firewall port forwarding: | |
| @@ -8,7 +8,7 @@ Core server settings for Gordon. | |||||
| 8 | [server] | 8 | [server] | ||
| 9 | port = 8080 # HTTP proxy port | 9 | port = 8080 # HTTP proxy port | ||
| 10 | registry_port = 5000 # Container registry port | 10 | registry_port = 5000 # Container registry port | ||
| 11 | - | registry_domain = "registry.mydomain.com" # Registry domain (required) | 11 | + | gordon_domain = "gordon.mydomain.com" # Gordon domain (required) |
| 12 | # data_dir = "~/.gordon" # Data storage directory (default) | 12 | # data_dir = "~/.gordon" # Data storage directory (default) | ||
| 13 | ``` | 13 | ``` | ||
| 14 | 14 | ||||
| @@ -18,7 +18,8 @@ registry_domain = "registry.mydomain.com" # Registry domain (required) | |||||
| 18 | |--------|------|---------|-------------| | 18 | |--------|------|---------|-------------| | ||
| 19 | | `port` | int | `80` | HTTP proxy port for routing traffic to containers | | 19 | | `port` | int | `80` | HTTP proxy port for routing traffic to containers | | ||
| 20 | | `registry_port` | int | `5000` | Docker registry port for image push/pull | | 20 | | `registry_port` | int | `5000` | Docker registry port for image push/pull | | ||
| 21 | - | | `registry_domain` | string | **required** | Domain for the container registry | | 21 | + | | `gordon_domain` | string | **required** | Domain for Gordon (registry + admin API) | |
| 22 | + | | `registry_domain` | string | - | Deprecated alias for `gordon_domain` | | |||
| 22 | | `data_dir` | string | `~/.gordon` | Directory for registry data, logs, and env files | | 23 | | `data_dir` | string | `~/.gordon` | Directory for registry data, logs, and env files | | ||
| 23 | 24 | ||||
| 24 | ## Port Configuration | 25 | ## Port Configuration | ||
| @@ -54,19 +55,24 @@ Docker/Podman clients push to this port: | |||||
| 54 | docker push registry.mydomain.com:5000/myapp:latest | 55 | docker push registry.mydomain.com:5000/myapp:latest | ||
| 55 | ``` | 56 | ``` | ||
| 56 | 57 | ||||
| 57 | - | ## Registry Domain | 58 | + | ## Gordon Domain |
| 58 | 59 | ||||
| 59 | - | The `registry_domain` is required and must match your DNS configuration: | 60 | + | The `gordon_domain` is required and must match your DNS configuration: |
| 60 | 61 | ||||
| 61 | ```toml | 62 | ```toml | ||
| 62 | [server] | 63 | [server] | ||
| 63 | - | registry_domain = "registry.mydomain.com" | 64 | + | gordon_domain = "gordon.mydomain.com" |
| 64 | ``` | 65 | ``` | ||
| 65 | 66 | ||||
| 66 | This domain is used for: | 67 | This domain is used for: | ||
| 67 | - | - Docker login authentication | 68 | + | - Docker login and image push/pull operations |
| 68 | - | - Image push/pull operations | 69 | + | - Admin API access (`/admin/*` endpoints) |
| 69 | - | - Internal registry references | 70 | + | - CLI remote targeting (`gordon routes --remote https://gordon.mydomain.com`) |
| 71 | + | - Token endpoint for authentication (`/v2/token`) | |||
| 72 | + | ||||
| 73 | + | When requests arrive on the proxy port with this domain as the Host header, Gordon routes them to the backend services (registry and admin API). | |||
| 74 | + | ||||
| 75 | + | > **Note:** `registry_domain` is supported as a deprecated alias for backwards compatibility. | |||
| 70 | 76 | ||||
| 71 | ## Data Directory | 77 | ## Data Directory | ||
| 72 | 78 | ||||
| @@ -108,7 +114,7 @@ Gordon creates directories with secure permissions: | |||||
| 108 | [server] | 114 | [server] | ||
| 109 | port = 8080 | 115 | port = 8080 | ||
| 110 | registry_port = 5000 | 116 | registry_port = 5000 | ||
| 111 | - | registry_domain = "registry.local" | 117 | + | gordon_domain = "gordon.local" |
| 112 | data_dir = "./dev-data" | 118 | data_dir = "./dev-data" | ||
| 113 | ``` | 119 | ``` | ||
| 114 | 120 | ||||
| @@ -118,7 +124,7 @@ data_dir = "./dev-data" | |||||
| 118 | [server] | 124 | [server] | ||
| 119 | port = 8080 | 125 | port = 8080 | ||
| 120 | registry_port = 5000 | 126 | registry_port = 5000 | ||
| 121 | - | registry_domain = "registry.company.com" | 127 | + | gordon_domain = "gordon.company.com" |
| 122 | data_dir = "/var/lib/gordon" | 128 | data_dir = "/var/lib/gordon" | ||
| 123 | ``` | 129 | ``` | ||
| 124 | 130 | ||||
| @@ -128,7 +134,7 @@ data_dir = "/var/lib/gordon" | |||||
| 128 | [server] | 134 | [server] | ||
| 129 | port = 8080 # High port for rootless | 135 | port = 8080 # High port for rootless | ||
| 130 | registry_port = 5000 | 136 | registry_port = 5000 | ||
| 131 | - | registry_domain = "registry.mydomain.com" | 137 | + | gordon_domain = "gordon.mydomain.com" |
| 132 | ``` | 138 | ``` | ||
| 133 | 139 | ||||
| 134 | With firewall port forwarding: | 140 | With firewall port forwarding: | ||
M internal/app/run.go +7 -1
| @@ -52,7 +52,8 @@ type Config struct { | |||
| 52 | 52 | Server struct { | |
| 53 | 53 | Port int `mapstructure:"port"` | |
| 54 | 54 | RegistryPort int `mapstructure:"registry_port"` | |
| 55 | - | RegistryDomain string `mapstructure:"registry_domain"` | |
| 55 | + | GordonDomain string `mapstructure:"gordon_domain"` | |
| 56 | + | RegistryDomain string `mapstructure:"registry_domain"` // Deprecated: use gordon_domain | |
| 56 | 57 | DataDir string `mapstructure:"data_dir"` | |
| 57 | 58 | } `mapstructure:"server"` | |
| 58 | 59 | ||
| @@ -183,6 +184,11 @@ func initConfig(configPath string) (*viper.Viper, Config, error) { | |||
| 183 | 184 | return nil, Config{}, fmt.Errorf("failed to unmarshal config: %w", err) | |
| 184 | 185 | } | |
| 185 | 186 | ||
| 187 | + | // Normalize domain config: prefer gordon_domain over registry_domain | |
| 188 | + | if cfg.Server.GordonDomain != "" { | |
| 189 | + | cfg.Server.RegistryDomain = cfg.Server.GordonDomain | |
| 190 | + | } | |
| 191 | + | ||
| 186 | 192 | return v, cfg, nil | |
| 187 | 193 | } | |
| 188 | 194 | ||
| @@ -52,7 +52,8 @@ type Config struct { | |||||
| 52 | Server struct { | 52 | Server struct { | ||
| 53 | Port int `mapstructure:"port"` | 53 | Port int `mapstructure:"port"` | ||
| 54 | RegistryPort int `mapstructure:"registry_port"` | 54 | RegistryPort int `mapstructure:"registry_port"` | ||
| 55 | - | RegistryDomain string `mapstructure:"registry_domain"` | 55 | + | GordonDomain string `mapstructure:"gordon_domain"` |
| 56 | + | RegistryDomain string `mapstructure:"registry_domain"` // Deprecated: use gordon_domain | |||
| 56 | DataDir string `mapstructure:"data_dir"` | 57 | DataDir string `mapstructure:"data_dir"` | ||
| 57 | } `mapstructure:"server"` | 58 | } `mapstructure:"server"` | ||
| 58 | 59 | ||||
| @@ -183,6 +184,11 @@ func initConfig(configPath string) (*viper.Viper, Config, error) { | |||||
| 183 | return nil, Config{}, fmt.Errorf("failed to unmarshal config: %w", err) | 184 | return nil, Config{}, fmt.Errorf("failed to unmarshal config: %w", err) | ||
| 184 | } | 185 | } | ||
| 185 | 186 | ||||
| 187 | + | // Normalize domain config: prefer gordon_domain over registry_domain | |||
| 188 | + | if cfg.Server.GordonDomain != "" { | |||
| 189 | + | cfg.Server.RegistryDomain = cfg.Server.GordonDomain | |||
| 190 | + | } | |||
| 191 | + | ||||
| 186 | return v, cfg, nil | 192 | return v, cfg, nil | ||
| 187 | } | 193 | } | ||
| 188 | 194 | ||||
M wiki/guides/remote-cli.md +12 -0
| @@ -16,6 +16,18 @@ Manage Gordon instances remotely using the CLI with the `--remote` flag or saved | |||
| 16 | 16 | - A remote Gordon instance running with admin API enabled | |
| 17 | 17 | - Authentication token for the remote instance | |
| 18 | 18 | ||
| 19 | + | ## Understanding the Remote URL | |
| 20 | + | ||
| 21 | + | The `--remote` URL must be the `gordon_domain` configured on the remote Gordon instance. This domain serves both the container registry and the Admin API. | |
| 22 | + | ||
| 23 | + | ```toml | |
| 24 | + | # On the remote Gordon server | |
| 25 | + | [server] | |
| 26 | + | gordon_domain = "gordon.example.com" # Use this as --remote URL | |
| 27 | + | ``` | |
| 28 | + | ||
| 29 | + | The CLI connects to `https://gordon.example.com/admin/*` endpoints. | |
| 30 | + | ||
| 19 | 31 | ## Quick Start | |
| 20 | 32 | ||
| 21 | 33 | ### One-off Remote Command | |
| @@ -16,6 +16,18 @@ Manage Gordon instances remotely using the CLI with the `--remote` flag or saved | |||||
| 16 | - A remote Gordon instance running with admin API enabled | 16 | - A remote Gordon instance running with admin API enabled | ||
| 17 | - Authentication token for the remote instance | 17 | - Authentication token for the remote instance | ||
| 18 | 18 | ||||
| 19 | + | ## Understanding the Remote URL | |||
| 20 | + | ||||
| 21 | + | The `--remote` URL must be the `gordon_domain` configured on the remote Gordon instance. This domain serves both the container registry and the Admin API. | |||
| 22 | + | ||||
| 23 | + | ```toml | |||
| 24 | + | # On the remote Gordon server | |||
| 25 | + | [server] | |||
| 26 | + | gordon_domain = "gordon.example.com" # Use this as --remote URL | |||
| 27 | + | ``` | |||
| 28 | + | ||||
| 29 | + | The CLI connects to `https://gordon.example.com/admin/*` endpoints. | |||
| 30 | + | ||||
| 19 | ## Quick Start | 31 | ## Quick Start | ||
| 20 | 32 | ||||
| 21 | ### One-off Remote Command | 33 | ### One-off Remote Command | ||