mirror of
https://github.com/yanhao98/docker-example.git
synced 2025-07-12 23:50:49 +08:00
unicloud-unison
This commit is contained in:
3
stacks/unicloud-unison/README.md
Normal file
3
stacks/unicloud-unison/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# [unicloud](https://github.com/agarbato/unicloud) is a web interface to unison.
|
||||
|
||||
[play-with-docker](./play-with-docker.md)
|
89
stacks/unicloud-unison/play-with-docker.md
Normal file
89
stacks/unicloud-unison/play-with-docker.md
Normal file
@ -0,0 +1,89 @@
|
||||
# unicloud
|
||||
[Unison](https://github.com/bcpierce00/unison/wiki/Software-for-use-with-Unison#web-interfaces) file sync web interface
|
||||
|
||||
## 准备
|
||||
1. 进入 https://labs.play-with-docker.com
|
||||
2. Add new instance 两个
|
||||
3. docker pull agarbato1/unison-unicloud:2.53.4
|
||||
|
||||
## Server
|
||||
|
||||
### 启动服务
|
||||
```bash
|
||||
cd ~
|
||||
rm -rf data shares
|
||||
mkdir -p data shares
|
||||
chown -R 1000:1000 data
|
||||
chmod 777 shares
|
||||
docker run -d --name server \
|
||||
--network host \
|
||||
-e SERVER_DEBUG=True \
|
||||
-e SERVER_UI_USERNAME=admin \
|
||||
-e SERVER_UI_PASSWORD= \
|
||||
-e ROLE=SERVER \
|
||||
--mount type=bind,source=./data,target=/data \
|
||||
--mount type=bind,source=./shares,target=/shares \
|
||||
agarbato1/unison-unicloud:2.53.4 \
|
||||
bash -c "echo 'Port 2222' >> /etc/sshd_config_debug && exec python3 -u start.py"
|
||||
```
|
||||
|
||||
|
||||
<details>
|
||||
<summary>检查连接和配置</summary>
|
||||
|
||||
#### 检查是否能ping通client
|
||||
```bash
|
||||
CLIENT_IP="192.168.0.17"
|
||||
docker exec -it server ping -c 1 $CLIENT_IP
|
||||
```
|
||||
#### 检查sshd配置
|
||||
```bash
|
||||
docker exec -it server cat /etc/sshd_config_debug
|
||||
```
|
||||
#### 查看sshd日志
|
||||
```bash
|
||||
cat ~/data/log/sshd.log
|
||||
```
|
||||
</details>
|
||||
|
||||
|
||||
### 添加 share1
|
||||
在`labs`点`Open Port`打开 80 端口,跳转后打开 http://ip172-18-0-23-csabksol2o90009mnang-80.direct.labs.play-with-docker.com`/shares`
|
||||
|
||||
|
||||
## Client
|
||||
```bash
|
||||
curl 192.168.0.18:80/status -v
|
||||
|
||||
cd ~
|
||||
rm -rf data share
|
||||
mkdir -p data share
|
||||
chmod 777 data share
|
||||
docker run -d --name client1 \
|
||||
--restart on-failure \
|
||||
--network host \
|
||||
-e CLIENT_HOSTNAME=client_hostname \
|
||||
-e ROLE=CLIENT \
|
||||
-e SERVER_HOSTNAME=192.168.0.18 \
|
||||
-e SERVER_PORT=2222 \
|
||||
-e SERVER_SHARE=share1 \
|
||||
-e API_PROTOCOL=http \
|
||||
-e API_PORT=80 \
|
||||
-e SYNC_INTERVAL=15 \
|
||||
--mount type=bind,source=./data,target=/data \
|
||||
-e CLIENT_DEST=/share \
|
||||
--mount type=bind,source=./share,target=/share \
|
||||
agarbato1/unison-unicloud:2.53.4
|
||||
docker logs -f client1
|
||||
```
|
||||
|
||||
### 激活
|
||||
|
||||
进 http://ip172-18-0-23-csabksol2o90009mnang-80.direct.labs.play-with-docker.com/`clients`,点击`ACTIVATE`
|
||||
|
||||
|
||||
## 测试同步
|
||||
```bash
|
||||
docker exec -it client1 touch /share/$(date +%s).txt
|
||||
docker exec -it server ls /shares/share1
|
||||
```
|
Reference in New Issue
Block a user