在 Linux 伺服器上安裝(進階)
以下文檔用於將 Bookings ONE 安裝到 Linux 伺服器上。
先決條件
信息
要確認 Docker Engine 是否安裝正確,請使用命令 sudo docker images
要確認 Docker Compose 是否安裝成功,請使用命令 sudo docker-compose version
設置程序
- 將 Bookings ONE 伺服器鏡像
bookings-one.tar
放入文件夾/bookings-one
警告
Bookings Bookings ONE Server 圖片沒有直接下載鏈接。 如需安裝 Bookings ONE 伺服器鏡像,請聯繫 ONES Software
- 將以下腳本保存到
/bookings-one/docker-compose.yml
version: '3.1'
services:
bookings-one:
image: ones-software/bookings-one:latest
restart: always
volumes:
- /bookings-one:/etc/bookings-one
environment:
BackgroundJob__TimeZone: 'Asia/Hong_Kong'
File__BaseDirectory: '/etc/bookings-one/upload-files'
Logging__ErrorLog__FileLogDirectory: '/etc/bookings-one/error-logs/error-logs-{Date}.txt'
Logging__InfoLog__FileLogDirectory: '/etc/bookings-one/info-logs/info-logs-{Date}.txt'
Logging__DbLog__FileLogDirectory: '/etc/bookings-one/db-logs/db-logs-{Date}.txt'
WebPush__PrivateKey: WEB_PUSH_PRIVATE_KEY
WebPush__PublicKey: WEB_PUSH_PUBLIC_KEY
Architecture__Database: 'Mysql'
ConnectionStrings__MainDatabase: 'Server=DATABASE_SERVER_ADDRESS;Port=3306;Database=Bookings.ONE;Uid=DATABASE_USERNAME;Pwd=DATABASE_PASSWORD;Allow User Variables=true'
ASPNETCORE_URLS: 'https://+;http://+'
ASPNETCORE_HTTPS_PORT: 443
ASPNETCORE_Kestrel__Certificates__Default__Password: CERTIFICATE_PASSWORD
ASPNETCORE_Kestrel__Certificates__Default__Path: '/etc/bookings-one/certificate/bookings-one.pfx'
ports:
- 443:443
.yml 文件的間距非常重要,請保持與示例相同的縮進
- 修改
docker-compose.yml
:- 將
DATABASE_SERVER_ADDRESS
,DATABASE_USERNAME
和DATABASE_PASSWORD
替換為您的數據庫連接字符串如果您的 Mysql 與 Docker 在同一台伺服器上運行,則必須將 DATABASE_SERVER_ADDRESS
設置為host.docker.internal,1433
- 將
WEB_PUSH_PRIVATE_KEY
和WEB_PUSH_PUBLIC_KEY
替換為您的密鑰對。此密鑰為 VAPID 密鑰,您可以自己生成或使用某些 在線密鑰生成器生成 - 將
CERTIFICATE_PASSWORD
替換為您的證書密碼
- 將
- 將證書文件放到
/bookings-one/certificate/
,證書名稱必須是bookings-one.pfx
- 打開終端,進入文件夾
/bookings-one
- 加載最新的 Bookings ONE 伺服器鏡像,運行命令
sudo docker load --input ./bookings-one.tar
- 開始 Bookings ONE: 運行命令
sudo docker-compose up -d
- 現在您可以通過
https://localhost
訪問 Bookings One 控制台
以下是一個示例 docker-compose.yml
供您參考
version: '3.1'
services:
bookings-one:
image: ones-software/bookings-one:latest
restart: always
volumes:
- /c/bookings-one:/etc/bookings-one
environment:
BackgroundJob__TimeZone: 'Asia/Hong_Kong'
File__BaseDirectory: '/etc/bookings-one/upload-files'
Logging__ErrorLog__FileLogDirectory: '/etc/bookings-one/error-logs/error-logs-{Date}.txt'
Logging__InfoLog__FileLogDirectory: '/etc/bookings-one/info-logs/info-logs-{Date}.txt'
Logging__DbLog__FileLogDirectory: '/etc/bookings-one/db-logs/db-logs-{Date}.txt'
WebPush__PublicKey: 'BJszfqip7Ii_lKSXCd_ZZJXT5FeQwJCZx79mLpr3nY8_rvRzSBLuaTx5dOp4rQZtzI511UvoyRXIwPoZ4_PALFA'
WebPush__PrivateKey: 'C-RkwJZGooRiI0CGNwAmShlaSWsh4SRNkol-ni5LGAk'
Architecture__Database: 'Mysql'
ConnectionStrings__MainDatabase: 'Server=host.docker.internal;Port=3306;Database=Bookings.ONE; ASPNETCORE_URLS: 'https://+;http://+'
ASPNETCORE_HTTPS_PORT: 443
ASPNETCORE_Kestrel__Certificates__Default__Password: Password1234
ASPNETCORE_Kestrel__Certificates__Default__Path: '/etc/bookings-one/certificate/bookings-one.pfx'
ports:
- 443:443
更新 Bookings ONE 伺服器
- 將最新的 Bookings ONE 伺服器映像下載到
C:\bookings-one
- 在
C:\bookings-one
中打開 PowerShell - 停止 Bookings ONE: 運行命令
docker-compose down
- 加載最新的 Bookings ONE 伺服器鏡像,運行命令
docker load --input ./bookings-one.tar
- 更新並啟動 Bookings ONE,運行命令
docker-compose up
C:\bookings-one
中,任何驅動器或文件夾都可以使用,如果要移動到其他文件夾,請將“/c/bookings-one”替換為目標文件夾(例如 /d/server/bookings-one)