docker部署

0. 环境要求

最低2G内存 2核CPU linux 64位系统

1. 配置DNS

Configure A record in the domain name service provider or DNS resolution service provider

例如:

主机名

记录类型

记录值

work

A

x.x.x.x

  • 主机名可以是任意二级域名前缀,这里使用work

  • example.com为你的域名

  • x.x.x.x 为服务器的IP地址

  • 网页访问地址为 https://work.example.com

2. 安装docker, docker-compose, git

# If already installed, skip

mkdir pkgs && cd pkgs
wget 'https://download.docker.com/linux/static/stable/x86_64/docker-26.1.4.tgz'
tar xf docker-26.1.4.tgz;
chmod +x docker/*
sudo cp docker/* /usr/local/bin/

curl -SL https://github.com/docker/compose/releases/download/v2.27.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose

yum install git # centos
apt install git  # ubuntu/debian

3. 安装

git clone https://github.com/Hedwi/hedwi-docker.git
cd hedwi-docker/hedwi
cp env.example .env
# Modify the .env configuration, modify all variables marked with 'Need modify'

make  # After running, http 80 port can be accessed, should be able to access http://configured domain name

# The service will automatically create an administrator account (for configuring the system, adding users, adding teams, etc.) and a normal user account admin@your domain name (for using the system service)

配置文件示例

4. 自动生成免费SSL证书

# The service has built-in Let’s Encrypt HTTP-01 verification service interface, running this command will request the /acme/create interface to create a certificate
# After obtaining the certificate successfully, the certificate will be written to inbox/certs/cert.key inbox/certs/cert.crt
# This command will use the generated free certificate to replace nginx/certs/cert.key nginx/certs/cert.crt
make cert

5. 重启服务

make down # Stop all running docker containers
make # Start docker containers

6. 使用https访问 登录

访问 https://work.example.com/login?admin=true (work.example.com为使用的域名), 使用管理员账号登录(配置的邮箱和密码) 访问 https://work.example.com/hello 页面, 继续添加用户、团队等等。