一、Pingvin Share介绍
1.Pingvin Share简介
它是一个专注于文件分享的高颜值轻量小工具。
2.Pingvin Share功能
创建文件共享,你可以通过链接访问这些文件
支持自定义链接的后缀
部署非常简单(Docker部署2分钟搞定)
没有文件大小的限制(只要你的硬盘够大)
支持设置共享的到期时间
支持访问者限制,可以用密码来保护你的共享
支持切换是否需要登陆才能上传
支持注册/关闭注册
支持邮件提醒接收者
支持暗黑模式浅色和深色模式
支持amd64/arm64
3.Pingvin Share项目地址
https://github.com/stonith404/pingvin-share
二、本次实践介绍
1. 本次实践简介
a.本次实践部署环境为个人腾讯云的测试环境,若是生产环境请谨慎部署;
b.本次实践为快速使用docker部署pingvin-share于个人腾讯云上。
2. 本地环境规划
本次实践环境规划:下载镜像pingvin-share,通过docker-cli或者docker compose启动容器
镜像命名 | IP地址 | 容器镜像版本 | 操作系统版本 |
pingvin-share | localhost | latest | centos7 |
三、检查本地Docker环境
1. 检查本地Docker版本
检查Docker版本:docker version
root@WellDone:/home/goodjob# docker version
Client: Docker Engine - Community
Version: 25.0.0
API version: 1.44
Go version: go1.21.6
Git commit: e758fe5
Built: Thu Jan 18 17:09:49 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 25.0.0
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: 615dfdf
Built: Thu Jan 18 17:09:49 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.27
GitCommit: a1496014c916f9e62104b33d1bb5bd03b0858e59
runc:
Version: 1.1.11
GitCommit: v1.1.11-0-g4bccb38
docker-init:
Version: 0.19.0
GitCommit: de40ad0
root@WellDone:/home/goodjob#
2. 检查Docker服务状态
检查Docker服务状态,确保Docker服务正常运行。
systemctl status docker
root@WellDone:/home/goodjob/Downloads# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2024-01-24 08:54:31 CST; 1 day 4h ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 1549 (dockerd)
Tasks: 65
Memory: 419.5M
CPU: 38.874s
CGroup: /system.slice/docker.service
├─ 1549 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
├─ 2010 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 6379 -container-ip 172.17.0.2 -container-port 6379
├─ 2016 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 6379 -container-ip 172.17.0.2 -container-port 6379
├─ 2029 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 5432 -container-ip 172.17.0.3 -container-port 5432
├─ 2036 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 5432 -container-ip 172.17.0.3 -container-port 5432
├─123083 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8888 -container-ip 172.17.0.4 -container-port 8080
└─123095 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8888 -container-ip 172.17.0.4 -container-port 8080
1月 24 08:54:31 WellDone dockerd[1549]: time="2024-01-24T08:54:31.067895045+08:00" level=info msg="API listen on /run/docker.sock"
1月 24 08:54:31 WellDone systemd[1]: Started Docker Application Container Engine.
1月 24 16:13:48 WellDone dockerd[1549]: time="2024-01-24T16:13:48.185008219+08:00" level=info msg="ignoring event" container=8ad99af82d8a41dd661d>
1月 24 16:13:48 WellDone dockerd[1549]: time="2024-01-24T16:13:48.189484205+08:00" level=warning msg="ShouldRestart failed, container will not be>
1月 24 21:58:08 WellDone dockerd[1549]: time="2024-01-24T21:58:08.024915139+08:00" level=info msg="ignoring event" container=27fd28e2993f31b170b8>
1月 24 21:58:08 WellDone dockerd[1549]: time="2024-01-24T21:58:08.029986730+08:00" level=warning msg="ShouldRestart failed, container will not be>
1月 25 10:46:16 WellDone dockerd[1549]: time="2024-01-25T10:46:16.329180722+08:00" level=info msg="Container failed to exit within 10s of signal >
1月 25 10:46:16 WellDone dockerd[1549]: time="2024-01-25T10:46:16.350757439+08:00" level=info msg="ignoring event" container=b1223add00f36bbb3246>
1月 25 10:49:21 WellDone dockerd[1549]: time="2024-01-25T10:49:21.993755983+08:00" level=info msg="Container failed to exit within 10s of signal >
1月 25 10:49:22 WellDone dockerd[1549]: time="2024-01-25T10:49:22.015822650+08:00" level=info msg="ignoring event" container=edb0e153b45dbe62acd8>
lines 1-28/28 (END)
四、部署pingvin-share镜像
1.下载pingvin-share
[root@VM-8-12-centos ~]# docker pull stonith404/pingvin-share
Using default tag: latest
latest: Pulling from stonith404/pingvin-share
4abcf2066143: Pull complete
77152dc4dbd8: Pull complete
f90945061f81: Pull complete
c95f6f65e1db: Pull complete
2d6bd067c588: Pull complete
2634da49e2f2: Pull complete
fd323395779d: Pull complete
a11633ec83c6: Pull complete
b27baa54284e: Pull complete
975c4d8fbea1: Pull complete
94bc9225ff0f: Pull complete
7da7281034f8: Pull complete
a867542908ea: Pull complete
d18cb27fa9f0: Pull complete
4704c7aabed4: Pull complete
cee58f09e1ee: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:77704fbac22d56e2e262ad73903b24ff8a0e0db6fd3534eed5f2893346616734
Status: Downloaded newer image for stonith404/pingvin-share:latest
docker.io/stonith404/pingvin-share:latest
2.docker-compose启动文件
version: '3.9'
services:
pingvin-share:
image: stonith404/pingvin-share
restart: unless-stopped
ports:
- 8080:3000 # 8080可以改成服务器上未被使用的端口
volumes:
- "${PWD}/data:/opt/app/backend/data" # ${PWD}/data表示在当前目录下创建data文件夹用于存放文件
container_name: pingvin-share
3.启动docker-compose
docker compose up -d
4.查pingvin-share容器状态
root@HEJIAJIN-FX506HE:/container/docker-compose/docker-firsttest# docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
dcd12d60a287 stonith404/pingvin-share "docker-entrypoint.s…" 55 seconds ago Up 53 seconds (healthy) 0.0.0.0:8080->3000/tcp, :::8080->3000/tcp pingvin-share
5.查pingvin-share日志状态
[root@VM-8-12-centos docker-compose]# docker logs -f pingvin-share
{"level":"info","ts":1713785686.8813813,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
{"level":"warn","ts":1713785686.881772,"logger":"caddyfile","msg":"Unnecessary header_up X-Forwarded-For: the reverse proxy's default behavior is to pass headers to the upstream"}
{"level":"warn","ts":1713785686.88178,"logger":"caddyfile","msg":"Unnecessary header_up X-Forwarded-Proto: the reverse proxy's default behavior is to pass headers to the upstream"}
{"level":"warn","ts":1713785686.8821917,"logger":"caddyfile","msg":"Unnecessary header_up X-Forwarded-For: the reverse proxy's default behavior is to pass headers to the upstream"}
{"level":"warn","ts":1713785686.8822,"logger":"caddyfile","msg":"Unnecessary header_up X-Forwarded-Proto: the reverse proxy's default behavior is to pass headers to the upstream"}
{"level":"warn","ts":1713785686.882692,"msg":"Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies","adapter":"caddyfile","file":"/etc/caddy/Caddyfile","line":2}
{"level":"info","ts":1713785686.8836849,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1713785686.8843951,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc00033aa80"}
{"level":"info","ts":1713785686.8846512,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1713785686.8848832,"msg":"autosaved config (load with --resume flag)","file":"/root/.config/caddy/autosave.json"}
{"level":"info","ts":1713785686.884889,"msg":"serving initial configuration"}
{"level":"warn","ts":1713785686.884967,"logger":"tls","msg":"unable to get instance ID; storage clean stamps will be incomplete","error":"open /root/.local/share/caddy/instance.uuid: no such file or directory"}
{"level":"info","ts":1713785686.898162,"logger":"tls","msg":"cleaning storage unit","storage":"FileStorage:/root/.local/share/caddy"}
{"level":"info","ts":1713785686.898383,"logger":"tls","msg":"finished cleaning storage units"}
> pingvin-share-backend@0.23.1 prod
> prisma migrate deploy && prisma db seed && node dist/src/main
Environment variables loaded from prisma/.env
Prisma schema loaded from prisma/schema.prisma
▲ Next.js 13.5.6
- Local: http://localhost:3333
- Network: http://0.0.0.0:3333
✓ Ready in 762ms
Datasource "db": SQLite database "pingvin-share.db" at "file:../data/pingvin-share.db"
17 migrations found in prisma/migrations
No pending migrations to apply.
Environment variables loaded from prisma/.env
Running seed command `ts-node prisma/seed/config.seed.ts` ...
�� The seed command has been executed.
┌─────────────────────────────────────────────────────────┐
│ Update available 5.0.0 -> 5.12.1 │
│ Run the following to update │
│ npm i --save-dev prisma@latest │
│ npm i @prisma/client@latest │
└─────────────────────────────────────────────────────────┘
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [NestFactory] Starting Nest application...
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] PrismaModule dependencies initialized +58ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] JwtModule dependencies initialized +3ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] JwtModule dependencies initialized +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] ThrottlerModule dependencies initialized +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] CacheModule dependencies initialized +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] DiscoveryModule dependencies initialized +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] ScheduleModule dependencies initialized +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] AppModule dependencies initialized +0ms
Connected to the database
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] EmailModule dependencies initialized +84ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] ClamScanModule dependencies initialized +2ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] JobsModule dependencies initialized +2ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] FileModule dependencies initialized +2ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] UserModule dependencies initialized +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] ReverseShareModule dependencies initialized +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] AuthModule dependencies initialized +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] ShareModule dependencies initialized +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [InstanceLoader] OAuthModule dependencies initialized +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RoutesResolver] AppController {/api}: +28ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/health, GET} route +5ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RoutesResolver] AuthController {/api/auth}: +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/signUp, POST} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/signIn, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/signIn/totp, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/resetPassword/:email, POST} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/resetPassword, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/password, PATCH} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/token, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/signOut, POST} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/totp/enable, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/totp/verify, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/auth/totp/disable, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RoutesResolver] ShareController {/api/shares}: +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:id, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:id/from-owner, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:id/metaData, GET} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:id/complete, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:id/complete, DELETE} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:id, DELETE} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/isShareIdAvailable/:id, GET} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:id/token, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RoutesResolver] FileController {/api/shares/:shareId/files}: +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:shareId/files, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:shareId/files/zip, GET} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:shareId/files/:fileId, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/shares/:shareId/files/:fileId, DELETE} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RoutesResolver] ReverseShareController {/api/reverseShares}: +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/reverseShares, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/reverseShares/:reverseShareToken, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/reverseShares, GET} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/reverseShares/:reverseShareId, DELETE} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RoutesResolver] ConfigController {/api/configs}: +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/configs, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/configs/admin/:category, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/configs/admin, PATCH} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/configs/admin/testEmail, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/configs/admin/logo, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RoutesResolver] UserController {/api/users}: +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/users/me, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/users/me, PATCH} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/users/me, DELETE} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/users, GET} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/users, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/users/:id, PATCH} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/users/:id, DELETE} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RoutesResolver] OAuthController {/api/oauth}: +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/oauth/available, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/oauth/status, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/oauth/auth/:provider, GET} route +1ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/oauth/callback/:provider, GET} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [RouterExplorer] Mapped {/api/oauth/unlink/:provider, POST} route +0ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [NestApplication] Nest application successfully started +19ms
[Nest] 37 - 04/22/2024, 11:34:53 AM LOG [ClamScanService] ClamAV is not active
六、访问pingvin-share首页
访问地址http://43.138.153.157:8080
ps:内网穿透搭建好了,minipc可以撑一段时间,这些测试的服务应该会保留一段时间...如果有需要体验的但是服务已经被我down了的,可以在微信公众号《零氪的云原生》私我开启!