Skip to content

Commit 27c16be

Browse files
committed
docs: more detailed description
1 parent b5d42e0 commit 27c16be

File tree

2 files changed

+135
-57
lines changed

2 files changed

+135
-57
lines changed

README.md

Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Using one command to start the Syncplay service. Yes, it's very simple.
66

77
```bash
88
> docker run --rm --net=host dnomd343/syncplay
9-
Welcome to Syncplay server, ver. 1.7.0
9+
Welcome to Syncplay server, ver. 1.7.1
1010
```
1111

1212
> Pressing `Ctrl+C` will exit the service.
@@ -26,13 +26,11 @@ You can add more arguments to achieve customization. For example, we require a p
2626
> Note that before pressing Enter, you must execute `docker rm -f syncplay` to remove the original services, otherwise they will conflict.
2727
2828
```bash
29-
docker run -d --net=host \
30-
--restart=always --name=syncplay \
31-
dnomd343/syncplay --disable-chat \
32-
--password=PASSWD --motd='HELLO WORLD'
29+
docker run -d --net=host --restart=always --name=syncplay dnomd343/syncplay \
30+
--disable-chat --password=PASSWD --motd='HELLO WORLD'
3331
```
3432

35-
The server will be restarted when necessary, or the Docker service or Syncplay may need to be updated. Whether it is expected or not, it is necessary to persist Syncplay at this time, which means that the room data will be saved to disk. You need to choose a working directory to save them, such as `/etc/syncplay/` , execute the following command, the data will be saved to the `rooms.db` file.
33+
The server will be restarted when necessary, or the Docker service may need to be updated. Whether it is expected or not, it is necessary to persist Syncplay at this time, which means that the room data will be saved to disk. You need to choose a working directory to save them, such as `/etc/syncplay/` , execute the following command, the data will be saved to the `rooms.db` file.
3634

3735
```bash
3836
docker run -d --net=host \
@@ -41,7 +39,7 @@ docker run -d --net=host \
4139
dnomd343/syncplay --persistent
4240
```
4341

44-
This directory has more uses. For example, adding the `--enable-stats` option will enable the statistics function, and the data will be saved to the file `stats.db` in the directory. You can also create a `config.yml` file in the directory and write the configuration parameters in it, Syncplay will automatically read it when it starts, avoiding the need to type a large number of parameters in the command line.
42+
This directory has more uses. For example, adding the `--enable-stats` option will enable the statistics function, and the data will be saved to the file `stats.db` in the directory. You can also create a `config.yml` file in the directory and write the configuration options in it, Syncplay will automatically read it when it starts, avoiding the need to type a large number of arguments in the command line.
4543

