Skip to content

Commit b667533

Browse files
committed
Add Atuin Server installation and configuration scripts
- Introduced `atuin.sh` for setting up the Atuin server with automatic updates. - Added `atuin.json` for frontend integration, detailing server configuration and usage instructions. - Created `atuin-install.sh` to handle installation, PostgreSQL setup, and service management for Atuin server. - Included detailed server information and client connection instructions in the setup process.
1 parent 9cddbbd commit b667533

File tree

3 files changed

+321
-0
lines changed

3 files changed

+321
-0
lines changed

ct/atuin.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: jager
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/atuinsh/atuin
7+
8+
APP="Atuin Server"
9+
var_tags="shell-history;server"
10+
var_cpu="2"
11+
var_ram="2048"
12+
var_disk="8"
13+
var_os="debian"
14+
var_version="12"
15+
var_unprivileged="1"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -f /usr/local/bin/atuin ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
# Get latest version from GitHub releases
33+
LATEST_VERSION=$(curl -fsSL https://api.github.com/repos/atuinsh/atuin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
34+
CURRENT_VERSION=$(atuin --version | awk '{print $2}')
35+
36+
if [[ "${LATEST_VERSION}" != "${CURRENT_VERSION}" ]]; then
37+
msg_info "Stopping Atuin Server"
38+
systemctl stop atuin-server
39+
msg_ok "Stopped Atuin Server"
40+
41+
msg_info "Updating $APP to v${LATEST_VERSION}"
42+
# Download and run the official setup script
43+
curl -fsSL https://setup.atuin.sh | sh
44+
# Update the symlink
45+
ln -sf ~/.atuin/bin/atuin /usr/local/bin/atuin
46+
msg_ok "Updated $APP to v${LATEST_VERSION}"
47+
48+
msg_info "Starting Atuin Server"
49+
systemctl start atuin-server
50+
msg_ok "Started Atuin Server"
51+
else
52+
msg_ok "No update required. ${APP} is already at v${CURRENT_VERSION}"
53+
fi
54+
exit
55+
}
56+
57+
start
58+
build_container
59+
description
60+
61+
msg_ok "Completed Successfully!\n"
62+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
63+
echo -e "${INFO}${YW}Your Atuin server is now running at:${CL}"
64+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8888${CL}"
65+
echo -e "${INFO}${YW}To connect clients to this server:${CL}"
66+
echo -e "${TAB}${BYW}atuin settings update sync_address http://${IP}:8888${CL}"
67+
echo -e "${TAB}${BYW}atuin register --username <USERNAME> --password <PASSWORD>${CL}"
68+
echo -e "${INFO}${YW}See ~/atuin-server-info.txt for detailed configuration options.${CL}"

