v2.2.1 99f5ba4

commands.md RawHistoryFolder

CLI Commands

Gordon provides a command-line interface for server management, deployment, and authentication.

Commands Overview

Command Description
gordon start Start the Gordon server
gordon reload Reload configuration and sync containers
gordon deploy Manually deploy or redeploy a specific route
gordon logs Display Gordon process logs
gordon version Print version information
gordon auth Manage registry authentication

Quick Reference

# Start Gordon
gordon start
gordon start --config /path/to/config.toml

# Reload configuration
gordon reload

# Deploy a specific route
gordon deploy myapp.example.com

# View logs
gordon logs
gordon logs -f
gordon logs -n 100

# Check version
gordon version

# Authentication
gordon auth token generate --subject ci-bot --expiry 0
gordon auth token list
gordon auth token revoke <token-id>
gordon auth password hash
gordon auth internal

Global Options

Option Description
-c, --config Path to configuration file

gordon start

Start the Gordon server with registry and proxy components.

Synopsis

gordon start [options]

Options

Option Short Default Description
--config -c Auto-detected Path to configuration file

Description

Starts the Gordon server, which includes:

  • Container Registry - Receives image pushes on the registry port
  • HTTP Proxy - Routes traffic to containers on the proxy port
  • Event Bus - Coordinates deployments and updates
  • Config Watcher - Monitors configuration file for changes

Configuration File Detection

Gordon looks for configuration in this order:

  1. Path specified with --config
  2. /etc/gordon/gordon.toml
  3. ~/.config/gordon/gordon.toml
  4. ./gordon.toml

First Run

On first run without a config file, Gordon creates a default configuration at ~/.config/gordon/gordon.toml.

# First run - creates default config
gordon start
# Edit the config, then restart

Examples

# Basic start
gordon start

# With custom config
gordon start --config /path/to/gordon.toml
gordon start -c ./my-config.toml

# With environment override
GORDON_SERVER_PORT=8080 gordon start
GORDON_LOGGING_LEVEL=debug gordon start

Signals

Gordon responds to these signals:

Signal Action
SIGTERM Graceful shutdown
SIGINT Graceful shutdown (Ctrl+C)
SIGUSR1 Reload configuration
SIGUSR2 Manual deploy (used by gordon deploy)

Running with systemd

# Create user service
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/gordon.service <<EOF
[Unit]
Description=Gordon Container Platform

[Service]
Type=simple
Restart=always
ExecStart=/usr/local/bin/gordon start

[Install]
WantedBy=default.target
EOF

# Enable and start
systemctl --user daemon-reload
systemctl --user enable --now gordon
sudo loginctl enable-linger $USER

Startup Sequence

  1. Load configuration
  2. Initialize logger
  3. Create PID file
  4. Connect to Docker/Podman runtime
  5. Create storage directories
  6. Initialize services (registry, proxy, auth)
  7. Register event handlers
  8. Start config file watcher
  9. Sync existing containers
  10. Start HTTP servers

Shutdown Sequence

  1. Receive shutdown signal
  2. Stop accepting new requests
  3. Complete in-flight requests
  4. Stop managed containers (if configured)
  5. Remove PID file
  6. Exit

gordon reload

Reload configuration and sync containers to match.

Synopsis

gordon reload

Description

Sends SIGUSR1 to the running Gordon process, triggering:

  • Configuration file reload
  • Route synchronization
  • Deployment of containers for routes missing containers
  • Attachment deployment

Example

gordon reload

gordon deploy

Manually deploy or redeploy a specific route.

Synopsis

gordon deploy <domain>

Arguments

Argument Description
<domain> The domain name of the route to deploy (required)

Description

Sends SIGUSR2 to the Gordon process with the specified domain, triggering:

  • Fresh image pull (always pulls latest, ignoring cache)
  • Container redeployment for the specified route

Examples

gordon deploy myapp.example.com
gordon deploy api.example.com

Use Cases

  • Recover from a failed deployment
  • Force redeploy without pushing a new image
  • Manual deployment when automatic deploy didn't trigger

gordon logs

Display Gordon process logs.

Synopsis

gordon logs [options]

Options

Option Short Default Description
--config -c Auto Path to config file
--follow -f false Follow log output (like tail -f)
--lines -n 50 Number of lines to show

Examples