4644
```yaml
4745
# /etc/syncplay/config.yml
@@ -97,7 +95,7 @@ You can customize the Syncplay server by specifying the following command line a
9795

9896
+ `--motd [MESSAGE]` :The welcome text after the user enters the room, not enabled by default.
9997

100-
+ `--salt [SALT]` :A string used to secure passwords (e.g. Rainbow-tables), defaults to empty.
98+
+ `--salt [TEXT]` :A string used to secure passwords (e.g. Rainbow-tables), defaults to empty.
10199

102100
+ `--random-salt` :Use a randomly generated salt value, valid when `--salt` is not specified, not enabled by default.
103101

@@ -113,49 +111,58 @@ You can customize the Syncplay server by specifying the following command line a
113111

114112
+ `--persistent` :Enable room data persistence, the information will be saved to the `rooms.db` file, only valid when `--isolate-rooms` is not specified, not enabled by default.
115113

116-
+ `--max-username [N]` :Maximum length of usernames, default is `150` .
114+
+ `--max-username [NUM]` :Maximum length of usernames, default is `150` .
117115

118-
+ `--max-chat-message [N]` :Maximum length of chat messages, default is `150` .
116+
+ `--max-chat-message [NUM]` :Maximum length of chat messages, default is `150` .
119117

120118
+ `--permanent-rooms [ROOM ...]` :Specifies a list of rooms that will still be listed even if their playlist is empty, only valid when `--persistent` is specified, defaults to empty.
121119

120+
+ `--listen-ipv4` :Customize the listening address of the Syncplay service on the IPv4 network, not enabled by default.
121+
122+
+ `--listen-ipv6` :Customize the listening address of the Syncplay service on the IPv6 network, not enabled by default.
123+
124+
> Only when you specify `--listen-ipv4`, Syncplay will not listen on IPv6 and vice versa. When both are specified, Syncplay will work under dual-stack networking.
125+
122126
You can also use the following command to output help information.
123127

124128
```bash
125129
> docker run --rm syncplay --help
126-
usage: syncplay [-h] [-p PORT] [--password PASSWORD] [--motd MOTD]
127-
[--salt SALT] [--random-salt] [--isolate-rooms]
130+
usage: syncplay [-h] [-p PORT] [--password PASSWD] [--motd MESSAGE]
131+
[--salt TEXT] [--random-salt] [--isolate-rooms]
128132
[--disable-chat] [--disable-ready] [--enable-stats]
129-
[--enable-tls] [--persistent] [--max-username MAX_USERNAME]
130-
[--max-chat-message MAX_CHAT_MESSAGE]
131-
[--permanent-rooms [PERMANENT_ROOMS ...]]
133+
[--enable-tls] [--persistent] [--max-username NUM]
134+
[--max-chat-message NUM] [--permanent-rooms [ROOM ...]]
135+
[--listen-ipv4 INTERFACE] [--listen-ipv6 INTERFACE]
132136
133137
Syncplay Docker Bootstrap
134138
135-
optional arguments:
139+
options:
136140
-h, --help show this help message and exit
137141
-p PORT, --port PORT listen port of syncplay server
138-
--password PASSWORD authentication of syncplay server
139-
--motd MOTD welcome text after the user enters the room
140-
--salt SALT string used to secure passwords
142+
--password PASSWD authentication of syncplay server
143+
--motd MESSAGE welcome text after the user enters the room
144+
--salt TEXT string used to secure passwords
141145
--random-salt use a randomly generated salt value
142146
--isolate-rooms room isolation enabled
143147
--disable-chat disables the chat feature
144148
--disable-ready disables the readiness indicator feature
145149
--enable-stats enable syncplay server statistics
146150
--enable-tls enable tls support of syncplay server
147151
--persistent enables room persistence
148-
--max-username MAX_USERNAME
149-
maximum length of usernames
150-
--max-chat-message MAX_CHAT_MESSAGE
152+
--max-username NUM maximum length of usernames
153+
--max-chat-message NUM
151154
maximum length of chat messages
152-
--permanent-rooms [PERMANENT_ROOMS ...]
155+
--permanent-rooms [ROOM ...]
153156
permanent rooms of syncplay server
157+
--listen-ipv4 INTERFACE
158+
listening address of ipv4
159+
--listen-ipv6 INTERFACE
160+
listening address of ipv6
154161
```
155162

156163
## Configure File
157164

158-
If you configure a lot of options, it will be quite troublesome and error-prone to enter a large number of command line parameters every time you start. At this time, you can write them into the configuration file. Create a `config.yml` file in the working directory. It uses YAML format and supports all parameters in the command line. Syncplay will automatically read and load it when starting, but it should be noted that if the same parameters are specified on the command line, will override the configuration file's options.
165+
If you configure a lot of options, it will be quite troublesome and error-prone to enter a large number of command line arguments every time you start. At this time, you can write them into the configuration file. Create a `config.yml` file in the working directory. It uses YAML format and supports all arguments in the command line. Syncplay will automatically read and load it when starting, but it should be noted that if the same arguments are specified on the command line, will override the configuration file's options.
159166

160167
```yaml
161168
port: 7999
@@ -170,6 +177,8 @@ disable-chat: true
170177
disable-ready: true
171178
max-username: 256
172179
max-chat-message: 2048
180+
listen-ipv4: 127.0.0.1
181+
listen-ipv6: ::1
173182
permanent-rooms:
174183
- ROOM_1
175184
- ROOM_2
@@ -179,6 +188,18 @@ motd: |
179188
More information...
180189
```
181190

191+
## Environment Variables
192+
193+
The Syncplay container also supports configuration through environment variables. It supports three types of fields: numbers, strings, and boolean, this means that `permanent-rooms` is not supported. Environment variables are named in uppercase letters, and `-` is replaced by `_` , boolean values are represented by `ON` or `TRUE`. The following is an example of using environment variables.
194+
195+
```bash
196+
docker run -d --net=host --restart=always --name=syncplay \
197+
--env PORT=7999 --env MOTD=Hello --env DISABLE_READY=ON \
198+
dnomd343/syncplay
199+
```
200+
201+
You may have noticed that we support three configuration methods: command line arguments, configuration file and environment variables. Their priority is from high to low, that is, the command line arguments will override the options of the configuration file, and the configuration file will override the environment variables. You can use them together.
202+
182203
## Docker Compose
183204

184205
Using `docker-compose` to deploy Syncplay is a more elegant way. You need to create a `docker-compose.yml` configuration file and write the following example.
@@ -202,7 +223,7 @@ We save this file in the `/etc/syncplay/` directory. Since a relative path is us
202223
> docker-compose up
203224
Recreating syncplay ... done
204225
Attaching to syncplay
205-
syncplay | Welcome to Syncplay server, ver. 1.7.0
226+
syncplay | Welcome to Syncplay server, ver. 1.7.1
206227
```
207228