frontend/public/json/atuin.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"name": "Atuin Server",
3+
"slug": "atuin-server",
4+
"categories": [
5+
12,
6+
8
7+
],
8+
"date_created": "2024-06-11",
9+
"type": "ct",
10+
"updateable": true,
11+
"privileged": false,
12+
"interface_port": 8888,
13+
"documentation": "https://docs.atuin.sh/self-hosting/server-setup/",
14+
"website": "https://atuin.sh/",
15+
"logo": "https://raw.githubusercontent.com/atuinsh/atuin/main/assets/logo.png",
16+
"config_path": "/etc/atuin/server.toml",
17+
"description": "Atuin Server provides a self-hosted sync service for the Atuin shell history tool. It stores your shell history in a PostgreSQL database and allows you to securely sync command history across all your devices with end-to-end encryption.",
18+
"install_methods": [
19+
{
20+
"type": "default",
21+
"script": "ct/atuin.sh",
22+
"resources": {
23+
"cpu": 2,
24+
"ram": 2048,
25+
"hdd": 8,
26+
"os": "debian",
27+
"version": "12"
28+
}
29+
}
30+
],
31+
"default_credentials": {
32+
"username": "atuin",
33+
"password": "atuin"
34+
},
35+
"notes": [
36+
{
37+
"text": "PostgreSQL database is configured with username: atuin, password: atuin. Change these for production use.",
38+
"type": "warning"
39+
},
40+
{
41+
"text": "The server listens on port 8888 by default and has open registration enabled.",
42+
"type": "info"
43+
},
44+
{
45+
"text": "To connect clients: atuin settings update sync_address http://<SERVER_IP>:8888",
46+
"type": "info"
47+
},
48+
{
49+
"text": "Users can register with: atuin register --username <USERNAME> --password <PASSWORD>",
50+
"type": "info"
51+
},
52+
{
53+
"text": "Server configuration file is located at: /etc/atuin/server.toml",
54+
"type": "info"
55+
},
56+
{
57+
"text": "For production use, consider setting up TLS by adding the [tls] section to the config file.",
58+
"type": "warning"
59+
},
60+
{
61+
"text": "Restart the server after config changes with: systemctl restart atuin-server",
62+
"type": "info"
63+
},
64+
{
65+
"text": "For client usage instructions, visit: https://docs.atuin.sh/guide/basic-usage/",
66+
"type": "info"
67+
},
68+
{
69+
"text": "View all server logs with: journalctl -u atuin-server",
70+
"type": "info"
71+
},
72+
{
73+
"text": "Change PostgreSQL credentials with: sudo -u postgres psql -c \"ALTER USER atuin WITH PASSWORD 'new_password';\"",
74+
"type": "info"
75+
}
76+
]
77+
}

