blob: 9c8c0c6bd9a274048dc764c194a3d07bd0f82af3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# `atuin server`
Atuin allows you to run your own sync server, in case you don't want to use the
one I host :)
There's currently only one subcommand, `atuin server start` which will start the
Atuin http sync server
```
USAGE:
atuin server start [OPTIONS]
FLAGS:
--help Prints help information
-V, --version Prints version information
OPTIONS:
-h, --host <host>
-p, --port <port>
```
## Configuration
The config for the server is kept separate from the config for the client, even
though they are the same binary. Server config can be found at
`~/.config/atuin/server.toml`.
It looks something like this:
```toml
host = "0.0.0.0"
port = 8888
open_registration = true
db_uri="postgres://user:password@hostname/database"
```
Alternatively, configuration can also be provided with environment variables.
```sh
ATUIN_HOST="0.0.0.0"
ATUIN_PORT=8888
ATUIN_OPEN_REGISTRATION=true
ATUIN_DB_URI="postgres://user:password@hostname/database"
```
### host
The host address the atuin server should listen on.
Defaults to `127.0.0.1`.
### port
The post the atuin server should listen on.
Defaults to `8888`.
### open_registration
If `true`, atuin will accept new user registrations.
Set this to `false` after making your own account if you don't want others to be
able to use your server.
Defaults to `false`.
### db_uri
A valid postgres URI, where the user and history data will be saved to.
## Docker
There is a supplied docker image to make deploying a server as a container easier.
```sh
docker run -d -v "$USER/.config/atuin:/config" ghcr.io/ellie/atuin:latest server start
```
## Docker Compose
Using the already build docker image hosting your own Atuin can be done using the supplied docker-compose file.
Create a `.env` file next to `docker-compose.yml` with contents like this:
```
ATUIN_DB_USERNAME=atuin
# Choose your own secure password
ATUIN_DB_PASSWORD=really-insecure
```
Create a `docker-compose.yml`:
```yaml
version: '3.5'
services:
atuin:
restart: always
image: ghcr.io/ellie/atuin:main
command: server start
volumes:
- "./config:/config"
links:
- postgresql:db
ports:
- 8888:8888
environment:
ATUIN_HOST: "0.0.0.0"
ATUIN_OPEN_REGISTRATION: "true"
ATUIN_DB_URI: postgres://$ATUIN_DB_USERNAME:$ATUIN_DB_PASSWORD@db/atuin
postgresql:
image: postgres:14
restart: unless-stopped
volumes: # Don't remove permanent storage for index database files!
- "./database:/var/lib/postgresql/data/"
environment:
POSTGRES_USER: $ATUIN_DB_USERNAME
POSTGRES_PASSWORD: $ATUIN_DB_PASSWORD
POSTGRES_DB: atuin
```
Start the services using `docker-compose`:
```sh
docker-compose up -d
```
### Using systemd to manage your atuin server
The following `systemd` unit file to manage your `docker-compose` managed service:
```
[Unit]
Description=Docker Compose Atuin Service
Requires=docker.service
After=docker.service
[Service]
# Where the docker-compose file is located
WorkingDirectory=/srv/atuin-server
ExecStart=/usr/bin/docker-compose up
ExecStop=/usr/bin/docker-compose down
TimeoutStartSec=0
Restart=on-failure
StartLimitBurst=3
[Install]
WantedBy=multi-user.target
```
Start and enable the service with:
```sh
systemctl enable --now atuin
```
Check if its running with:
```sh
systemctl status atuin
```
|