208229
> Adding the `-d` option allows the service to run in the background.
@@ -215,12 +236,30 @@ If you encounter any errors, please first use the `docker logs syncplay` command
215236

216237
```bash
217238
> docker run --rm --env DEBUG=ON dnomd343/syncplay
218-
Command line arguments -> Namespace(port=None, password=None, motd=None, salt=None, random_salt=False, isolate_rooms=False, disable_chat=False, disable_ready=False, enable_stats=False, enable_tls=False, persistent=False, max_username=None, max_chat_message=None, permanent_rooms=None)
219-
Parsed arguments -> {}
239+
Bootstrap options -> [('port', <class 'int'>, False), ('password', <class 'str'>, False), ('motd', <class 'str'>, False), ('salt', <class 'str'>, False), ('random_salt', <class 'bool'>, False), ('isolate_rooms', <class 'bool'>, False), ('disable_chat', <class 'bool'>, False), ('disable_ready', <class 'bool'>, False), ('enable_stats', <class 'bool'>, False), ('enable_tls', <class 'bool'>, False), ('persistent', <class 'bool'>, False), ('max_username', <class 'int'>, False), ('max_chat_message', <class 'int'>, False), ('permanent_rooms', <class 'str'>, True), ('listen_ipv4', <class 'str'>, False), ('listen_ipv6', <class 'str'>, False)]
240+
Environment variables -> environ({'PATH': '/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOSTNAME': '0a28a2e2ea50', 'DEBUG': 'ON', 'LANG': 'C.UTF-8', 'GPG_KEY': 'A035C8C19219BA821ECEA86B64E628F8D684696D', 'PYTHON_VERSION': '3.10.13', 'PYTHON_PIP_VERSION': '23.0.1', 'PYTHON_SETUPTOOLS_VERSION': '65.5.1', 'PYTHON_GET_PIP_URL': 'https://github.com/pypa/get-pip/raw/4cfa4081d27285bda1220a62a5ebf5b4bd749cdb/public/get-pip.py', 'PYTHON_GET_PIP_SHA256': '9cc01665956d22b3bf057ae8287b035827bfd895da235bcea200ab3b811790b6', 'PYTHONUNBUFFERED': '1', 'HOME': '/root'})
241+
Environment options -> {}
242+
Configure file -> {}
243+
Configure file options -> {}
244+
Command line arguments -> Namespace(port=None, password=None, motd=None, salt=None, random_salt=False, isolate_rooms=False, disable_chat=False, disable_ready=False, enable_stats=False, enable_tls=False, persistent=False, max_username=None, max_chat_message=None, permanent_rooms=None, listen_ipv4=None, listen_ipv6=None)
245+
Command line options -> {}
246+
Bootstrap final options -> {}
220247
Syncplay startup arguments -> ['--port', '8999', '--salt', '']
221-
Welcome to Syncplay server, ver. 1.7.0
248+
Welcome to Syncplay server, ver. 1.7.1
222249
```
223250

251+
## Advanced
252+
253+
For some reason, you may need to change the path of the configuration files or working directory. This is possible in the Syncplay container, which requires you to specify it using environment variables.
254+
255+
+ `TEMP_DIR` :Temporary directory, it does not need to be persisted, defaults to `/tmp/`
256+
257+
+ `WORK_DIR` :The working directory, which stores data related to Syncplay, defaults to `/data/`
258+
259+
+ `CERT_DIR` :Certificate directory, which is used to store TLS certificates and private key files, defaults to `/certs/`
260+
261+
+ `CONFIG` :Configuration file, which defines the YAML configuration read by the bootstrap script, defaults to `config.yml`
262+
224263
## Build Image
225264

226265
You can build an image directly from the source code using the following command.
@@ -248,4 +287,4 @@ docker buildx build -t dnomd343/syncplay \
248287

249288
## License
250289

251-
MIT ©2022 [@dnomd343](https://github.com/dnomd343)
290+
MIT ©2023 [@dnomd343](https://github.com/dnomd343)

0 commit comments

Comments
 (0)