aboutsummarylogtreecommitdiffstats
path: root/README.md
blob: a3b1924b90ade6eb46bc0e514c553ad20241eb3b (plain)
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
# astrbot-git

Arch Linux AUR package for [AstrBot](https://github.com/AstrBotDevs/AstrBot).

This package installs the upstream `master` branch under `/opt/astrbot` and provides
`astrbotctl` plus a systemd template unit for multi-instance deployments.

## Install

```bash
paru -S astrbot-git
```

## Quick Start

```bash
sudo astrbotctl init bot1
sudo systemctl enable --now astrbot@bot1
astrbotctl status bot1
```

The instance config is written to `/etc/astrbot/bot1.conf`. Runtime data and the
instance virtualenv live under `/var/lib/astrbot/bot1`.

The dashboard port is allocated during `init` and stored in the instance config:

```bash
grep '^ASTRBOT_PORT=' /etc/astrbot/bot1.conf
```

Then open:

```text
http://localhost:<port>
```

## Common Commands

```bash
astrbotctl ls
sudo astrbotctl start bot1
sudo astrbotctl stop bot1
sudo astrbotctl restart bot1
astrbotctl paths bot1
```

Run AstrBot commands inside an instance:

```bash
astrbotctl cli bot1 plug list
astrbotctl cli bot1 plug install <plugin_repo>
```

Run an instance in the foreground for debugging:

```bash
sudo astrbotctl run bot1
```

This uses the instance environment and ultimately runs AstrBot's `astrbot run`
command from `/var/lib/astrbot/bot1/.venv`.

Manage dashboard credentials:

```bash
sudo astrbotctl admin -u admin -p 'new-password' bot1
```

Back up and restore:

```bash
astrbotctl export bot1
astrbotctl import bot1 /path/to/backup.zip
```

Refresh an instance virtualenv after a package upgrade:

```bash
sudo astrbotctl sync bot1
sudo astrbotctl sync --all
```

## HTTPS

`certbot` is optional. Install it before using the helper:

```bash
sudo pacman -S certbot
sudo astrbotctl certbot bot1
```

## Paths

| Path | Purpose |
| --- | --- |
| `/opt/astrbot` | Packaged upstream source |
| `/usr/bin/astrbotctl` | Management command |
| `/usr/lib/systemd/system/astrbot@.service` | Instance service template |
| `/etc/astrbot/<name>.conf` | Instance config |
| `/var/lib/astrbot/<name>` | Instance data and virtualenv |
| `/var/cache/astrbot` | Shared package/runtime cache |

## Troubleshooting

Follow logs:

```bash
journalctl -u astrbot@bot1 -f
```

Remove a stale runtime lock:

```bash
sudo rm -f /var/lib/astrbot/bot1/astrbot.lock
```

If a service fails with `ζƒι™δΈε€Ÿ` for files under `/var/lib/astrbot/<name>`,
fix ownership:

```bash
sudo chown -R astrbot:astrbot /var/lib/astrbot/bot1
```

If startup reports that the dashboard port is already in use, find and stop the
old foreground process before starting the systemd service:

```bash
sudo ss -lntp | grep ':<port>'
sudo kill <pid>
sudo systemctl restart astrbot@bot1
```

Force a virtualenv rebuild:

```bash
sudo rm -rf /var/lib/astrbot/bot1/.venv
sudo systemctl restart astrbot@bot1
```

## Packaging

Local package maintenance helper:

```bash
./update.sh
```

Before publishing, regenerate `.SRCINFO`:

```bash
makepkg --printsrcinfo > .SRCINFO
```