]>
Commit | Line | Data |
---|---|---|
4fa4a57c | 1 | <!--<picture> |
a3ca1960 | 2 | <source media="(prefers-color-scheme: dark)" srcset="dark_logo.png"> |
3 | <source media="(prefers-color-scheme: light)" srcset="light_logo.png"> | |
4fad3266 | 4 | <img src="dark_logo.png" alt="Mobius Logo"> |
6e16e926 | 5 | </picture> |
4fa4a57c | 6 | --> |
6e16e926 | 7 | |
7bd6f5ad RBR |
8 | # Mobius (Friendship Quest Remix) |
9 | ||
10 | A fork of [mobius](https://github.com/jhalter/mobius) with some extra features: | |
11 | ||
12 | 1. If you have upload permission, you get your own `~` folder. | |
13 | ||
6988a057 JH |
14 | # Mobius |
15 | ||
4954caf8 | 16 | Mobius is a cross-platform command line [Hotline](https://en.wikipedia.org/wiki/Hotline_Communications) server implemented in Golang. |
6988a057 | 17 | |
4954caf8 | 18 | - **Project Goal:** Make it simple to run a Hotline server on macOS, Linux, and Windows, with full compatibility for all popular Hotline clients. |
6988a057 | 19 | |
6988a057 | 20 | |
4fa4a57c JH |
21 | ## Installation |
22 | ||
23 | Mobius is distributed through a single binary. | |
24 | ||
25 | Depending on your platform and preferences, you can acquire the binary in the following ways: | |
26 | ||
27 | ### Build from source | |
28 | ||
29 | 1. Install [Go](https://go.dev) if needed | |
30 | 2. Run `make server` | |
31 | ||
32 | ### Download pre-built release | |
33 | ||
34 | See [Releases](https://github.com/jhalter/mobius/releases) page. | |
35 | ||
69fceb2e | 36 | |
2a46179f JH |
37 | ### Docker |
38 | ||
4fa4a57c | 39 | To run a Hotline server with a default, sample configuration with ports forwarded from the host OS to the container: |
d4207f0d JH |
40 | |
41 | docker run --rm -p 5500:5500 -p 5501:5501 ghcr.io/jhalter/mobius:latest | |
2a46179f | 42 | |
d4207f0d | 43 | You can now connect to localhost:5500 with your favorite Hotline client and play around, but all changes will be lost on container restart. |
2a46179f | 44 | |
d4207f0d | 45 | To serve files from the host OS and persist configuration changes, you'll want to set up a [bind mount](https://docs.docker.com/storage/bind-mounts/) that maps a directory from the host into the container. |
2a46179f | 46 | |
4fa4a57c JH |
47 | To do this, create a directory in a location of your choice on the host OS. For clarity, we'll assign the path to the `HLFILES` environment variable and re-use it. |
48 | ||
49 | Then run the docker command with `-v` and `-init` like so: | |
69fceb2e | 50 | |
d4207f0d JH |
51 | ``` |
52 | export HLFILES=/home/myuser/hotline-files | |
53 | mdkir $HLFILES | |
54 | ||
55 | sudo docker run \ | |
56 | --pull=always \ | |
57 | --rm \ | |
58 | -p 5500:5500 \ | |
59 | -p 5501:5501 \ | |
60 | -v $HLFILES:/usr/local/var/mobius/config \ | |
3e4a52ed | 61 | ghcr.io/jhalter/mobius-hotline-server:latest \ |
d4207f0d JH |
62 | -init |
63 | ``` | |
64 | ||
65 | It's a good security practice to run your server as a non-root user, which also happens to make editing the configuration files easier from the host OS. | |
66 | ||
67 | To do this, add the `--user` flag to the docker run arguments with a user ID and group ID of a user on the host OS. | |
68 | ||
69 | `--user 1001:1001` | |
69fceb2e | 70 | |
4fa4a57c JH |
71 | ### Homebrew |
72 | ||
73 | For macOS the easiest path to installation is through Homebrew, as this works around Apple's notarization requirements for downloaded pre-compiled binaries by compiling the binary on your system during brew installation. | |
74 | ||
75 | To install the server: | |
76 | ||
77 | brew install jhalter/mobius-hotline-server/mobius-hotline-server | |
78 | ||
79 | After installation `mobius-hotline-server` will be installed at `$HOMEBREW_PREFIX/bin/mobius-hotline-server` and should be in your $PATH. | |
80 | ||
81 | The server config directory will be created under `$HOMEBREW_PREFIX/var/mobius`. | |
82 | ||
83 | To start the service: | |
84 | ||
85 | `brew services start mobius-hotline-server` | |
86 | ||
87 | ||
88 | ## Server Configuration | |
89 | ||
90 | After you have a server binary, the next step is to configure the server. | |
91 | ||
92 | ### Configuration directory | |
93 | ||
94 | Mobius stores its configuration and server state in a directory tree: | |
2a46179f JH |
95 | |
96 | ``` | |
4fa4a57c JH |
97 | config |
98 | ├── Agreement.txt | |
99 | ├── Files | |
100 | │ └── hello.txt | |
101 | ├── MessageBoard.txt | |
102 | ├── ThreadedNews.yaml | |
103 | ├── Users | |
104 | │ ├── admin.yaml | |
105 | │ └── guest.yaml | |
106 | ├── banner.jpg | |
107 | └── config.yaml | |
2a46179f JH |
108 | ``` |
109 | ||
4fa4a57c | 110 | If you acquired the server binary by downloading it or compiling it, this directory doesn't exist yet! But you can generate it by running the the server with the `-init` flag: |
69fceb2e | 111 | |
4fa4a57c | 112 | `./mobius-hotline-server -init -config example-config-dir` |
69fceb2e | 113 | |
4fa4a57c | 114 | Brew users can find the config directory in `$HOMEBREW_PREFIX/var/mobius`. |
6988a057 | 115 | |
4fa4a57c | 116 | Within this directory some files are intended to be edited to customize the server, while others are not. |
6988a057 | 117 | |
4fa4a57c | 118 | --- |
69fceb2e | 119 | |
4fa4a57c JH |
120 | * 🛠️ Edit this file to customize your server. |
121 | * ⚠️ Avoid manual edits outside of special circumstances (e.g. remove offending news content). | |
69fceb2e | 122 | |
4fa4a57c | 123 | --- |
69fceb2e | 124 | |
4fa4a57c | 125 | 🛠️ `Agreement.text` - The server agreement sent to users after they join the server. |
6988a057 | 126 | |
4fa4a57c | 127 | 🛠️ `Files` - Home of your warez or any other files you'd like to share. |
2a46179f | 128 | |
4fa4a57c | 129 | ⚠️ `MessageBoard.txt` - Plain text file containing the server's message board. No need to edit this. |
6988a057 | 130 | |
4fa4a57c | 131 | ⚠️ `ThreadedNews.yaml` - YAML file containing the server's threaded news. No need to edit this. |
69fceb2e | 132 | |
4fa4a57c | 133 | ⚠️ `Users` - Directory containing user account YAML files. No need to edit this. |
69fceb2e | 134 | |
4fa4a57c | 135 | 🛠️ `banner.jpg` - Path to server banner image. |
69fceb2e | 136 | |
4fa4a57c | 137 | 🛠️ `config.yaml` - Edit to set your server name, description, and enable tracker registration. |
69fceb2e | 138 | |
69fceb2e | 139 | |
4fa4a57c | 140 | ### User accounts |
69fceb2e | 141 | |
4fa4a57c | 142 | The default installation includes two users: |
6988a057 | 143 | |
4fa4a57c JH |
144 | * guest (no password) |
145 | * admin (default password admin). | |
6988a057 | 146 | |
4fa4a57c | 147 | User administration should be performed from a Hotline client. Avoid editing the files under the `Users` directory. |
6988a057 | 148 | |
4fa4a57c | 149 | ## Run the server |
6988a057 | 150 | |
4fa4a57c JH |
151 | By default running `mobius-hotline-server` will listen on ports 5500/5501 of all interfaces with info level logging to STDOUT. |
152 | ||
153 | Use the -h or -help flag for a list of options: | |
154 | ||
155 | ``` | |
156 | $ mobius-hotline-server -h | |
157 | Usage of mobius-hotline-server: | |
158 | -bind int | |
159 | Base Hotline server port. File transfer port is base port + 1. (default 5500) | |
160 | -config string | |
161 | Path to config root (default "/usr/local/var/mobius/config/") | |
162 | -init | |
163 | Populate the config dir with default configuration | |
164 | -interface string | |
165 | IP addr of interface to listen on. Defaults to all interfaces. | |
166 | -log-file string | |
167 | Path to log file | |
168 | -log-level string | |
169 | Log level (default "info") | |
170 | -stats-port string | |
171 | Enable stats HTTP endpoint on address and port | |
172 | -version | |
173 | Print version and exit | |
174 | ``` | |
6988a057 | 175 | |
6988a057 | 176 | |
4fa4a57c | 177 | To run as a systemd service, refer to this sample unit file: [mobius-hotline-server.service](https://github.com/jhalter/mobius/blob/master/cmd/mobius-hotline-server/mobius-hotline-server.service) |
2a46179f | 178 | |
b6e3be94 JH |
179 | ## (Optional) HTTP API |
180 | ||
181 | The Mobius server includes an optional HTTP API to perform out-of-band administrative functions. | |
182 | ||
f428cd7b | 183 | To enable it, include the `--api-addr` flag with a string defining the IP and port to listen on in the form of `<ip>:<port>`. |
b6e3be94 | 184 | |
f428cd7b | 185 | Example: `--api-addr=127.0.0.1:5503` |
b6e3be94 JH |
186 | |
187 | ⚠️ The API has no authentication, so binding it to localhost is a good idea! | |
188 | ||
189 | #### GET /api/v1/stats | |
190 | ||
191 | The stats endpoint returns server runtime statistics and counters. | |
192 | ||
193 | ``` | |
335f5eb5 | 194 | ❯ curl -s localhost:5503/api/v1/stats | jq . |
b6e3be94 JH |
195 | { |
196 | "ConnectionCounter": 0, | |
197 | "ConnectionPeak": 0, | |
198 | "CurrentlyConnected": 0, | |
199 | "DownloadCounter": 0, | |
200 | "DownloadsInProgress": 0, | |
201 | "Since": "2024-07-18T15:36:42.426156-07:00", | |
202 | "UploadCounter": 0, | |
203 | "UploadsInProgress": 0, | |
204 | "WaitingDownloads": 0 | |
205 | } | |
206 | ``` | |
207 | ||
208 | #### GET /api/v1/reload | |
209 | ||
210 | The reload endpoint reloads the following configuration files from disk: | |
211 | ||
212 | * Agreement.txt | |
213 | * News.txt | |
214 | * Users/*.yaml | |
215 | * ThreadedNews.yaml | |
216 | * banner.jpg | |
217 | ||
218 | Example: | |
219 | ||
220 | ``` | |
335f5eb5 | 221 | ❯ curl -s localhost:5503/api/v1/reload | jq . |
b6e3be94 JH |
222 | { |
223 | "msg": "config reloaded" | |
224 | } | |
225 | ``` | |
226 | ||
227 | #### POST /api/v1/shutdown | |
228 | ||
229 | The shutdown endpoint accepts a shutdown message from POST payload, sends it to to all connected Hotline clients, then gracefully shuts down the server. | |
230 | ||
231 | Example: | |
232 | ||
233 | ``` | |
335f5eb5 | 234 | ❯ curl -d 'Server rebooting' localhost:5503/api/v1/shutdown |
b6e3be94 JH |
235 | |
236 | { "msg": "server shutting down" } | |
4954caf8 | 237 | ``` |