gordon logs              # Last 50 lines
gordon logs -f           # Follow logs
gordon logs -n 100       # Last 100 lines
gordon logs -f -n 200    # Follow, starting from last 200 lines

Log Locations

# Using gordon logs
gordon logs -f

# Direct file access
tail -f ~/.gordon/logs/gordon.log

# With systemd
journalctl --user -u gordon -f

gordon version

Print version information.

Synopsis

gordon version

Output

Gordon v2.0.0
Commit: abc1234
Build Date: 2024-01-15

gordon auth

Manage registry authentication tokens and passwords.

Subcommands

Subcommand Description
token generate Generate a new JWT token
token list List all stored tokens
token revoke Revoke a token by ID
password hash Generate bcrypt password hash
internal Show internal registry credentials

gordon auth token generate

Generate a new JWT authentication token for registry access.

gordon auth token generate --subject <name> [options]

Options:

Option Default Description
--subject (required) Username/subject for the token
--scopes push,pull Comma-separated scopes
--expiry 720h Duration until expiry (0 = never)
-c, --config Auto Path to config file

Examples:

# CI token that never expires
gordon auth token generate --subject github-actions --expiry 0

# Read-only token
gordon auth token generate --subject reader --scopes pull --expiry 720h

# Push-only token for build system
gordon auth token generate --subject builder --scopes push --expiry 0

# Temporary token (24 hours)
gordon auth token generate --subject temp --expiry 24h

Output:

Token generated successfully!
Subject: github-actions
Scopes: push, pull
Expiry: never

Token (use as password with docker login):
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Usage: docker login -u github-actions -p <token> <registry>

gordon auth token list

List all stored authentication tokens.

gordon auth token list [options]

Output:

ID                                    Subject               Expires               Revoked
------------------------------------------------------------------------------------------
a1b2c3d4-e5f6-7890-abcd-ef1234567890  github-actions        never                 no
b2c3d4e5-f6a7-8901-bcde-f12345678901  deploy-bot            2024-02-15 10:30      no
c3d4e5f6-a7b8-9012-cdef-123456789012  old-token             2024-01-01 00:00      yes

gordon auth token revoke

Revoke a token by its ID.

gordon auth token revoke <token-id> [options]

Example:

gordon auth token revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890

Output:

Token a1b2c3d4-e5f6-7890-abcd-ef1234567890 has been revoked.

gordon auth password hash

Generate a bcrypt hash for password authentication.

gordon auth password hash

Interactively prompts for a password and outputs the bcrypt hash.

Output:

Enter password: ********

Bcrypt hash (store in your secrets backend):
$2a$10$N9qo8uLOickgx2ZMRZoMye...

Then reference the path in your config:
  [registry_auth]
  type = "password"
  password_hash = "gordon/registry/password_hash"

gordon auth internal

Display the auto-generated internal registry credentials.

gordon auth internal

Gordon generates temporary credentials for internal communication with its local registry. These credentials are useful for manual recovery when debugging deployment issues.

Output:

Internal Registry Credentials
==============================
Username: gordon-internal
Password: 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...

Usage:
  docker login localhost:5000 -u gordon-internal -p 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...

Notes:

  • Credentials are regenerated each time Gordon starts
  • Only available while Gordon is running
  • Used for manual docker pull from the local registry during debugging

Use cases:

  • Debugging image pull failures
  • Manual recovery after deployment issues
  • Inspecting images in the local registry

Token Scopes

Scope Permission
push Push images to registry
pull Pull images from registry
push,pull Both push and pull (default)

Token Expiry Formats

Format Duration
0 Never expires
24h 24 hours
720h 30 days
8760h 1 year

Workflow Examples

CI/CD Setup

# Generate token for CI
gordon auth token generate --subject ci-bot --scopes push,pull --expiry 0

# Save token as CI secret
# GitHub: Settings → Secrets → New repository secret
# GitLab: Settings → CI/CD → Variables

Docker Login

# Using generated token
docker login -u ci-bot -p <token> registry.mydomain.com

# In CI/CD
echo "$GORDON_TOKEN" | docker login -u ci-bot --password-stdin registry.mydomain.com

Token Rotation

# Generate new token
gordon auth token generate --subject ci-bot --expiry 0

# Update CI secrets with new token

# Revoke old token
gordon auth token revoke <old-token-id>

Password Setup

# Generate hash
gordon auth password hash
# Enter: mypassword

# Store in pass
pass insert gordon/registry/password_hash
# Paste: $2a$10$...

