v2.2.7 aefe19e

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

# After editing gordon.toml, apply changes without restart
vim ~/.config/gordon/gordon.toml
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
193# After editing gordon.toml, apply changes without restart
194vim ~/.config/gordon/gordon.toml
195gordon reload
196```
197
198---
199
200## gordon deploy
201
202Manually deploy or redeploy a specific route.
203
204### Synopsis
205
206```bash
207gordon deploy <domain>
208```
209
210### Arguments
211
212| Argument | Description |
213|----------|-------------|
214| `<domain>` | The domain name of the route to deploy (required) |
215
216### Description
217
218Sends `SIGUSR2` to the Gordon process with the specified domain, triggering:
219
220- Fresh image pull (always pulls latest, ignoring cache)
221- Container redeployment for the specified route
222
223### Examples
224
225```bash
226gordon deploy myapp.example.com
227gordon deploy api.example.com
228```
229
230### Use Cases
231
232- Recover from a failed deployment
233- Force redeploy without pushing a new image
234- Manual deployment when automatic deploy didn't trigger
235
236---
237
238## gordon logs
239
240Display Gordon process logs.
241
242### Synopsis
243
244```bash
245gordon logs [options]
246```
247
248### Options
249
250| Option | Short | Default | Description |
251|--------|-------|---------|-------------|
252| `--config` | `-c` | Auto | Path to config file |
253| `--follow` | `-f` | false | Follow log output (like `tail -f`) |
254| `--lines` | `-n` | 50 | Number of lines to show |
255
256### Examples
257
258```bash
259gordon logs              # Last 50 lines
260gordon logs -f           # Follow logs
261gordon logs -n 100       # Last 100 lines
262gordon logs -f -n 200    # Follow, starting from last 200 lines
263```
264
265### Log Locations
266
267```bash
268# Using gordon logs
269gordon logs -f
270
271# Direct file access
272tail -f ~/.gordon/logs/gordon.log
273
274# With systemd
275journalctl --user -u gordon -f
276```
277
278---
279
280## gordon version
281
282Print version information.
283
284### Synopsis
285
286```bash
287gordon version
288```
289
290### Output
291
292```
293Gordon v2.0.0
294Commit: abc1234
295Build Date: 2024-01-15
296```
297
298---
299
300## gordon auth
301
302Manage registry authentication tokens and passwords.
303
304### Subcommands
305
306| Subcommand | Description |
307|------------|-------------|
308| `token generate` | Generate a new JWT token |
309| `token list` | List all stored tokens |
310| `token revoke` | Revoke a token by ID |
311| `password hash` | Generate bcrypt password hash |
312| `internal` | Show internal registry credentials |
313
314### gordon auth token generate
315
316Generate a new JWT authentication token for registry access.
317
318```bash
319gordon auth token generate --subject <name> [options]
320```
321
322**Options:**
323
324| Option | Default | Description |
325|--------|---------|-------------|
326| `--subject` | (required) | Username/subject for the token |
327| `--scopes` | `push,pull` | Comma-separated scopes |
328| `--expiry` | `720h` | Duration until expiry (0 = never) |
329| `-c, --config` | Auto | Path to config file |
330
331**Examples:**
332
333```bash
334# CI token that never expires
335gordon auth token generate --subject github-actions --expiry 0
336
337# Read-only token
338gordon auth token generate --subject reader --scopes pull --expiry 720h
339
340# Push-only token for build system
341gordon auth token generate --subject builder --scopes push --expiry 0
342
343# Temporary token (24 hours)
344gordon auth token generate --subject temp --expiry 24h
345```
346
347**Output:**
348
349```
350Token generated successfully!
351Subject: github-actions
352Scopes: push, pull
353Expiry: never
354
355Token (use as password with docker login):
356eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
357
358Usage: docker login -u github-actions -p <token> <registry>
359```
360
361### gordon auth token list
362
363List all stored authentication tokens.
364
365```bash
366gordon auth token list [options]
367```
368
369**Output:**
370
371```
372ID                                    Subject               Expires               Revoked
373------------------------------------------------------------------------------------------
374a1b2c3d4-e5f6-7890-abcd-ef1234567890  github-actions        never                 no
375b2c3d4e5-f6a7-8901-bcde-f12345678901  deploy-bot            2024-02-15 10:30      no
376c3d4e5f6-a7b8-9012-cdef-123456789012  old-token             2024-01-01 00:00      yes
377```
378
379### gordon auth token revoke
380
381Revoke a token by its ID.
382
383```bash
384gordon auth token revoke <token-id> [options]
385```
386
387**Example:**
388
389```bash
390gordon auth token revoke a1b2c3d4-e5f6-7890-abcd-ef1234567890
391```
392
393**Output:**
394
395```
396Token a1b2c3d4-e5f6-7890-abcd-ef1234567890 has been revoked.
397```
398
399### gordon auth password hash
400
401Generate a bcrypt hash for password authentication.
402
403```bash
404gordon auth password hash
405```
406
407Interactively prompts for a password and outputs the bcrypt hash.
408
409**Output:**
410
411```
412Enter password: ********
413
414Bcrypt hash (store in your secrets backend):
415$2a$10$N9qo8uLOickgx2ZMRZoMye...
416
417Then reference the path in your config:
418  [registry_auth]
419  type = "password"
420  password_hash = "gordon/registry/password_hash"
421```
422
423### gordon auth internal
424
425Display the auto-generated internal registry credentials.
426
427```bash
428gordon auth internal
429```
430
431Gordon generates temporary credentials for internal communication with its local registry. These credentials are useful for manual recovery when debugging deployment issues.
432
433**Output:**
434
435```
436Internal Registry Credentials
437==============================
438Username: gordon-internal
439Password: 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...
440
441Usage:
442  docker login localhost:5000 -u gordon-internal -p 8f3a2b1c4d5e6f7a8b9c0d1e2f3a4b5c...
443```
444
445**Notes:**
446- Credentials are regenerated each time Gordon starts
447- Only available while Gordon is running
448- Used for manual `docker pull` from the local registry during debugging
449
450**Use cases:**
451- Debugging image pull failures
452- Manual recovery after deployment issues
453- Inspecting images in the local registry
454
455---
456
457## Token Scopes
458
459| Scope | Permission |
460|-------|------------|
461| `push` | Push images to registry |
462| `pull` | Pull images from registry |
463| `push,pull` | Both push and pull (default) |
464
465## Token Expiry Formats
466
467| Format | Duration |
468|--------|----------|
469| `0` | Never expires |
470| `24h` | 24 hours |
471| `720h` | 30 days |
472| `8760h` | 1 year |
473
474---
475
476## Workflow Examples
477
478### CI/CD Setup
479
480```bash
481# Generate token for CI
482gordon auth token generate --subject ci-bot --scopes push,pull --expiry 0
483
484# Save token as CI secret
485# GitHub: Settings → Secrets → New repository secret
486# GitLab: Settings → CI/CD → Variables
487```
488
489### Docker Login
490
491```bash
492# Using generated token
493docker login -u ci-bot -p <token> registry.mydomain.com
494
495# In CI/CD
496echo "$GORDON_TOKEN" | docker login -u ci-bot --password-stdin registry.mydomain.com
497```
498
499### Token Rotation
500
501```bash
502# Generate new token
503gordon auth token generate --subject ci-bot --expiry 0
504
505# Update CI secrets with new token
506
507# Revoke old token
508gordon auth token revoke <old-token-id>
509```
510
511### Password Setup
512
513```bash
514# Generate hash
515gordon auth password hash
516# Enter: mypassword
517
518# Store in pass
519pass insert gordon/registry/password_hash
520# Paste: $2a$10$...
521
522# Configure gordon.toml
523[registry_auth]
524enabled = true
525type = "password"
526username = "deploy"
527password_hash = "gordon/registry/password_hash"
528```
529
530---
531
532## Exit Codes
533
534| Code | Meaning |
535|------|---------|
536| 0 | Success |
537| 1 | General error |
538| 2 | Configuration error |
539
540## Environment Variables
541
542Gordon reads configuration from environment variables:
543
544```bash
545GORDON_SERVER_PORT=8080 gordon start
546GORDON_LOGGING_LEVEL=debug gordon start
547```
548
549Pattern: `GORDON_SECTION_KEY` (uppercase, underscores)
550
551## Related
552
553- [Core Concepts](../concepts.md)
554- [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