install/atuin-install.sh

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: j4v3 (j4v3)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/atuinsh/atuin
7+
8+
# Import Functions und Setup
9+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
10+
color
11+
verb_ip6
12+
catch_errors
13+
setting_up_container
14+
network_check
15+
update_os
16+
17+
# Installing Dependencies
18+
msg_info "Installing Dependencies"
19+
$STD apt-get install -y \
20+
curl \
21+
pkg-config \
22+
libssl-dev \
23+
protobuf-compiler \
24+
postgresql \
25+
postgresql-contrib
26+
27+
# Configure PostgreSQL
28+
msg_info "Configuring PostgreSQL"
29+
# Start PostgreSQL service
30+
$STD systemctl start postgresql
31+
$STD systemctl enable postgresql
32+
33+
# Create a database and user for Atuin
34+
$STD sudo -u postgres psql -c "CREATE USER atuin WITH PASSWORD 'atuin';"
35+
$STD sudo -u postgres psql -c "CREATE DATABASE atuin OWNER atuin;"
36+
$STD sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE atuin TO atuin;"
37+
38+
# Allow local connections (no remote PostgreSQL access needed)
39+
$STD sed -i "s/#listen_addresses = 'localhost'/listen_addresses = 'localhost'/g" /etc/postgresql/*/main/postgresql.conf
40+
$STD systemctl restart postgresql
41+
msg_ok "Configured PostgreSQL"
42+
43+
# Install Atuin using the official setup script
44+
msg_info "Installing Atuin"
45+
$STD curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh
46+
47+
# Get the installed version
48+
ATUIN_VERSION=$(~/.atuin/bin/atuin --version | awk '{print $2}')
49+
msg_ok "Installed Atuin v${ATUIN_VERSION}"
50+
51+
# Create a symlink in /usr/local/bin for easy access
52+
msg_info "Creating symlink for global access"
53+
$STD ln -sf ~/.atuin/bin/atuin /usr/local/bin/atuin
54+
msg_ok "Created symlink"
55+
56+
# Setup Atuin Server
57+
msg_info "Setting up Atuin Server"
58+
mkdir -p /etc/atuin/
59+
60+
# Create server configuration
61+
cat <<EOF >/etc/atuin/server.toml
62+
# Atuin server configuration
63+
host = "0.0.0.0"
64+
port = 8888
65+
open_registration = true
66+
db_uri = "postgres://atuin:atuin@localhost/atuin"
67+
EOF
68+
69+
# Create systemd service for Atuin server
70+
cat <<EOF >/etc/systemd/system/atuin-server.service
71+
[Unit]
72+
Description=Atuin sync server
73+
After=network.target postgresql.service
74+
75+
[Service]
76+
Type=simple
77+
ExecStart=/usr/local/bin/atuin server start --config /etc/atuin/server.toml
78+
Restart=always
79+
User=root
80+
81+
[Install]
82+
WantedBy=multi-user.target
83+
EOF
84+
85+
# Enable and start the Atuin server service
86+
$STD systemctl enable atuin-server
87+
$STD systemctl start atuin-server
88+
msg_ok "Setup Atuin Server"
89+
90+
# Enable shell integration for local usage
91+
msg_info "Setting up shell integration"
92+
93+
# For ZSH
94+
if [ -f /bin/zsh ] || [ -f /usr/bin/zsh ]; then
95+
$STD echo 'eval "$(~/.atuin/bin/atuin init zsh)"' >>/etc/zsh/zshrc
96+
fi
97+
98+
# For Bash
99+
if [ -f /bin/bash ] || [ -f /usr/bin/bash ]; then
100+
# Install bash-preexec for bash integration
101+
$STD curl https://raw.githubusercontent.com/rcaloras/bash-preexec/master/bash-preexec.sh -o /etc/bash-preexec.sh
102+
$STD echo '[[ -f /etc/bash-preexec.sh ]] && source /etc/bash-preexec.sh' >>/etc/bash.bashrc
103+
$STD echo 'eval "$(~/.atuin/bin/atuin init bash)"' >>/etc/bash.bashrc
104+
fi
105+
106+
msg_ok "Setup shell integration"
107+
108+
# Create server info file
109+
cat <<EOF >~/atuin-server-info.txt
110+
Atuin Server Information
111+
========================
112+
113+
Server Version: v${ATUIN_VERSION}
114+
Server URL: http://$(hostname -I | awk '{print $1}'):8888
115+
116+
DATABASE CONFIGURATION:
117+
----------------------
118+
PostgreSQL Database: atuin
119+
PostgreSQL User: atuin
120+
PostgreSQL Password: atuin
121+
122+
SERVER CONFIGURATION:
123+
-------------------
124+
Config Location: /etc/atuin/server.toml
125+
Current Settings:
126+
- host = 0.0.0.0 (listens on all interfaces)
127+
- port = 8888
128+
- open_registration = true (new users can register)
129+
- db_uri = postgres://atuin:atuin@localhost/atuin
130+
131+
You can modify these settings in /etc/atuin/server.toml and restart the server:
132+
systemctl restart atuin-server
133+
134+
CONNECTING CLIENTS:
135+
-----------------
136+
On client machines, install Atuin and then run:
137+
138+
1. Configure client to use your server:
139+
atuin settings update sync_address http://$(hostname -I | awk '{print $1}'):8888
140+
141+
2. Register a new account:
142+
atuin register --username <USERNAME> --password <PASSWORD>
143+
144+
3. Or login with existing account:
145+
atuin login --username <USERNAME> --password <PASSWORD>
146+
147+
4. Start syncing:
148+
atuin sync
149+
150+
SECURITY CONSIDERATIONS:
151+
----------------------
152+
- The server has open registration enabled by default
153+
- To disable open registration, set 'open_registration = false' in the config
154+
- Consider setting up TLS for secure connections (see documentation)
155+
- For production environments, consider stronger PostgreSQL credentials
156+
157+
ENABLING TLS:
158+
-----------
159+
To enable TLS, modify /etc/atuin/server.toml to include:
160+
161+
[tls]
162+
enable = true
163+
cert_path = "/path/to/fullchain.pem"
164+
pkey_path = "/path/to/privkey.pem"
165+
166+
For more information, visit: https://docs.atuin.sh/self-hosting/server-setup/
167+
EOF
168+
169+
motd_ssh
170+
customize
171+
172+
# Cleanup
173+
msg_info "Cleaning up"
174+
$STD apt-get -y autoremove
175+
$STD apt-get -y autoclean
176+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)