mirror of
https://github.com/yanhao98/docker-example.git
synced 2025-07-13 08:00:49 +08:00
use-dive use-slim
This commit is contained in:
57
compose/duplicati/README.md
Normal file
57
compose/duplicati/README.md
Normal file
@ -0,0 +1,57 @@
|
||||
# Duplicati
|
||||
- https://github.com/linuxserver/docker-duplicati
|
||||
- https://github.com/duplicati/duplicati/blob/master/ReleaseBuilder/Resources/Docker/README.md
|
||||
|
||||
```bash
|
||||
docker run --rm -it --entrypoint bash duplicati/duplicati:canary
|
||||
/opt/duplicati/duplicati-cli help
|
||||
```
|
||||
|
||||
## 启动
|
||||
```bash
|
||||
DUPLICATI_DOMAIN=❗️❗️❗️
|
||||
DUPLICATI_PASSWORD=❗️❗️❗️
|
||||
docker run -d -p 8500:8200 --restart unless-stopped --name duplicati_canary \
|
||||
-v duplicati-data:/data \
|
||||
--mount type=bind,source=~/_docker-stacks,target/_docker-stacks \
|
||||
-e "TZ=Asia/Shanghai" \
|
||||
-e "DUPLICATI__WEBSERVICE_ALLOWED_HOSTNAMES=$DUPLICATI_DOMAIN" \
|
||||
-e "DUPLICATI__WEBSERVICE_PASSWORD=$DUPLICATI_PASSWORD" \
|
||||
duplicati/duplicati:canary
|
||||
docker logs -f duplicati_canary
|
||||
```
|
||||
|
||||
## 访问
|
||||
```bash
|
||||
DUPLICATI_DOMAIN=$(docker inspect duplicati_canary | grep DUPLICATI__WEBSERVICE_ALLOWED_HOSTNAMES | awk -F '=' '{gsub(/",$/, "", $2); print $2}');
|
||||
DUPLICATI_PASSWORD=$(docker inspect duplicati_canary | grep DUPLICATI__WEBSERVICE_PASSWORD | awk -F '=' '{gsub(/",$/, "", $2); print $2}');
|
||||
URL="$DUPLICATI_DOMAIN:8500/login.html?password=$DUPLICATI_PASSWORD";
|
||||
echo "🌐http://"
|
||||
echo "$URL";
|
||||
echo "🌐";
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
`:8500/ngax/index.html#/settings`
|
||||
|
||||
```ini
|
||||
--machine-id=⚠️
|
||||
|
||||
--send-mail-url=smtps://smtp.resend.com:2465
|
||||
--send-mail-username=resend
|
||||
--send-mail-password=⚠️
|
||||
--send-mail-from=Duplicati <notifications@⚠️>
|
||||
--send-mail-to=⚠️
|
||||
--send-mail-level=Warning,Error,Fatal
|
||||
--send-mail-any-operation=true
|
||||
--send-mail-subject=%OPERATIONNAME% 👉🏻%PARSEDRESULT%👈🏻 for %backup-name%
|
||||
--send-mail-body=%RESULT%
|
||||
|
||||
--send-http-url=
|
||||
--send-http-result-output-format=Json
|
||||
```
|
||||
|
||||
## Remote access control
|
||||
|
||||
https://app.duplicati.com/app/dashboard
|
86
compose/unicloud-unison/README.md
Normal file
86
compose/unicloud-unison/README.md
Normal file
@ -0,0 +1,86 @@
|
||||
# [unicloud](https://github.com/agarbato/unicloud) is a web interface to unison.
|
||||
|
||||
[play-with-docker.md](./play-with-docker.md)
|
||||
|
||||
## Server
|
||||
|
||||
### 启动服务端
|
||||
```bash
|
||||
mkdir -p /unison-unicloud-server/data /unison-unicloud-server/shares
|
||||
chown -R 0:0 /unison-unicloud-server/data
|
||||
chmod 777 /unison-unicloud-server/shares
|
||||
```
|
||||
|
||||
```bash
|
||||
SSH_PORT=2222
|
||||
HTTP_PORT=5001
|
||||
SERVER_UI_PASSWORD=
|
||||
|
||||
docker run -d --restart unless-stopped --name unison-unicloud-server \
|
||||
--hostname unison-unicloud-server.oo1.dev \
|
||||
-p $SSH_PORT:22 -p $HTTP_PORT:80 \
|
||||
-e TZ=Asia/Shanghai \
|
||||
-e USER=root -e USER_UID=0 \
|
||||
-e SERVER_UI_USERNAME=unison-unicloud-admin \
|
||||
-e SERVER_UI_PASSWORD=$SERVER_UI_PASSWORD \
|
||||
-e ROLE=SERVER \
|
||||
--mount type=bind,source=/unison-unicloud-server/data,target=/data \
|
||||
--mount type=bind,source=/unison-unicloud-server/shares,target=/shares \
|
||||
ghcr.io/yanhao98/unicloud:latest
|
||||
docker logs -f unison-unicloud-server
|
||||
```
|
||||
|
||||
#### 查看密码
|
||||
```bash
|
||||
docker inspect unison-unicloud-server | grep -A 1 -B 1 -i password
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Client
|
||||
```bash
|
||||
curl https://unison-unicloud-server.oo1.dev/status -v
|
||||
```
|
||||
|
||||
```bash
|
||||
mkdir -p /unison-unicloud-client/data
|
||||
# chown -R 1000:1000 /unison-unicloud-client/data
|
||||
```
|
||||
|
||||
```bash
|
||||
CLIENT_HOSTNAME=服务器主机名
|
||||
SERVER_SHARE=share1 # 需要在服务器上先创建
|
||||
SOURCE1=/path/to/backup1
|
||||
SERVER_PORT=2222
|
||||
|
||||
docker run -d --name unison-unicloud-client \
|
||||
-e SHARE_IGNORE="mysql.sock|.unison" \
|
||||
-e UNISON_PARAMS="group=true|owner=true|times=true" \
|
||||
-e TZ=Asia/Shanghai \
|
||||
-e USER=root -e USER_UID=0 \
|
||||
--restart on-failure \
|
||||
-e CLIENT_HOSTNAME=$CLIENT_HOSTNAME \
|
||||
-e ROLE=CLIENT \
|
||||
-e SERVER_HOSTNAME=unison-unicloud-server.oo1.dev \
|
||||
-e SERVER_PORT=$SERVER_PORT \
|
||||
-e SERVER_SHARE=$SERVER_SHARE \
|
||||
-e API_PROTOCOL=https \
|
||||
-e API_PORT=443 \
|
||||
-e SYNC_INTERVAL=60 \
|
||||
--mount type=bind,source=/unison-unicloud-client/data,target=/data \
|
||||
-e CLIENT_DEST=/share \
|
||||
--mount type=bind,source=$SOURCE1,target="/share$SOURCE1" \
|
||||
ghcr.io/yanhao98/unicloud:latest
|
||||
docker logs -f unison-unicloud-client
|
||||
```
|
||||
|
||||
```bash
|
||||
docker exec -it unison-unicloud-client tail -f /data/log/client.log
|
||||
docker exec -it unison-unicloud-client tail -f /data/log/supervisord.log
|
||||
docker exec -it unison-unicloud-client tail -f /data/log/unicloud-supervise-err.log
|
||||
docker exec -it unison-unicloud-client tail -f /data/log/unicloud-supervise-std.log
|
||||
```
|
||||
|
||||
```bash
|
||||
docker exec -e HOME=/data -it unison-unicloud-client unison unicloud
|
||||
```
|
94
compose/unicloud-unison/play-with-docker.md
Normal file
94
compose/unicloud-unison/play-with-docker.md
Normal file
@ -0,0 +1,94 @@
|
||||
# unicloud
|
||||
[Unison](https://github.com/bcpierce00/unison/wiki/Software-for-use-with-Unison#web-interfaces) file sync web interface
|
||||
|
||||
[examples/client_server_replica/docker-compose.yml](https://github.com/agarbato/unicloud/blob/8e767790ada4d5c8c04dce0e06ebb3fa4a3a82a8/examples/client_server_replica/docker-compose.yml)
|
||||
|
||||
## 准备
|
||||
1. 进入 https://labs.play-with-docker.com
|
||||
2. Add new instance 两个
|
||||
3. docker pull agarbato1/unison-unicloud:2.53.4
|
||||
|
||||
## Server
|
||||
|
||||
### 启动服务
|
||||
```bash
|
||||
mkdir -p /unison-unicloud/data /unison-unicloud/shares
|
||||
chown -R 1000:1000 /unison-unicloud/data
|
||||
chmod 777 /unison-unicloud/shares
|
||||
docker run -d --name unison-unicloud-server \
|
||||
-e TZ=Asia/Shanghai \
|
||||
--network host \
|
||||
-e SERVER_DEBUG=True \
|
||||
-e SERVER_UI_USERNAME=admin \
|
||||
-e SERVER_UI_PASSWORD= \
|
||||
-e ROLE=SERVER \
|
||||
--mount type=bind,source=/unison-unicloud/data,target=/data \
|
||||
--mount type=bind,source=/unison-unicloud/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`
|
||||
- `Create Folder`选`No`
|
||||
|
||||
|
||||
## Client
|
||||
```bash
|
||||
curl 192.168.0.18:80/status -v
|
||||
|
||||
mkdir -p /unison-unicloud/data /unison-unicloud/share
|
||||
chown -R 1000:1000 /unison-unicloud/data
|
||||
docker run -d --name unison-unicloud-client \
|
||||
-e TZ=Asia/Shanghai \
|
||||
--restart on-failure \
|
||||
--network host \
|
||||
-e CLIENT_HOSTNAME=client_hostname1 \
|
||||
-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=/unison-unicloud/data,target=/data \
|
||||
-e CLIENT_DEST=/share \
|
||||
--mount type=bind,source=/unison-unicloud/share,target=/share \
|
||||
agarbato1/unison-unicloud:2.53.4
|
||||
docker logs -f unison-unicloud-client
|
||||
```
|
||||
|
||||
### 激活
|
||||
|
||||
进 http://ip172-18-0-23-csabksol2o90009mnang-80.direct.labs.play-with-docker.com/`clients`,点击`ACTIVATE`
|
||||
|
||||
|
||||
## 测试同步
|
||||
```
|
||||
touch /unison-unicloud/share/$(date +%s).txt
|
||||
```
|
||||
|
||||
```bash
|
||||
docker exec -it server ls /shares/share1
|
||||
```
|
Reference in New Issue
Block a user