Docker series uses Docker to deploy a lightweight file sharing platform based on pingvin-share
本文最后更新于 362 天前,其中的信息可能已经有所发展或是发生改变,如有失效可到评论区留言。

Preface

Sometimes, in blog posts, I want to share some files for everyone to download. In fact, there are many ways to choose: nextcloud, links generated by cos built by minio, Baidu, Alibaba Cloud Disk, etc., but these methods have their own advantages and disadvantages (I will use a special article to talk about this later). Recently, I saw other articles that mentioned a lightweight file sharing software: pingvin-share. First, it is easy to deploy, second, it is very unique, and third, it supports registration (it can only be anonymous and dare not be made public, such as software that can be used without registration and then burn after reading. If it is abused, I may be investigated. . ), these are very much to my liking, so I decided to use it as my regular sharing solution.

deploy

Create a folder on the host that needs to be mapped to the container

It is customary to first create the -v parameter to mount the required folder:

mkdir -p /docker/pingvin-share/data

Note: This host folder is also the root folder for uploading files in the future, so you need to choose a suitable storage. The size limit of the storage where this folder is located is the size limit of the files that pingvin-share can store, just like the famous slogan in the past: "The bolder the people, the more productive the land", so it can be a shared folder on a large-capacity NAS. However, this requires mounting the NAS shared folder on the host Linux system in advance. For specific host environments, please refer to my previous articles:How to automatically load SMB shared network disks when macOS starts up,Unprivileged Linux container in debian series PVE mounts SMB shared directory,Debian series automatically mount SMB at startup).


Deploy pingvin-share

The docker run command format is as follows:

docker run --name pingvin-share -d --restart=always \ -p 9700:3000 \ -v /docker/pingvin-share/data:/opt/app/backend/data \ stonith404/pingvin-share:latest

Key parameter explanation:
-p 9700:3000
Map the host port 9700 to the container port 3000. You can modify this according to your actual environment.
-v /docker/pingvin-share/data:/opt/app/backend/data
Mapping the host/docker/pingvin-share/dataTo the container/opt/app/backend/data


Why is pingvin-share called a "lightweight" file sharing platform? From the above command, you can see that it is not like some other network disk applications, such as nextcloud, which need to specify a database such as mariadb and mysql. To be honest, if I just want to upload a file and simply generate a sharing link, but you still ask me to mess around with a database, I will feel a little uncomfortable. However, not specifying it does not mean that pingvin-share does not need a database. It uses the SQLite embedded database, as shown below:

image.png

You can see a pingvin-share.db file, which is it. This database file is stored in the "/docker/pingvin-share/data" path of the host machine by default.


In addition: pingvin-share can also be used with the docker version of ClamAV, which will disinfect the uploaded files. If you want to use it together, you need to create a docker version of ClamAV and use it when creating the pingvin-share container.-e CLAMAV_HOSTand-e CLAMAV_PortThe parameters specify the address and port of ClamAV respectively. Of course, this scenario that requires mutual access also requires--network=Parameters are used to divide the networks of the two containers into a non-default bridge. This is a bit troublesome. The key is that if I use it alone, there will be no risk of poisoning. Another key is that ClamAV actually requires a minimum of 3G memory and recommends 4G memory. This is a bit scary. . Just like when I deployed the full-text search software elasticsearch for nextcloud before, the memory occupied seemed to be at least 3G. . Forget it, I won’t bother with it. Friends who are interested can try it.

Preparation

Initial Setup

usehttp://host ip:9700Log in, as shown below:

image.png

Click Sing Up in the red box in the upper right corner to create the first account (also the administrator account):
image.png

After filling in the account-related information, click the red box below the above picture to create an account, and then the following interface will appear:
image.png

First change the language to Chinese, click "My account" in the red box above:
image.png

Select Simplified Chinese in the Language at the bottom:
image.png

In this way, the language of the entire page is set.

At the same time, this interface can also modify the account name, email, password and enable secondary verification, etc.:

image.png

Note: If you get an error message when changing the password here, you can also change it in the "Management" - "User Management" interface:
image.png

General settings

Go to "Administration" - "Configuration Conventions":

image.png

"General" configuration options:
image.png

The App address in the red box is very important. It determines the link address generated when you share files. If it is only used in the intranet, you can directly change it tohttp://host IP:9700However, if you want to use it on the Internet, you must have a domain name with a public IP and the corresponding correct configuration of the public network access method (see below).

