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.
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.
```bash
```bash
docker run -d --net=host \
docker run -d --net=host \
@ -41,7 +39,7 @@ docker run -d --net=host \
dnomd343/syncplay --persistent
dnomd343/syncplay --persistent
```
```
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.
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.
```yaml
```yaml
# /etc/syncplay/config.yml
# /etc/syncplay/config.yml
@ -97,7 +95,7 @@ You can customize the Syncplay server by specifying the following command line a
+ `--motd [MESSAGE]` :The welcome text after the user enters the room, not enabled by default.
+ `--motd [MESSAGE]` :The welcome text after the user enters the room, not enabled by default.
+ `--salt [SALT]` :A string used to secure passwords (e.g. Rainbow-tables), defaults to empty.
+ `--salt [TEXT]` :A string used to secure passwords (e.g. Rainbow-tables), defaults to empty.
+ `--random-salt` :Use a randomly generated salt value, valid when `--salt` is not specified, not enabled by default.
+ `--random-salt` :Use a randomly generated salt value, valid when `--salt` is not specified, not enabled by default.
@ -113,31 +111,37 @@ You can customize the Syncplay server by specifying the following command line a
+ `--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.
+ `--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.
+ `--max-username [N]` :Maximum length of usernames, default is `150` .
+ `--max-username [NUM]` :Maximum length of usernames, default is `150` .
+ `--max-chat-message [N]` :Maximum length of chat messages, default is `150` .
+ `--max-chat-message [NUM]` :Maximum length of chat messages, default is `150` .
+ `--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.
+ `--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.
+ `--listen-ipv4` :Customize the listening address of the Syncplay service on the IPv4 network, not enabled by default.
+ `--listen-ipv6` :Customize the listening address of the Syncplay service on the IPv6 network, not enabled by default.
> 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.
You can also use the following command to output help information.
You can also use the following command to output help information.
-p PORT, --port PORT listen port of syncplay server
-p PORT, --port PORT listen port of syncplay server
--password PASSWORD authentication of syncplay server
--password PASSWD authentication of syncplay server
--motd MOTD welcome text after the user enters the room
--motd MESSAGE welcome text after the user enters the room
--salt SALT string used to secure passwords
--salt TEXT string used to secure passwords
--random-salt use a randomly generated salt value
--random-salt use a randomly generated salt value
--isolate-rooms room isolation enabled
--isolate-rooms room isolation enabled
--disable-chat disables the chat feature
--disable-chat disables the chat feature
@ -145,17 +149,20 @@ optional arguments:
--enable-stats enable syncplay server statistics
--enable-stats enable syncplay server statistics
--enable-tls enable tls support of syncplay server
--enable-tls enable tls support of syncplay server
--persistent enables room persistence
--persistent enables room persistence
--max-username MAX_USERNAME
--max-username NUM maximum length of usernames
maximum length of usernames
--max-chat-message NUM
--max-chat-message MAX_CHAT_MESSAGE
maximum length of chat messages
maximum length of chat messages
--permanent-rooms [PERMANENT_ROOMS ...]
--permanent-rooms [ROOM ...]
permanent rooms of syncplay server
permanent rooms of syncplay server
--listen-ipv4 INTERFACE
listening address of ipv4
--listen-ipv6 INTERFACE
listening address of ipv6
```
```
## Configure File
## Configure File
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.
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.
```yaml
```yaml
port: 7999
port: 7999
@ -170,6 +177,8 @@ disable-chat: true
disable-ready: true
disable-ready: true
max-username: 256
max-username: 256
max-chat-message: 2048
max-chat-message: 2048
listen-ipv4: 127.0.0.1
listen-ipv6: ::1
permanent-rooms:
permanent-rooms:
- ROOM_1
- ROOM_1
- ROOM_2
- ROOM_2
@ -179,6 +188,18 @@ motd: |
More information...
More information...
```
```
## Environment Variables
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.
```bash
docker run -d --net=host --restart=always --name=syncplay \
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.
## Docker Compose
## Docker Compose
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.
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
> docker-compose up
> docker-compose up
Recreating syncplay ... done
Recreating syncplay ... done
Attaching to syncplay
Attaching to syncplay
syncplay | Welcome to Syncplay server, ver. 1.7.0
syncplay | Welcome to Syncplay server, ver. 1.7.1
```
```
> Adding the `-d` option allows the service to run in the background.
> 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
```bash
```bash
> docker run --rm --env DEBUG=ON dnomd343/syncplay
> docker run --rm --env DEBUG=ON dnomd343/syncplay
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.
+ `TEMP_DIR` :Temporary directory, it does not need to be persisted, defaults to `/tmp/`
+ `WORK_DIR` :The working directory, which stores data related to Syncplay, defaults to `/data/`
+ `CERT_DIR` :Certificate directory, which is used to store TLS certificates and private key files, defaults to `/certs/`
+ `CONFIG` :Configuration file, which defines the YAML configuration read by the bootstrap script, defaults to `config.yml`
## Build Image
## Build Image
You can build an image directly from the source code using the following command.
You can build an image directly from the source code using the following command.