Deploying a Native Syncplay Server on Ubuntu in 10 Minutes
本文最后更新于 608 天前,其中的信息可能已经有所发展或是发生改变。

Syncplay is a tool that synchronizes the progress of media players, which means you no longer need to shout "3…2…1…" with your friends and family every time you pause a movie. The client is installed on your local computer, while the server needs to be installed on a device with a public IP address, usually a Linux system server. The usage process of the client can be seen in a previous article.

In fact, from a functional point of view, there is little need for self-deployment. As a benevolent dictator, I will maintain it as long as it is needed:

  • Server address: 82.157.53.75:8999
  • Server password: vfly2

The process of deploying the Syncplay server is not complicated. The official public servers are located in France, and the delay is high, and sometimes they cannot be connected, so friends who are interested in self-deployment can give it a try.
This tutorial has been tested on Ubuntu20.04LTS. Using the Syncplay Client, our articles on this site may be helpful to you as well: Three Ways to Watch Movies Remotely in Sync – 承飞之咎 (vfly2.com)

If your server can connect to GitHub smoothly, the following is only a 10-minute process. Copy-style tutorial.


Preparation

Using the root user will be more convenient. The following process is performed with the root user.
Environment requirements:

  1. Git is used to download source code
  2. Python 3.4.x or higher version, python3-twisted package is used to execute source code
  3. Unblock the corresponding port. The default port of the server is 8999, but it can also be customized

One line of code deploys the environment:

sudo apt -y install python3 python3-twisted git

Create User and Install Source Code

Create a system user, syncplay, to run syncplay-server (existing users can also run it)

sudo adduser --disabled-login syncplay

Fill in the information as prompted, press Enter for all, and finally enter y and press Enter to confirm.

Enter the syncplay home directory and pull the source code

cd /home/syncplay && git clone https://github.com/Syncplay/syncplay.git

If the server is located in China and cannot be downloaded due to network reasons, you can download it locally using a proxy and then transfer it to the server, or use a website proxy, or wait for the network to recover.

Set the owner of the file to syncplay:syncplay

sudo chown -R syncplay:syncplay syncplay/

Start Syncplay Server

Enter the syncplay directory and run syncplayServer.py

cd syncplay
./syncplayServer.py

You should see the following output

Welcome to Syncplay server, ver. 1.6.6
PLEASE NOTE: To allow room operator passwords generated by this server instance to still work when the server is restarted, please add the following command line argument when running the Syncplay server in the future: --salt NIJGVMHKOC

This indicates that the server is running normally. At this point, it can actually be used: no password, default port 8999, and domain name or IP address can be used as the address (it is recommended to test the connection with the client at this time to ensure that the connection is normal). But this is too rough.
Press Ctrl + C to stop running.

You can record a string of letters after --salt, which is used to encrypt plain text and can improve security.

Run with custom parameters: password, port, key

./syncplayServer.py --password myPassword --port 4567 --salt WCRKULYHPV

More custom parameters are here: https://syncplay.pl/guide/server/, which I will also put at the end of the article.

At this point, if you use nohup or screen to run Syncplay in the background, you can barely use it, but there is a better way to manage it!
If you don’t want to toss it, you can leave and test the synchronization effect.


Configure systemctl Service File

sudo vim /lib/systemd/system/syncplay.service

Fill in the service file
If you have followed the above process completely, you only need to customize a few parameters of --salt NIJGVMHKOC --port 4567 --password myPassword and use the previously recorded --salt. You can also customize more parameters.

[Unit]
Description=Syncplay Server
After=network.target

[Service]
WorkingDirectory=/home/syncplay/syncplay
User=syncplay
Group=syncplay
Type=simple
ExecStart=/home/syncplay/syncplay/syncplayServer.py --salt WCRKULYHPV --port 4567 --password myPassword
ExecStop=/bin/kill -s HUP $MAINPID
PIDFile=/home/syncplay/syncplay/syncplay.pid
RestartSec=15
Restart=always

[Install]
WantedBy=multi-user.target

Save and exit, then type

systemctl daemon-reload
systemctl enable --now syncplay

This will enable Syncplay to start automatically on boot and run immediately. Use systemctl status syncplay to check the status.

At this point, everything is complete. If you want to learn more, you can visit the official website: https://syncplay.pl/guide/.
Now you can disconnect from the server and enjoy remote synchronized movie watching with friends and family!


Server command-line switches (Syncplay 1.5.2+)

  • --port [port] – Use stated port instead of the default one.
  • --isolate-room – If specified then ‘room isolation’ is enabled. This means that viewers will not be able to see information about users who are in rooms other than the one they are in. This feature is recommended for a public server, but not for a small private server.
  • --password [password] – Restrict access to the Syncplay server to only those who use this password when they connect to the server. This feature is recommended for a private server but is not needed for a public server. By default the password is blank (i.e. there is no password restriction). DO NOT USE A PASSWORD THAT YOU USE ANYWHERE ELSE! You can also specify this value via the SYNCPLAY_PASSWORD environmental variable.
  • MARKDOWN_HASH95bbdcfb79634bfa11230a9c9d2c3db9MARKDOWNHASH  – Random [salt](http://en.wikipedia.org/wiki/Salt%28cryptography%29) string used to generate controlled room passwords – needs to be the same for controlled room passwords to work between server instances. You can also specify this value via the SYNCPLAY_SALT environmental variable.
  • --motd-file [filepath] – Path to file from which motd will be fetched
  • --disable-ready – Disables the readiness indicator feature
  • --disable-chat – Disables the chat feature
  • --max-chat-message-length – Maximum length of chat messages (number of characters)
  • --max-username-length – Maximum length of usernames (number of characters)
  • --stats-db-file [filepath]  – Enable server stats using the SQLite db file provided
  • --tls [path] – Enable TLS using certificates at the specified path. See the Syncplay TLS guide for more instructions. This feature is only available in  Syncplay >= 1.6.3.

Official Website: Running a server – Syncplay

Docker Deployment

Using Docker is much easier, and the following is recommended.
Docker: ninetaillabs/syncplay-server – Docker Image | Docker Hub

No Comments

Send Comment Edit Comment


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
Previous