Assuming that the public domain name is share.example.com and has been registered, and the reverse proxy has also completed the SSL configuration, the address of the App is:https://share.example.comIf the domain name is not registered, you need to add it after the domain name according to the port actually used by the reverse proxy, for example:https://share.example.com:44444.
At the same time, the "General" interface can also set the displayed App name, logo, and whether to display the homepage, etc.
"Shared" configuration options:

image.png

The "Allow Registration" option is turned on by default. If you only want to use it by yourself, you need to turn it off. At the same time, this interface can also set the maximum expiration time of the share, the file size (the total size of all files contained in a link), and the zip compression level.
"SMTP" configuration options:
image.png

If you want to use the email notification function set in the "Email" configuration option, you need to configure SMTP related options first.
"Social Login" configuration options:
image.png

Here is the setting interface for OAuth authentication using various third-party APP accounts. If it is not needed, close it.

Upload and share

Click the upload button at the top of any page to enter the upload page:

image.png

After selecting a local file and double-clicking it to open it (taking the .flac file as an example), the following interface is displayed:
image.png

The shared link is the last part of the shared link. You can specify it manually or automatically. Manually specifying can set more understandable letters. For example, I uploaded the flac file of the window, so I set it to music. At the same time, this interface can also set the expiration time, access password and number of visits (setting the number of visits to 1 is equivalent to self-destructing). After the settings are completed, click Share in the red box at the bottom to generate the link:
image.png

Then you just need to copy this link and send it to the person you want to share with, thus completing the most basic sharing function.

Advanced Applications

In the previous section, pingvin-share's file sharing should actually be called folder sharing. If you directly copy the sharing link in the previous section and open it in a browserhttps://share.example.com/s/music, you can see the following display:

image.png

The above picture actually shows the contents of the music folder. Since there is only one file, only one is shown. There are three buttons in the red box to the right of the file in the above picture, from left to right: Preview, Copy File Download Link and Click Download. So if you want to share this file directly, you have to use the button in the middle of the red box in the above picture to copy and send it to the other party.

One advantage of sharing a folder is that the content inside can be modified at will, but the external link is fixed. This is very convenient when publishing content that needs to be modified frequently (such as frequently updated source code). Click the red box button in the figure below to add a file:

image.png

In addition, pingvin-share has another interesting feature: reverse share.
, even if others do not have a registered account, they can upload files by directly opening this link:

image.png

You can also define the link expiration time, the size of the file that can be uploaded, and the number of times the link can be used:
image.png

Configuring public network access

If you want to publish to the public Internet, you need to choose the most suitable publishing method according to the actual environment and the reverse proxy you use. You can refer to my previous articles:
1,Docker series uses Docker to build its own reverse proxy based on NPM
2,Linux panel series configure reverse proxy and use non-443 port for publishing
3.Home data center series uses domestic cloud hosting to get free cloudflare to achieve fast access to domestic sites from abroad
4.Home Data Center Series: Use cloudflare to build a website quickly with no public IP in your home broadband (general purpose)

The first and second methods are suitable for environments with public IP but no legal 443 port (home broadband, unregistered cloud host). You need to add a non-standard port after the URL (if you use cloudflare to build a website, you don't need to add a port, but you need to customize the source station port. You can refer to:Home data center series uses cloudflare's Origin Rules to solve the problem of having a public IP but no legal ports 80 and 443 when building a websiteThe third method is suitable for cloud hosts with a record, and the fourth method is suitable for all environments (including environments without public IP), which is also the method I recommend (regardless of whether your environment has a public IP or not, because this method does not require running https traffic directly on the public network).

Brief summary

If you just want a file sharing function and don't want to bother too much (mainly don't want to install a database); or if the performance of the cloud host you purchased is limited and you are willing but unable to deploy nextcloud or other applications, but you still want to use it to deploy file sharing applications, pingvin-share is really a good choice. In short, I still recommend friends who need it to try it.

You can experience the actual effect by using the following link, where I put some previously downloaded songs:
pingvin-share effect demonstration link

The content of the blog is original. Please indicate the source when reprinting! For more blog articles, you can go toSitemapUnderstand. The RSS address of the blog is:https://blog.tangwudi.com/feed, welcome to subscribe; if necessary, you can joinTelegram GroupDiscuss the problem together.
No Comments

Send Comment Edit Comment


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