【好玩的开源项目】使用Docker部署briefing视频聊天系统
- 一、briefing介绍
- 二、本地环境介绍
- 2.1 本地环境规划
- 2.2 本次实践介绍
- 三、本地环境检查
- 3.1 检查Docker服务状态
- 3.2 检查Docker版本
- 3.3 检查docker compose 版本
- 四、下载briefing镜像
- 五、部署briefing速查表
- 5.1 使用docker-cli创建briefing容器
- 5.2 创建挂载目录
- 5.3 编辑docker-compose.yaml文件
- 5.4 运行briefing容器
- 5.5 检查briefing容器状态
- 5.6 检查briefing容器日志
- 六、配置反向代理
- 6.1 安装nginx
- 6.2 创建证书相关文件
- 6.3 修改nginx配置文件
- 6.4 重启nginx服务
- 七、访问briefing首页
一、briefing介绍
- briefing简介
briefing是一个开源的、安全的直接视频群聊平台。
二、本地环境介绍
2.1 本地环境规划
本次实践为个人测试环境,操作系统版本为centos7.6。
hostname | IP地址 | 操作系统版本 | Docker版本 |
---|---|---|---|
dokcer | 192.168.3.166 | centos 7.6 | 2 20.10.17 |
2.2 本次实践介绍
1.本次实践部署环境为个人测试环境,生产环境请谨慎;
2.在Docker环境下部署briefing视频聊天系统。
三、本地环境检查
3.1 检查Docker服务状态
检查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 2023-12-21 18:58:04 CST; 3 days ago
Docs: https://docs.docker.com
Main PID: 11425 (dockerd)
Tasks: 47
Memory: 387.3M
CGroup: /system.slice/docker.service
├─11425 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
3.2 检查Docker版本
检查Docker版本
[root@jeven ~]# docker -v
Docker version 20.10.17, build 100c701
3.3 检查docker compose 版本
检查Docker compose版本,确保2.0以上版本。
[root@jeven ~]# docker compose version
Docker Compose version v2.6.0
四、下载briefing镜像
从docker hub拉取briefing镜像
[root@jeven nullboard]# docker pull holtwick/briefing
Using default tag: latest
latest: Pulling from holtwick/briefing
661ff4d9561e: Pull complete
89059ca18a98: Pull complete
9bb776f8ddb0: Pull complete
ef0b6390b7f1: Pull complete
e4cdfee850fc: Pull complete
4f4fb700ef54: Pull complete
Digest: sha256:bd6afac29ce56fdcb689e03204dd00ebcfdd2690a55a817fdc00ef0799a4c99b
Status: Downloaded newer image for holtwick/briefing:latest
docker.io/holtwick/briefing:latest
五、部署briefing速查表
5.1 使用docker-cli创建briefing容器
使用docker-cli快速部署briefing容器
docker run -d \ \
--name briefing \
-v /datar/briefing/data:/app/data \
-p 6802:8080 \
--restart always \
holtwick/briefing
5.2 创建挂载目录
创建挂载目录
[root@jeven ~]# mkdir -p /data/briefing
[root@jeven ~]# cd /data/briefing/
5.3 编辑docker-compose.yaml文件
本次实践部署使用docker compose方式,编辑docker-compose.yaml文件。
version: '3'
services:
briefing:
image: holtwick/briefing
restart: always
volumes:
- /datar/briefing/data:/app/data
ports:
- 6802:8080
# networks:
# default:
# external:
# name: proxy
5.4 运行briefing容器
使用docker-compose.yaml文件创建briefing容器
[root@jeven briefing]# docker compose up -d
[+] Running 2/2
⠿ Network briefing_default Created 0.0s
⠿ Container briefing-briefing-1 Started 1.2s
5.5 检查briefing容器状态
检查briefing容器状态,确保briefing容器正常启动。
[root@jeven briefing]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9c08e1730708 holtwick/briefing "docker-entrypoint.s…" 39 seconds ago Up 37 seconds 3478/tcp, 0.0.0.0:6802->8080/tcp, :::6802->8080/tcp briefing-briefing-1
5.6 检查briefing容器日志
检查briefing容器运行日志,确保briefing服务正常启动。
[root@jeven briefing]# docker logs briefing-briefing-1
Zerva: Vite serving from /app/www
Zerva: *********************************************************
Zerva: Open page at http://localhost:8080
Zerva: *********************************************************
六、配置反向代理
6.1 安装nginx
由于是测试环境,本次反向代理直接部署在本地Docker宿主机同一台服务器上,直接使用yum快速安装nginx。
yum -y install nginx
启动nginx服务
[root@jeven briefing]# systemctl enable --now nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
检查nginx服务状态
[root@jeven briefing]# systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2023-12-26 16:40:11 CST; 24s ago
Process: 81723 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
Process: 81720 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 81718 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Main PID: 81725 (nginx)
Tasks: 3
Memory: 2.1M
CGroup: /system.slice/nginx.service
├─81725 nginx: master process /usr/sbin/nginx
├─81726 nginx: worker process
└─81727 nginx: worker process
Dec 26 16:40:10 jeven systemd[1]: Starting The nginx HTTP and reverse proxy server...
Dec 26 16:40:11 jeven nginx[81720]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Dec 26 16:40:11 jeven nginx[81720]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Dec 26 16:40:11 jeven systemd[1]: Started The nginx HTTP and reverse proxy server.
6.2 创建证书相关文件
- 生成私钥
openssl genrsa -out nginx.key 2048
- 生成证书
openssl req -new -key nginx.key -out nginx.csr
openssl x509 -req -in nginx.csr -signkey nginx.key -out nginx.pem
- 检查证书相关文件
[root@jeven briefing]# ls
docker-compose.yaml nginx.csr nginx.key nginx.pem
6.3 修改nginx配置文件
修改nginx配置文件/etc/nginx/nginx.conf
- 备份nginx.conf文件
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
- 修改nginx.conf文件,修改位置如图中标注。
vim /etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# upstream web {
# server 192.168.3.166;
# }
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://192.168.3.166:6802;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /data/briefing/nginx.pem;
ssl_certificate_key /data/briefing/nginx.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
proxy_pass http://192.168.3.166:6802;
}
}
}
6.4 重启nginx服务
重启nginx服务
systemctl restart nginx
七、访问briefing首页
访问地址:https://192.168.3.166/,将IP替换为自己服务器IP地址,进入到briefing首页。如果无法访问,则检查服务器防火墙是否设置,云服务器的安全组端口是否放行等。
将链接地址发送给视频聊天的人员就可以了,这里由于是台式机没有摄像头显示。