diff --git a/LANGS.md b/LANGS.md new file mode 100644 index 0000000..6cc1b43 --- /dev/null +++ b/LANGS.md @@ -0,0 +1,4 @@ +# Languages + +* [English](en/) +* [中国](ch/) \ No newline at end of file diff --git a/README.md b/README.md index d2ab667..bce4d72 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ description: 目前文档仍在陆续完善中! --- +[English version](./en/README.md) + # 欢迎 ## Cloudreve 是什么? diff --git a/ch/README.md b/ch/README.md new file mode 100644 index 0000000..583156f --- /dev/null +++ b/ch/README.md @@ -0,0 +1,31 @@ +--- +description: 目前文档仍在陆续完善中! +--- + +[English version](../en/README.md) + +# 欢迎 + +## Cloudreve 是什么? + +Cloudreve 可以让您快速搭建起公私兼备的网盘系统。Cloudreve 在底层支持不同的云存储平台,用户在实际使用时无须关心物理存储方式。你可以使用 Cloudreve 搭建个人用网盘、文件分享系统,亦或是针对大小团体的公有云系统。 + +## 问题反馈 + +如果在使用过程中发现了什么缺陷,或是有新的需求提议,请先检查一下以前的文档、[issue](https://github.com/cloudreve/Cloudreve/issues) 、[讨论社区](https://forum.cloudreve.org/)是否提过。 + +如果疑似 Bug 或是功能提议,请创建一个 [issue](https://github.com/cloudreve/Cloudreve/issues) 用于追踪问题; + +如果是日常使用上的疑问,请到 [讨论社区](https://forum.cloudreve.org/) 创建新的话题,并详细描述你遇到的问题。 + +## 联系 + +你可以加入以下群组与其他正在使用 Cloudreve 的用户交流: + +* [Telegram 群组](https://t.me/cloudreve_official) +* [QQ 群组](https://jq.qq.com/?_wv=1027&k=5em9gwb) + +或是与开发者联系: + + Email:[abslant@foxmail.com](mailto:abslant@foxmail.com) + diff --git a/SUMMARY.md b/ch/SUMMARY.md similarity index 100% rename from SUMMARY.md rename to ch/SUMMARY.md diff --git a/getting-started/build.md b/ch/getting-started/build.md similarity index 100% rename from getting-started/build.md rename to ch/getting-started/build.md diff --git a/getting-started/config.md b/ch/getting-started/config.md similarity index 100% rename from getting-started/config.md rename to ch/getting-started/config.md diff --git a/getting-started/install.md b/ch/getting-started/install.md similarity index 100% rename from getting-started/install.md rename to ch/getting-started/install.md diff --git a/manage/db-script.md b/ch/manage/db-script.md similarity index 100% rename from manage/db-script.md rename to ch/manage/db-script.md diff --git a/manage/update/README.md b/ch/manage/update/README.md similarity index 100% rename from manage/update/README.md rename to ch/manage/update/README.md diff --git a/manage/update/cong-3.x.x-sheng-ji.md b/ch/manage/update/cong-3.x.x-sheng-ji.md similarity index 100% rename from manage/update/cong-3.x.x-sheng-ji.md rename to ch/manage/update/cong-3.x.x-sheng-ji.md diff --git a/manage/update/update-from-os.md b/ch/manage/update/update-from-os.md similarity index 100% rename from manage/update/update-from-os.md rename to ch/manage/update/update-from-os.md diff --git a/manage/update/upgrade.md b/ch/manage/update/upgrade.md similarity index 100% rename from manage/update/upgrade.md rename to ch/manage/update/upgrade.md diff --git a/use/aria2.md b/ch/use/aria2.md similarity index 100% rename from use/aria2.md rename to ch/use/aria2.md diff --git a/use/policy/README.md b/ch/use/policy/README.md similarity index 100% rename from use/policy/README.md rename to ch/use/policy/README.md diff --git a/use/policy/compare.md b/ch/use/policy/compare.md similarity index 100% rename from use/policy/compare.md rename to ch/use/policy/compare.md diff --git a/use/pro/README.md b/ch/use/pro/README.md similarity index 100% rename from use/pro/README.md rename to ch/use/pro/README.md diff --git a/use/pro/cun-chu-ce-lve-qie-huan.md b/ch/use/pro/cun-chu-ce-lve-qie-huan.md similarity index 100% rename from use/pro/cun-chu-ce-lve-qie-huan.md rename to ch/use/pro/cun-chu-ce-lve-qie-huan.md diff --git a/use/pro/jie-shao.md b/ch/use/pro/jie-shao.md similarity index 100% rename from use/pro/jie-shao.md rename to ch/use/pro/jie-shao.md diff --git a/use/pro/pay.md b/ch/use/pro/pay.md similarity index 100% rename from use/pro/pay.md rename to ch/use/pro/pay.md diff --git a/use/pro/qq.md b/ch/use/pro/qq.md similarity index 100% rename from use/pro/qq.md rename to ch/use/pro/qq.md diff --git a/use/pro/shou-quan-guan-li.md b/ch/use/pro/shou-quan-guan-li.md similarity index 100% rename from use/pro/shou-quan-guan-li.md rename to ch/use/pro/shou-quan-guan-li.md diff --git a/use/webdav.md b/ch/use/webdav.md similarity index 100% rename from use/webdav.md rename to ch/use/webdav.md diff --git a/use/zi-ding-yi-qian-duan.md b/ch/use/zi-ding-yi-qian-duan.md similarity index 100% rename from use/zi-ding-yi-qian-duan.md rename to ch/use/zi-ding-yi-qian-duan.md diff --git a/en/README.md b/en/README.md new file mode 100644 index 0000000..5054721 --- /dev/null +++ b/en/README.md @@ -0,0 +1,28 @@ +--- +description: The documentation is still being worked on! +--- + +## Welcome + +## What is Cloudreve? + +Cloudreve allows you to quickly set up both public and private drives. Cloudreve supports different cloud storage platforms under the hood, so you don't have to worry about the physical storage. You can use Cloudreve for personal use, for file sharing, or as a public cloud for small or large groups. + +## Feedback + +If you find any bugs or have a new requirement, please check the previous documentation, [issue](https://github.com/cloudreve/Cloudreve/issues), [discussion community](https://forum.cloudreve.org/) to see if it has been mentioned. + +If a bug or feature suggestion is suspected, create an [issue](https://github.com/cloudreve/Cloudreve/issues) to track the issue. + +If it is a question of daily use, please create a new topic in the [discussion community](https://forum.cloudreve.org/) and describe the problem you are having in detail. + +## Contact + +You can join the following groups to communicate with other users who are using Cloudreve. + +* [Telegram group](https://t.me/cloudreve_official) +* [QQ group](https://jq.qq.com/?_wv=1027&k=5em9gwb) + +Or contact the developer at + + Email: [abslant@foxmail.com](mailto:abslant@foxmail.com) \ No newline at end of file diff --git a/en/SUMMARY.md b/en/SUMMARY.md new file mode 100644 index 0000000..6b136fb --- /dev/null +++ b/en/SUMMARY.md @@ -0,0 +1,32 @@ +# Table of contents + +* [Welcome](README.md) + +## Getting Started + +* [Quick Start](getting-started/install.md) +* [Configuration Files](getting-started/config.md) +* [Build](getting-started/build.md) + +## Using + +* [Storage Policies](use/policy/README.md) + * [Compare](use/policy/compare.md) +* [WebDAV](use/webdav.md) +* [Offline Download](use/aria2.md) +* [Custom Frontends](use/zi-ding-yi-qian-duan.md) +* [Donation Edition](use/pro/README.md) + * [Presentation](use/pro/jie-shao.md) + * [License Management](use/pro/shou-quan-guan-li.md) + * [Change Storage Policy](use/pro/cun-chu-ce-lve-qie-huan.md) + * [Payments](use/pro/pay.md) + * [QQ Connect](use/pro/qq.md) + +## Maintenance + +* [Database Scripts](manage/db-script.md) +* [Updating](manage/update/README.md) + * [Updating from 3.x.x](manage/update/cong-3.x.x-sheng-ji.md) + * [Updating from 2.x.x](manage/update/upgrade.md) + * [Upgrade to donation version](manage/update/update-from-os.md) + diff --git a/en/getting-started/build.md b/en/getting-started/build.md new file mode 100644 index 0000000..6e11989 --- /dev/null +++ b/en/getting-started/build.md @@ -0,0 +1,100 @@ +# Build + +The Cloudreve project consists of two main parts: the main backend repository [cloudreve/Cloudreve](https://github.com/cloudreve/Cloudreve), and the frontend repository [cloudreve/frontend](https://github.com/cloudreve/frontend). Before compiling the Cloudreve backend, you need to build the frontend submodules in the `assets` directory and embed them in the backend repository using [statik](https://github.com/rakyll/statik). + +## Environment preparation + +1. refer to [Getting Started - The Go Programming Language](https://golang.org/doc/install) to install and configure the Go language development environment. +2. Refer to [Download \| Node.js](https://nodejs.org/download/) to install Node.js; +3. Refer to [Install \| Yarn](https://classic.yarnpkg.com/docs/install#windows-stable) to install Yarn; +4. run `go get github.com/rakyll/statik` to install the statik command line tool; + +## Start building + +### Clone the repository + +``bash +## Clone the repository +git clone --recurse-submodules https://github.com/cloudreve/Cloudreve.git + +# # Check out the version you want to compile +git checkout 3.x.x +``` + +### Build static resources + +```bash +# Access the front-end submodule +cd assets +# Install dependencies +yarn install +# Start building +yarn run build +``` + +When finished, the static resource files are located in the `assets/build` directory. + +You can rename this directory to `statics`, place it in the same level as the main Cloudreve application and restart Cloudreve, which will use the static resource files in this directory instead of the built-in ones. + +### Embedding static resources + +```bash +### Return to the project home directory +cd ../ + +# Install statik, for embedding static resources +go get github.com/rakyll/statik + +# Start embedding +statik -src=assets/build/ -include=*.html,*.js,*.json,*.css,*.png,*.svg,*.ico,*.ttf -f +``` + +{% hint style="info" %} +If the `statik` command is not found when embedding, try executing. + +`export PATH=$PATH:$(go env GOPATH)/bin` +{% endhint %} + +### Compile the project + +```bash +### Get current version number, commit +export COMMIT_SHA=$(git rev-parse --short HEAD) +export VERSION=$(git describe --tags) + +# Start the build +go build -a -o cloudreve -ldflags " -X 'github.com/cloudreve/Cloudreve/v3/pkg/conf.BackendVersion=$VERSION' -X 'github.com/cloudreve/ Cloudreve/v3/pkg/conf.LastCommit=$COMMIT_SHA'" +``` + +{% hint style="info" %} +When first compiling, Go will download the relevant dependencies, which may cause this step to slow down or fail if you have a poor network. You can use [GOPROXY.IO](https://goproxy.io/zh/) to speed up the module download. +{% endhint %} + +Once compiled, the final executable `cloudreve` will be generated in the project root directory. + +## Build Assistant + +You can quickly build, package etc. using the build script `build.sh` in the project root directory, which is used as follows + +```bash +. /build.sh [-a] [-c] [-b] [-r] + a - build static resources + c - compile binaries + b - build front-end + compile binaries + r - cross-compile, build for release +``` + +## Cross-compiling + +Before cross-compiling, you need to enable `CGO`, properly install the GCC toolchain for the target platform and set the `CC` environment variable to the GCC compiler for the corresponding platform. + +For example, to cross-compile Windows/AMD64 on a Linux/AMD64 host platform. + +```bash +export GOOS=windows +export GOARCH=amd64 +export CC=x86_64-w64-mingw32-gcc +export CGO_ENABLED=1 + +go build +``` \ No newline at end of file diff --git a/en/getting-started/config.md b/en/getting-started/config.md new file mode 100644 index 0000000..ae98e20 --- /dev/null +++ b/en/getting-started/config.md @@ -0,0 +1,165 @@ +# Configuration files + +## Configuration file + +When you start Cloudreve for the first time, Cloudreve creates a configuration file named `conf.ini` in the same level directory. + +You can also specify the path to the configuration file by adding the `-c` parameter at startup: + +``` +./cloudreve -c /path/to/conf.ini +``` + +An example of a complete configuration file is as follows. + +```d +[System] +; Run mode +Mode = master +; Listening port +Listen = :5000 +; Whether to enable Debug +Debug = false +; Session key, usually generated automatically at first boot +SessionSecret = 23333 +; Hash salt, usually generated automatically at first boot +HashIDSalt = something really hard to guess + +; SSL related +[SSL] +; SSL listening port +Listen = :443 +; Certificate path +CertPath = C:\Users\i\Documents\fullchain.pem +; private key path +KeyPath = C:\Users\i\Documents\privkey.pem + +; Enable Unix Socket Listening +[UnixSocket] +Listen = /run/cloudreve/cloudreve.sock + +;If you only want to use the built-in SQLite database, just delete this section +[Database] +; Database type, currently supports sqlite/mysql/mssql/postgres +Type = mysql +MySQL port +Port = 3306 +; Username +User = root +Password +Password = root +; Database address +Host = 127.0.0.1 +; Database name +Name = v3 +; Data table prefix +TablePrefix = cd_ +; Character set +Charset = utf8 +; SQLite database file path +DBFile = cloudreve.db + +; Configuration in slave mode +[Slave] +; Communication key +Secret = 1234567891234567123456789123456712345678912345671234567891234567 +; Callback request timeout (s) +CallbackTimeout = 20 +; Signature validity +SignatureTTL = 60 + +; Cross-domain configuration +[CORS] +AllowOrigins = * +AllowMethods = OPTIONS,GET,POST +AllowHeaders = * +AllowCredentials = false + +; Redis-related +[Redis] +Server = 127.0.0.1:6379 +Password = +DB = 0 + +; Thumbnail +[Thumbnail] +MaxWidth = 400 +MaxHeight = 300 +FileSuffix = ._thumb +; Maximum number of thumbnails to be generated in parallel, filled with -1 will be determined automatically based on the number of CPU cores +MaxTaskCount = -1 +; can be filled with jpg / png +EncodeMethod = jpg +; whether to garbage collect thumbnails immediately after they are generated +GCAfterGen = false +; Thumbnail quality +EncodeQuality = 85 +``` + +## Using MySQL + +By default, Cloudreve uses the built-in SQLite database and creates the database file `cloudreve.db` in the same directory. If you want to use MySQL, please add the following to the configuration file and restart Cloudreve. + +Note that Cloudreve only supports MySQL versions greater than or equal to 5.7. +``` +[Database] +; database type, currently sqlite/mysql/mssql/postgres is supported +Type = mysql +MySQL port +Port = 3306 +; Username +User = root +; Password +Password = root +; Database address +Host = 127.0.0.1 +; Database name +Name = v3 +; Data table prefix +TablePrefix = cd +; Character set +Charset = utf8 +``` + +{% hint style="info" %} +After changing the database configuration, Cloudreve will reinitialize the database and the old data will be lost. +{% endhint %} + +## Using Redis + +You can add Redis-related settings to your configuration file. + +``` +[Redis] +Server = 127.0.0.1:6379 +Password = your password +DB = 0 +``` + +{% hint style="info" %} +Please specify a DB for Cloudreve that is not used by other services to avoid conflicts. +{% endhint %} + +After restarting Cloudreve, you can note the console output to determine if Cloudreve successfully connected to the Redis server. When using Redis, the following will be taken over by Redis. + +* User sessions (no more lost login sessions after restarting Cloudreve) +* Data table HF record query cache (e.g. storage policies, settings entries) +* Callback sessions +* OneDrive credentials + +## Enable HTTPS + +{% hint style="info" %} +If you are using Cloudreve as a web server reverse proxy, it is recommended that you configure SSL in your web server, the how to described in this section is only valid if you are using Cloudreve's built-in web server. +{% endhint %} + +In the configuration file add. + +``` +[SSL] +Listen = :443 +CertPath = C:\Users\i\Documents\fullchain.pem +KeyPath = C:\Users\i\Documents\privkey.pem +``` + +where `CertPath` and `KeyPath` are the SSL certificate and private key paths, respectively. Save and restart Cloudreve to take effect. \ No newline at end of file diff --git a/en/getting-started/install.md b/en/getting-started/install.md new file mode 100644 index 0000000..c0e1224 --- /dev/null +++ b/en/getting-started/install.md @@ -0,0 +1,224 @@ +# Quick Start + +## Get Cloudreve + +You can get the packaged master on the [GitHub Release](https://github.com/cloudreve/Cloudreve/releases) page. Each of these releases provides the main program available on common system architectures with the naming convention `cloudreve_version_number_OS_CPU_architecture.tar.gz` . For example, to deploy version 3.0.0 on a common 64-bit Linux system, you should download `cloudreve_3.0.0_linux_amd64.tar.gz`. + +If you want to experience the latest features, you can download the development version built after each commit in [GitHub Actions](https://github.com/cloudreve/Cloudreve/actions). Note that development builds are not stable, cannot be used in production, and are not guaranteed to be fully available. + +If you want to build from source yourself, see the following sections. + +{% page-ref page="build.md" %} + +## Start Cloudreve + +{% tabs %} +{% tab title="Linux" %} +On Linux, just unpack and execute the main program directly as follows. + +```bash +## Unzip the main program you got +tar -zxvf cloudreve_VERSION_OS_ARCH.tar.gz + +# Give execute permission +chmod +x . /cloudreve + +# Start Cloudreve +. /cloudreve +``` +{% endtab %} + +{% tab title="Windows" %} +On Windows, unzip the zip archive and start `cloudreve.exe`. +{% endtab %} +{% endtabs %} + +When Cloudreve is first started, an initial administrator account will be created. Please keep the administrator password, which will only appear on first startup. If you forget the initial administrator password, you will need to delete `cloudreve.db` from the same directory and restart the main application to initialize a new administrator account. + +Cloudreve will listen on port `5212` by default. You can access Cloudreve by visiting `http://ServerIP:5212` in your browser. + +After the above steps, the simplest deployment is complete. You may need some more specific configuration to make Cloudreve work better, please refer to the following configuration process. + +## Optional Deployment Process + +### Reverse Proxy + +In a self-use or small-scale usage scenario, you can absolutely use Cloudreve's built-in web server. However, if you need to use HTTPS or need it to coexist with other web services on the server, you may need to use a mainstream web server to reverse proxy Cloudreve for richer extensions. + +You need to create a new virtual host on your web server, complete the required configuration (e.g. enable HTTPS) and then add the reverse proxy rules to your website configuration file: + +{% tabs %} +{% tab title="NGINX" %} +In the `server` field of the site add. + +```text +location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_pass http://127.0.0.1:5212; + + # If you want to use the local storage policy, remove the comment character from the next line and change the size to the theoretical maximum file size + # client_max_body_size 20000m; +} +``` +{% endtab %} + +{% tab title="Apache" %} +Add the reverse proxy configuration item `ProxyPass` under the `VirtualHost` field, e.g. + +```markup + + ServerName myapp.example.com + ServerAdmin webmaster@example.com + DocumentRoot /www/myapp/public + + # Here are the key parts + AllowEncodedSlashes NoDecode + ProxyPass "/" "http://127.0.0.1:5212/" nocanon + + /etc/supervisord.conf +``` + +Edit the global configuration file. + +```bash +sudo vim /etc/supervisord.conf +``` + +Remove the `[include]` partition comment symbol `;` from the bottom of the file and add the new configuration file include path: + +```bash +[include] +files = /etc/supervisor/conf/*.conf +``` + +Create the directory where the Cloudreve application configuration is located and create the open configuration file: + +```bash +sudo mkdir -p /etc/supervisor/conf +sudo vim /etc/supervisor/conf/cloudreve.conf +``` + +Fill in the following as appropriate and save. + +```bash +[program:cloudreve] +directory=/home/cloudreve +command=/home/cloudreve/cloudreve +autostart=true +autorestart=true +stderr_logfile=/var/log/cloudreve.err +stdout_logfile=/var/log/cloudreve.log +environment=CODENATION_ENV=prod +``` + +Where the following configuration items need to be changed as appropriate. + +* `directory`: the directory where the Clopudreve main program is located +* `command`: absolute path to the Cloudreve main program +* `stderr_logfile`: path to the error log +* `stdout_logfile`: path to the usual log + +Start the supervisor via the global configuration file. + +```bash +supervisord -c /etc/supervisord.conf +``` + +In the future you can manage the Cloudreve process with the following command. + +```bash +# Start +sudo supervisorctl start cloudreve + +# Stop +sudo supervisorctl stop cloudreve + +# Check the status +sudo supervisorctl status cloudreve +``` + +## Docker + +You can choose to deploy with the following images. + +* [xavierniu/cloudreve](https://hub.docker.com/r/xavierniu/cloudreve) \ No newline at end of file diff --git a/en/manage/db-script.md b/en/manage/db-script.md new file mode 100644 index 0000000..acadc62 --- /dev/null +++ b/en/manage/db-script.md @@ -0,0 +1,23 @@ +# Database Scripts + +Cloudreve has some common database scripts built in for routine maintenance, versioning and other operations. You can execute each script by adding the command line parameter `-database-script