# Configure gordon.toml
[registry_auth]
enabled = true
type = "password"
username = "deploy"
password_hash = "gordon/registry/password_hash"

Exit Codes

Code Meaning
0 Success
1 General error
2 Configuration error

Environment Variables

Gordon reads configuration from environment variables:

GORDON_SERVER_PORT=8080 gordon start
GORDON_LOGGING_LEVEL=debug gordon start

Pattern: GORDON_SECTION_KEY (uppercase, underscores)

source
1# CLI Commands
2
3Gordon provides a command-line interface for server management, deployment, and authentication.
4
5## Commands Overview
6
7| Command | Description |
8|---------|-------------|
9| `gordon start` | Start the Gordon server |
10| `gordon reload` | Reload configuration and sync containers |
11| `gordon deploy` | Manually deploy or redeploy a specific route |
12| `gordon logs` | Display Gordon process logs |
13| `gordon version` | Print version information |
14| `gordon auth` | Manage registry authentication |
15
16## Quick Reference
17
18```bash
19# Start Gordon
20gordon start
21gordon start --config /path/to/config.toml
22
23# Reload configuration
24gordon reload
25
26# Deploy a specific route
27gordon deploy myapp.example.com
28
29# View logs
30gordon logs
31gordon logs -f
32gordon logs -n 100
33
34# Check version
35gordon version
36
37# Authentication
38gordon auth token generate --subject ci-bot --expiry 0
39gordon auth token list
40gordon auth token revoke <token-id>
41gordon auth password hash
42gordon auth internal
43```
44
45## Global Options
46
47| Option | Description |
48|--------|-------------|
49| `-c, --config` | Path to configuration file |
50
51---
52
53## gordon start
54
55Start the Gordon server with registry and proxy components.
56
57### Synopsis
58
59```bash
60gordon start [options]
61```
62
63### Options
64
65| Option | Short | Default | Description |
66|--------|-------|---------|-------------|
67| `--config` | `-c` | Auto-detected | Path to configuration file |
68
69### Description
70
71Starts the Gordon server, which includes:
72
73- **Container Registry** - Receives image pushes on the registry port
74- **HTTP Proxy** - Routes traffic to containers on the proxy port
75- **Event Bus** - Coordinates deployments and updates
76- **Config Watcher** - Monitors configuration file for changes
77
78### Configuration File Detection
79
80Gordon looks for configuration in this order:
81
821. Path specified with `--config`
832. `/etc/gordon/gordon.toml`
843. `~/.config/gordon/gordon.toml`
854. `./gordon.toml`
86
87### First Run
88
89On first run without a config file, Gordon creates a default configuration at `~/.config/gordon/gordon.toml`.
90
91```bash
92# First run - creates default config
93gordon start
94# Edit the config, then restart
95```
96
97### Examples
98
99```bash
100# Basic start
101gordon start
102
103# With custom config
104gordon start --config /path/to/gordon.toml
105gordon start -c ./my-config.toml
106
107# With environment override
108GORDON_SERVER_PORT=8080 gordon start
109GORDON_LOGGING_LEVEL=debug gordon start
110```
111
112### Signals
113
114Gordon responds to these signals:
115
116| Signal | Action |
117|--------|--------|
118| `SIGTERM` | Graceful shutdown |
119| `SIGINT` | Graceful shutdown (Ctrl+C) |
120| `SIGUSR1` | Reload configuration |
121| `SIGUSR2` | Manual deploy (used by `gordon deploy`) |
122
123### Running with systemd
124
125```bash
126# Create user service
127mkdir -p ~/.config/systemd/user
128cat > ~/.config/systemd/user/gordon.service <<EOF
129[Unit]
130Description=Gordon Container Platform
131
132[Service]
133Type=simple
134Restart=always
135ExecStart=/usr/local/bin/gordon start
136
137[Install]
138WantedBy=default.target
139EOF
140
141# Enable and start
142systemctl --user daemon-reload
143systemctl --user enable --now gordon
144sudo loginctl enable-linger $USER
145```
146
147### Startup Sequence
148
1491. Load configuration
1502. Initialize logger
1513. Create PID file
1524. Connect to Docker/Podman runtime
1535. Create storage directories
1546. Initialize services (registry, proxy, auth)
1557. Register event handlers
1568. Start config file watcher
1579. Sync existing containers
15810. Start HTTP servers
159
160### Shutdown Sequence
161
1621. Receive shutdown signal
1632. Stop accepting new requests
1643. Complete in-flight requests
1654. Stop managed containers (if configured)
1665. Remove PID file
1676. Exit
168
169---
170
171## gordon reload
172
173Reload configuration and sync containers to match.
174
175### Synopsis
176
177```bash
178gordon reload
179```
180
181### Description
182
183Sends `SIGUSR1` to the running Gordon process, triggering:
184
185- Configuration file reload
186- Route synchronization
187- Deployment of containers for routes missing containers
188- Attachment deployment
189
190### Example
191
192```bash
193gordon reload
194```
195
196---
197
198## gordon deploy
199
200Manually deploy or redeploy a specific route.
201
202### Synopsis
203
204```bash
205gordon deploy <domain>
206```
207
208### Arguments
209
210| Argument | Description |
211|----------|-------------|
212| `<domain>` | The domain name of the route to deploy (required) |
213
214### Description
215
216Sends `SIGUSR2` to the Gordon process with the specified domain, triggering:
217
218- Fresh image pull (always pulls latest, ignoring cache)
219- Container redeployment for the specified route
220
221### Examples
222
223```bash
224gordon deploy myapp.example.com
225gordon deploy api.example.com
226```
227
228### Use Cases
229
230- Recover from a failed deployment
231- Force redeploy without pushing a new image
232- Manual deployment when automatic deploy didn't trigger
233
234---
235
236## gordon logs
237
238Display Gordon process logs.
239
240### Synopsis
241
242```bash
243gordon logs [options]
244```
245
246### Options
247
248| Option | Short | Default | Description |
249|--------|-------|---------|-------------|
250| `--config` | `-c` | Auto | Path to config file |
251| `--follow` | `-f` | false | Follow log output (like `tail -f`) |
252| `--lines` | `-n` | 50 | Number of lines to show |
253
254### Examples
255
256```bash
257gordon logs              # Last 50 lines
258gordon logs -f           # Follow logs
259gordon logs -n 100       # Last 100 lines
260gordon logs -f -n 200    # Follow, starting from last 200 lines
261```
262
263### Log Locations
264
265```bash
266# Using gordon logs
267gordon logs -f
268
269# Direct file access
270tail -f ~/.gordon/logs/gordon.log
271
272# With systemd
273journalctl --user -u gordon -f
274```
275
276---
277
278## gordon version
279
280Print version information.
281
282### Synopsis
283
284```bash
285gordon version
286```
287
288### Output
289
290```
291Gordon v2.0.0
292Commit: abc1234
293Build Date: 2024-01-15
294```
295
296---
297
298## gordon auth
299
300Manage registry authentication tokens and passwords.
301
302### Subcommands
303
304| Subcommand | Description |
305|------------|-------------|
306| `token generate` | Generate a new JWT token |
307| `token list` | List all stored tokens |
308| `token revoke` | Revoke a token by ID |
309| `password hash` | Generate bcrypt password hash |
310| `internal` | Show internal registry credentials |
311
312### gordon auth token generate
313
314Generate a new JWT authentication token for registry access.
315
316```bash
317gordon auth token generate --subject <name> [options]
318```
319
320**Options:**
321
322| Option | Default | Description |
323|--------|---------|-------------|
324| `--subject` | (required) | Username/subject for the token |
325| `--scopes` | `push,pull` | Comma-separated scopes |
326| `--expiry` | `720h` | Duration until expiry (0 = never) |
327| `-c, --config` | Auto | Path to config file |
328
329**Examples:**
330
331```bash
332# CI token that never expires
333gordon auth token generate --subject github-actions --expiry 0
334
335# Read-only token
336gordon auth token generate --subject reader --scopes pull --expiry 720h
337
338# Push-only token for build system
339gordon auth token generate --subject builder --scopes push --expiry 0
340
341# Temporary token (24 hours)
342gordon auth token generate --subject temp --expiry 24h
343```
344
345**Output:**
346
347```
348Token generated successfully!
349Subject: github-actions
350Scopes: push, pull
351Expiry: never
352
353Token (use as password with docker login):
354eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
355
356Usage: docker login -u github-actions -p <token> <registry>
357```
358
359### gordon auth token list
360
361List all stored authentication tokens.
362
363```bash
364gordon auth token list [options]
365```
366
367**Output:**
368
369```
370ID                                    Subject               Expires               Revoked
371------------------------------------------------------------------------------------------
372a1b2c3d4-e5f6-7890-abcd-ef1234567890  github-actions        never                 no
373b2c3d4e5-f6a7-8901-bcde-f12345678901  deploy-bot            2024-02-15 10:30      no
374c3d4e5f6-a7b8-9012-cdef-123456789012  old-token             2024-01-01 00:00      yes
375```
376
377### gordon auth token revoke
378
379Revoke a token by its ID.
380
381```bash
382gordon auth token revoke <token-id> [options]
383```
384
385**Example:**
386
387```bash
388gordon auth token revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890
389```
390
391**Output:**
392
393```
394Token a1b2c3d4-e5f6-7890-abcd-ef1234567890 has been revoked.
395```
396
397### gordon auth password hash
398
399Generate a bcrypt hash for password authentication.
400
401```bash
402gordon auth password hash
403```
404
405Interactively prompts for a password and outputs the bcrypt hash.
406
407**Output:**
408
409```
410Enter password: ********
411
412Bcrypt hash (store in your secrets backend):
413$2a$10$N9qo8uLOickgx2ZMRZoMye...
414
415Then reference the path in your config:
416  [registry_auth]
417  type = "password"
418  password_hash = "gordon/registry/password_hash"
419```
420
421### gordon auth internal
422
423Display the auto-generated internal registry credentials.
424
425```bash
426gordon auth internal
427```
428
429Gordon generates temporary credentials for internal communication with its local registry. These credentials are useful for manual recovery when debugging deployment issues.
430
431**Output:**
432
433```
434Internal Registry Credentials
435==============================
436Username: gordon-internal
437Password: 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...
438
439Usage:
440  docker login localhost:5000 -u gordon-internal -p 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...
441```
442
443**Notes:**
444- Credentials are regenerated each time Gordon starts
445- Only available while Gordon is running
446- Used for manual `docker pull` from the local registry during debugging
447
448**Use cases:**
449- Debugging image pull failures
450- Manual recovery after deployment issues
451- Inspecting images in the local registry
452
453---
454
455## Token Scopes
456
457| Scope | Permission |
458|-------|------------|
459| `push` | Push images to registry |
460| `pull` | Pull images from registry |
461| `push,pull` | Both push and pull (default) |
462
463## Token Expiry Formats
464
465| Format | Duration |
466|--------|----------|
467| `0` | Never expires |
468| `24h` | 24 hours |
469| `720h` | 30 days |
470| `8760h` | 1 year |
471
472---
473
474## Workflow Examples
475
476### CI/CD Setup
477
478```bash
479# Generate token for CI
480gordon auth token generate --subject ci-bot --scopes push,pull --expiry 0
481
482# Save token as CI secret
483# GitHub: Settings → Secrets → New repository secret
484# GitLab: Settings → CI/CD → Variables
485```
486
487### Docker Login
488
489```bash
490# Using generated token
491docker login -u ci-bot -p <token> registry.mydomain.com
492
493# In CI/CD
494echo "$GORDON_TOKEN" | docker login -u ci-bot --password-stdin registry.mydomain.com
495```
496
497### Token Rotation
498
499```bash
500# Generate new token
501gordon auth token generate --subject ci-bot --expiry 0
502
503# Update CI secrets with new token
504
505# Revoke old token
506gordon auth token revoke <old-token-id>
507```
508
509### Password Setup
510
511```bash
512# Generate hash
513gordon auth password hash
514# Enter: mypassword
515
516# Store in pass
517pass insert gordon/registry/password_hash
518# Paste: $2a$10$...
519
520# Configure gordon.toml
521[registry_auth]
522enabled = true
523type = "password"
524username = "deploy"
525password_hash = "gordon/registry/password_hash"
526```
527
528---
529
530## Exit Codes
531
532| Code | Meaning |
533|------|---------|
534| 0 | Success |
535| 1 | General error |
536| 2 | Configuration error |
537
538## Environment Variables
539
540Gordon reads configuration from environment variables:
541
542```bash
543GORDON_SERVER_PORT=8080 gordon start
544GORDON_LOGGING_LEVEL=debug gordon start
545```
546
547Pattern: `GORDON_SECTION_KEY` (uppercase, underscores)
548
549## Related
550
551- [Core Concepts](../concepts.md)
552- [Configuration Reference](../config/index.md)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close