[Docker project practice] Deploy Plik temporary file upload system using Docker

1. Introduction to Plik

1.1 Introduction to Plik

Plik is a scalable and friendly temporary file upload system (similar to Wetransfer) in golang.

1.2 Features of Plik

  • Powerful command line client
  • Easy to use web UI
  • Multiple data backends: File, OpenStack Swift, S3, Google Cloud Storage
  • Multiple metadata backends: Sqlite3, PostgreSQL, MySQL
  • OneShot: File is destroyed after first download
  • Streaming: Files are streamed from the uploader to the downloader (nothing is stored on the server side)
  • Removable: gives the uploader the ability to delete the file at any time
  • TTL: Custom expiration date
  • Password: Protect uploads with login/password (Auth Basic)
  • Note: Add custom message (Markdown format)
  • User Authentication: Local/Google/OVH
  • Upload limit: source IP / token
  • Admin CLI and Web UI
  • Server-side encryption (using S3 data backend)
  • Multi-architecture builds and docker images
  • ShareX Uploader: integrated directly into ShareX
  • plikSharp: Plik’s .NET API client
  • Filelink for Plik: Thunderbird plugin to upload attachments to Plik

2. Introduction to local environment

2.1 Local environment planning

This practice is a personal test environment, and the operating system version is centos7.6.

hostname IP address Operating system version Docker version
doctor 192.168.3.166 centos 7.6 2 20.10.17

2.2 Introduction to this practice

1. The deployment environment for this practice is a personal test environment, please be cautious about the production environment;
2. Deploy the Plik temporary file upload system in the Docker environment.

3. Local environment inspection

3.1 Check Docker service status

Check whether the Docker service is running normally and ensure that Docker is running normally.

[root@jeven ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-11-22 17:32:04 CST; 6 days ago
     Docs: https://docs.docker.com
 Main PID: 11795 (dockerd)
    Tasks: 33
   Memory: 164.9M
   CGroup: /system.slice/docker.service

3.2 Check Docker version

Check Docker version

[root@jeven ~]# docker -v
Docker version 20.10.17, build 100c701

3.3 Check docker compose version

Check the Docker compose version to make sure it is above 2.0.

[root@jeven ~]# docker compose version
Docker Compose version v2.6.0

4. Download the Plik image

Pull the Plik image from docker hub

[root@jeven ~]# docker pull rootgg/plik
Using default tag: latest
latest: Pulling from rootgg/plik
188c0c94c7c5: Pull complete
f96bea0e51ed: Pull complete
ae9f8219d19c: Pull complete
d803b156e271: Pull complete
aaef3faf0191: Pull complete
Digest: sha256:8d88186c07c9aa67c5db2062920be6eb04f975c75257589381e82149c5a4a796
Status: Downloaded newer image for rootgg/plik:latest
docker.io/rootgg/plik:latest

5. Deploy Plik temporary file upload system

5.1 Create mounting directory

Create mount directory

mkdir -p /data/plik/data

Setting permissions

chmod -R 777 /data/plik/

5.2 Create Plik container

Use docker-cli to quickly deploy plik containers

docker run  -d  \
--name plik \
-p 8566:8080  \
-v /data/plik/data:/home/plik/server/files  \
rootgg/plik

Run plik container using docker compose

version: "3"
services:
  plik:
    image: rootgg/plik
    container_name: plik
    ports:
      - "8566:8080"
    volumes:
      - /data/plik/data:/home/plik/server/files


  • Create a plik container using the docker-compose.yaml file
[root@jeven plik]# docker compose up -d
[+] Running 2/2
 ⠿ Network plik_default  Created                                                                                        0.3s
 ⠿ Container plik        Started                                                                                        1.8s

5.3 Check plik container status

Check the plik container status to ensure that the plik container starts normally.

[root@jeven plik]#  docker compose ps
NAME                COMMAND                SERVICE             STATUS              PORTS
plik                "/bin/sh -c ./plikd"   plik                running             0.0.0.0:8566->8080/tcp, :::8566->8080/tcp

5.4 Check plik container logs

Check the plik container log to ensure that the plik service is running normally.

[root@jeven plik]#  docker compose logs
plik  | [11/28/2023 12:21:13][INFO    ] Starting plikd server v1.3.1
plik  | [11/28/2023 12:21:13][INFO    ] Starting server at http://0.0.0.0:8080
plik  | [11/28/2023 12:21:13][INFO    ] Will clean old uploads in 10677 seconds.

Insert image description here

6. Basic use of Plik

6.1 Visit Plik homepage

Access address: http://192.168.3.166:8566/, replace the IP with your own server IP address.

Insert image description here

6.2 Basic settings of Plik

On the first option on the left, after clicking Start, the file is immediately deleted from the server after the first download.

Insert image description here

In the second option on the left, click Start to start streaming media.

Insert image description here

In the third option on the left, after clicking Enable, the uploader can delete the file.

Insert image description here

On the fourth option on the left, click Enable to require a password before uploading and downloading.

Insert image description here

On the fifth option on the left, click Enable to add comments to the uploaded content.

Insert image description here

6.3 Upload test files

Set all Plik settings options to off

Insert image description here

Click to upload file

Insert image description here
Insert image description here

6.4 Sharing files

Copy the file link to another computer to download.

Insert image description here

Guess you like

Origin blog.csdn.net/jks212454/article/details/134675473