DailyTxT 是一个加密的日记网络应用程序,可以写下您当天的故事并轻松再次找到它们。 它是用Python Flask(后端)和Vue.JS(前端)编写的,旨在由Docker运行 - 支持AMD64和ARM64。
本次实践为个人测试环境,操作系统版本为centos7.6。
hostname | IP地址 | 操作系统版本 | Docker版本 |
---|---|---|---|
dokcer | 192.168.3.166 | centos 7.6 | 2 20.10.17 |
1.本次实践部署环境为个人测试环境,生产环境请谨慎;
2.在Docker环境下部署DailyTxT加密日记网络应用程序。
检查Docker服务是否正常运行,确保Docker正常运行。
[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 Thu 2024-01-04 22:20:00 CST; 12h ago
Docs: https://docs.docker.com
Main PID: 11192 (dockerd)
Tasks: 36
Memory: 258.5M
CGroup: /system.slice/docker.service
检查Docker版本,当前Docker版本为20.10.17。
[root@jeven ~]# docker -v
Docker version 20.10.17, build 100c701
检查Docker compose版本,确保2.0以上版本。
[root@jeven ~]# docker compose version
Docker Compose version v2.6.0
从docker hub拉取DailyTxT镜像,如果镜像拉取过慢,可尝试更换国内镜像加速源。
[root@jeven dailytxt]# docker pull phitux/dailytxt:latest
latest: Pulling from phitux/dailytxt
Digest: sha256:fe39d699b7af49e6dd6b670300a9e3816fa36b8479fe9aeba9fe5eda0aa85d96
Status: Image is up to date for phitux/dailytxt:latest
docker.io/phitux/dailytxt:latest
创建DailyTxT部署目录/data/dailytxt/
mkdir -p /data/dailytxt/data && cd /data/dailytxt/
如果需要使用docker-cli命令部署,执行以下命令,设置host_port与SECRET_KEY后即可。
docker run -p 127.0.0.1:<host_port>:8765 -e "PORT=8765" -e "SECRET_KEY=<openssl rand -base64 32>" -e "ALLOW_REGISTRATION=True" -v </save/my/dailytxt-files/here/>:/app/data --name dailytxt -d phitux/dailytxt:latest
本次实践部署使用docker compose方式,编辑docker-compose.yaml文件。
version: "3"
services:
dailytxt:
image: phitux/dailytxt:latest
container_name: dailytxt
restart: always
environment:
# That's the internal container-port. You can actually use any portnumber (must match with the one at 'ports')
- PORT=8765
- SECRET_KEY=HANEZfT3CWsWOUf/5rtXqL4E2HfwquXzeCNUwoovL20=
# Set it to False or remove the line completely to disallow registration of new users.
- ALLOW_REGISTRATION=True
# Use this if you want the json log file to be indented. Makes it easier to compare the files. Otherwise just remove this line!
- DATA_INDENT=2
# Set after how many days the JWT token will expire and you have to re-login. Defaults to 30 days if line is ommited.
- JWT_EXP_DAYS=60
# Enable/disable a feature of DailyTxT to auto-check maximal once per hour if there's a newer version of DailyTxT available. Defaults to True if line is ommited.
- ENABLE_UPDATE_CHECK=True
ports:
- 9809:8765
# perhaps you only want:
# "<host_port>:8765"
volumes:
- /data/dailytxt/data:/app/data/
# Or perhaps if using on a windows enviroment:
# "C:/Users/example/dailytxt/:/app/data"
使用docker-compose.yaml文件创建DailyTxT容器
[root@jeven dailytxt]# docker compose up -d
[+] Running 2/2
⠿ Network dailytxt_default Created 0.1s
⠿ Container dailytxt Started 1.9s
检查DailyTxT容器状态,确保DailyTxT容器正常启动。
[root@jeven dailytxt]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59fcd18d1090 phitux/dailytxt:latest "/bin/sh -c 'gunicor…" 31 seconds ago Up 28 seconds 0.0.0.0:9809->8765/tcp, :::9809->8765/tcp dailytxt
访问地址:http://192.168.3.166:9809,将IP替换为自己服务器IP地址,进入到DailyTxT首页。如果无法访问,则检查服务器防火墙是否设置,云服务器的安全组端口是否放行等。
点击注册账号,自定义设置账号密码登录即可。
在DailyTxT右侧的文件区,点击上传文件。
点击文件区的上传文件,则可在当前浏览器直接下载。
点击上传的图片文件,可以在线预览和下载。
可以在日记编辑区,编辑当天日记。
可以标记某天日期,作为重要日记来标记。
可以在搜索栏内,搜索日记内容的关键字。
DailyTxT是一款方便实用的日记工具,特别适合个人日常工作与学习使用。DailyTxT使用docker方式部署非常简单,界面美观简洁。通过左侧的日历栏,可以快速查看每日日记,搜索功能也非常强大,能够通过关键字快速找到相关日记。DailyTxT还具有加密功能,保障了我们的日记安全性。无论是记录日常生活还是重要事件,DailyTxT都是一个值得尝试的应用程序,它的易用性和加密功能让我们能够方便地记录日记笔记等。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。