Skip to content

Commit 4ca8418

Browse files
authored
Merge pull request asciimoo#118 from sinsky/docs/update-setup
Enhance server configuration documentation and fix documentation layout
2 parents 5be7dce + 61d0fb9 commit 4ca8418

2 files changed

Lines changed: 59 additions & 39 deletions

File tree

docs/content/documentation/server-setup.md

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,23 @@ The server will start on `http://127.0.0.1:4433` and be accessible only from you
1919

2020
## Running on a Different Host
2121

22-
If you want to access Hister from other devices on your network or run it on a server, you need to configure two settings:
22+
If you want to access Hister from other devices on your network or run it on a server, you need to configure two settings.
23+
24+
### Generate Configuration File
25+
26+
You can generate a default configuration file using the `create-config` command:
27+
28+
```bash
29+
./hister create-config config.yml
30+
```
31+
32+
If no filename is provided, it will print the default configuration to `stdout`.
33+
34+
> **Note**: You can also configure Hister entirely using **Environment Variables**, which is often easier for server setups. See the [Configuration via Environment Variables](#configuration-via-environment-variables) section below for details.
2335
2436
### Bind to All Network Interfaces
2537

26-
Create or edit your configuration file at `~/.config/hister/config.yml`:
38+
Edit your configuration file (e.g., `~/.config/hister/config.yml`):
2739

2840
```yaml
2941
server:
@@ -93,9 +105,36 @@ server:
93105
base_url: "https://hister.example.com" # Your public URL
94106
```
95107

108+
## Configuration via Environment Variables
109+
110+
Hister can be fully configured using environment variables. This is the **recommended approach for containerized environments** (Docker, Kubernetes, etc.) as it avoids the need to manage configuration files inside the container or mounted volumes.
111+
112+
### Environment Variable Format
113+
114+
All configuration options can be set using environment variables with the prefix `HISTER__`. Nested keys are separated by double underscores (`__`).
115+
116+
| Variable | Description |
117+
| --- | --- |
118+
| `HISTER__SERVER__ADDRESS` | The address and port the server binds to (default: `127.0.0.1:4433`) |
119+
| `HISTER__SERVER__BASE_URL` | The external URL used to access Hister (e.g., `https://hister.example.com`) |
120+
| `HISTER__SERVER__DATABASE` | The filename of the SQLite database (default: `db.sqlite3`) |
121+
| `HISTER__APP__DIRECTORY` | The directory where Hister stores its data (shorthand: `HISTER_DATA_DIR`) |
122+
| `HISTER__APP__LOG_LEVEL` | Logging verbosity: `debug`, `info`, `warn`, `error` (default: `info`) |
123+
| `HISTER_PORT` | Shorthand to override only the port in `server.address` |
124+
96125
## Docker Setup
97126

98-
Hister provides official Docker images for both AMD64 and ARM64 architectures.
127+
Hister provides official Docker images for both AMD64 and ARM64 architectures. Using environment variables is the preferred way to configure Hister in Docker.
128+
129+
> **Note on Permissions**: The `latest` image runs as a **non-root user** (UID/GID 1000) by default for better security. Ensure the mounted volume (e.g., `./data`) has the correct permissions. If you need to run as root, use the `ghcr.io/asciimoo/hister:latest-root` image.
130+
131+
### Generating Configuration via Docker
132+
133+
If you prefer using a configuration file instead of environment variables, you can generate a default one using Docker:
134+
135+
```bash
136+
docker run --rm ghcr.io/asciimoo/hister:latest create-config > config.yml
137+
```
99138

100139
### Basic Docker Compose
101140

@@ -106,68 +145,50 @@ services:
106145
hister:
107146
image: ghcr.io/asciimoo/hister:latest
108147
container_name: hister
148+
user: "1000:1000"
109149
restart: unless-stopped
110150
volumes:
111-
- ./config:/hister/data
151+
- ./data:/hister/data
112152
ports:
113153
- 4433:4433
114154
```
115155

116156
### Docker Compose with External Access
117157

118-
To make Hister accessible from other devices, you must create a configuration file:
119-
120-
**Step 1**: Create `config/config.yml`:
121-
122-
```yaml
123-
server:
124-
address: "0.0.0.0:4433"
125-
base_url: "http://192.168.1.100:4433" # Use your actual IP/hostname
126-
```
127-
128-
**Step 2**: Create `compose.yml`:
158+
To make Hister accessible from other devices, use the `environment` section in your `compose.yml`:
129159

130160
```yaml
131161
services:
132162
hister:
133-
image: ghcr.io/asciimoo/hister:master-root
163+
image: ghcr.io/asciimoo/hister:latest
134164
container_name: hister
165+
user: "1000:1000"
135166
restart: unless-stopped
167+
environment:
168+
- HISTER__SERVER__ADDRESS=0.0.0.0:4433
169+
- HISTER__SERVER__BASE_URL=http://192.168.1.100:4433 # Use your actual IP/hostname
136170
volumes:
137-
- ./config:/hister/data
171+
- ./data:/hister/data
138172
ports:
139173
- 4433:4433
140174
```
141175

142-
**Step 3**: Start the container:
143-
144-
```bash
145-
docker compose up -d
146-
```
147-
148176
### Docker Compose Behind Reverse Proxy
149177

150-
When running behind a reverse proxy:
151-
152-
**config/config.yml**:
153-
154-
```yaml
155-
server:
156-
address: "0.0.0.0:4433"
157-
base_url: "https://hister.example.com" # Your public URL
158-
```
159-
160-
**compose.yml**:
178+
When running behind a reverse proxy, set the `base_url` to your public domain:
161179

162180
```yaml
163181
services:
164182
hister:
165-
image: ghcr.io/asciimoo/hister:master-root
183+
image: ghcr.io/asciimoo/hister:latest
166184
container_name: hister
185+
user: "1000:1000"
167186
restart: unless-stopped
187+
environment:
188+
- HISTER__SERVER__ADDRESS=0.0.0.0:4433
189+
- HISTER__SERVER__BASE_URL=https://hister.example.com # Your public URL
168190
volumes:
169-
- ./config:/hister/data
191+
- ./data:/hister/data
170192
ports:
171-
- 4433:4433 # Expose only to localhost if proxy is on same host
172-
# Or use a Docker network and don't expose ports externally
193+
- 4433:4433
173194
```

docs/themes/hister/assets/css/main.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ main {
5252
max-width: min(70em, 100%);
5353
margin: 0 auto;
5454
padding: 1em;
55-
flex: 1 0 auto;
5655
}
5756

5857
strong {

0 commit comments

Comments
 (0)