Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maintain rclone #6

Merged
merged 23 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 67 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ Polyfiller is kindly supported by [JetBrains](https://www.jetbrains.com/?from=Po
- [What's the difference from polyfill.io](#whats-the-difference-from-polyfillio)
- [Hosting](#hosting)
- [Docker](#docker)
- [Simple container](#simple-container)
- [Composed services with Object Storage](#composed-services-with-object-storage)
- [Install Docker in Cloud Server at first](#install-docker-in-cloud-server-at-first)
- [Simple container](#simple-container)
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved
- [1. Manual deployment](#1-manual-deployment)
- [2. Automatic deployment](#2-automatic-deployment)
- [Logo](#logo)
Expand Down Expand Up @@ -371,6 +372,34 @@ If you use a load balancer and something like `nginx` in a reverse proxy setup,

> This guide has been tested in the deployment process of China mirror: https://polyfiller.kaiyuanshe.cn

##### Composed services with Object Storage

###### Install Docker in Cloud Server at first

In the development environment, use install script
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved

```shell
curl -fsSL https://get.docker.com | sudo sh
```

the current user joins the docker user group
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved

```shell
sudo gpasswd -a ${USER} docker
```

You need to execute `CTRL+D` to log out of the session and use ssh to log back into the system.
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved

[Docker-install-script](https://github.com/docker/docker-install), it say `It is not recommended to depend on this script for deployment to production systems`.
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved
**So depend on your choice**.
More info see the [Docker install Doc](https://docs.docker.com/engine/install/).

Rclone use `FUSE` mount the Rclone's cloud storage systems, you need to install it.

```shell
sudo apt install fuse3 -y
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有没有 Linux 通用 shell 安装脚本?

```

##### Simple container

Run shown commands in the Project Root folder:
Expand All @@ -380,30 +409,55 @@ docker build -t polyfiller/api-service .
docker run --name polyfiller -e NODE_ENV=production -p 3000:3000 polyfiller/api-service
```

##### Composed services with Object Storage
###### 1. Manual deployment

Install Docker plugins in Cloud Server at first:
1. Write [rclone config](https://rclone.org/install/) into `rclone.conf` file in the Project `config/rclone` folder:
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved

```shell
sudo apt install docker-compose
sudo docker plugin install juicedata/juicefs
```ini
[azure]
type = azureblob
account = xxxx
key = xxxx
endpoint = https://xxx
```

###### 1. Manual deployment
How to configure quickly? use `rclone config` command ? It need knows about a lot of things. Open [Doc](https://rclone.org/docs/), choose a instructions, like [Dropbox](https://rclone.org/dropbox/).
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved

1. Write [JuiceFS object storage variables](https://juicefs.com/docs/community/reference/how_to_set_up_object_storage/) into `.env` file in the Project Root folder:
Look for

```ini
STORAGE_TYPE =
BUCKET =
ACCESS_KEY =
SECRET_KEY =
[remote]
app_key =
app_secret =
token = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

It is the configuration for Dropbox.

```ini
[dropbox]
type = dropbox
app_key = xxxxxxxxx
app_secret = xxxxxxxxx
token = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX_XXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

If you use dropbox, in `docker-compose.yml`.
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved

```yaml
command: "mount azure:/ /polyfill-cache --allow-other --allow-non-empty --vfs-cache-mode writes"
```

It should be changed to.
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved

```yml
command: "mount dropbox:/ /polyfill-cache --allow-other --allow-non-empty --vfs-cache-mode writes"
```

2. Run shown commands in the Project Root folder:

```shell
docker-compose up -d
docker compose up -d
```

###### 2. Automatic deployment
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
restart: always

meta-server:
polyfill-cache:
image: rclone/rclone:latest
environment:
- RCLONE_CONFIG=/config/rclone/rclone.conf # Path to the rclone config file inside the container
Expand All @@ -30,7 +30,7 @@ services:
api-service:
depends_on:
- autoheal
- meta-server
- polyfill-cache
image: polyfiller/api-service
environment:
- NODE_ENV=production
Expand Down
12 changes: 9 additions & 3 deletions start-docker.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#! /usr/bin/env bash

docker load < $1
docker load <$1
docker image ls -a

docker-compose down -v --remove-orphans
docker-compose up -d
# get polyfill-cache full path
mount_point="$(pwd)/polyfill-cache"

# umount polyfill-cache dir
sudo umount "$mount_point"
luojiyin1987 marked this conversation as resolved.
Show resolved Hide resolved

docker compose down -v --remove-orphans
docker compose up -d

docker image prune -a -f