:doodle { @grid: 22 / 100vmax; background: #12152f; } :after { font-family: devicons; content: '\@hex(@rand(58894, 59050))'; font-size: 3.6vmax; color: hsla( @rand(360), 70%, 70%,@rand(.9) ); } @keyframes turn { 0, 30% { transform: rotate(0deg); } 30% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } :hover { animation: turn 1.4s 0s ease-out infinite; }

使用Docker部署FlarumChina

前期准备

服务器安装 Docker 和 Docker Compose

参考教程:
http://get.daocloud.io/#install-docker

没有服务器的可以在本地安装 Docker 或使用 DaoCloud 的胶囊主机, 能免费体验 120 分钟,足够学习使用

路径:自有主机 -> 集群管理 -> 添加主机

深度截图_选择区域_20170807083400

安装 Flarum

我们使用到的镜像是 raincal/docker-flarum-china

Ports

8888

Volume

  • /flarum/app/assets : FlarumChina 资源目录
  • /flarum/app/extensions : FlarumChina 插件目录

环境变量

变量描述类型默认值
UIDFlarum user idoptional991
GIDFlarum group idoptional991
DEBUGFlarum debug modeoptionalfalse
FORUM_URLForum URLrequirednone
DB_HOSTMariaDB instance ip/hostnameoptionalmariadb
DB_USERMariaDB database usernameoptionalflarum
DB_NAMEMariaDB database nameoptionalflarum
DB_PASSMariaDB database passwordrequirednone
DB_PREFFlarum tables prefixoptionalnone
UPLOAD_MAX_SIZEThe maximum size of an uploaded fileoptional50M
MEMORY_LIMITmaximum amount of memory used by phpoptional128M

编写 docker-compose.yml 文件

1
2
mkdir flarum && cd flarum
vi docker-compose.yml

根据自身情况 修改

FORUM_URL

DB_PASS

MYSQL_ROOT_PASSWORD

MYSQL_PASSWORD

等环境变量

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
flarum:
image: raincal/docker-flarum-china:0.1.0-beta.7-stable
container_name: flarum
links:
- mariadb:mariadb
environment:
- FORUM_URL=https://forum.domain.tld
- DB_PASS=123456
volumes:
- /mnt/docker/flarum/assets:/flarum/app/assets
- /mnt/docker/flarum/extensions:/flarum/app/extensions

mariadb:
image: mariadb:10.1
container_name: mariadb
volumes:
- /mnt/docker/mysql/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_DATABASE=flarum
- MYSQL_USER=flarum
- MYSQL_PASSWORD=123456

nginx:
image: wonderfall/boring-nginx
container_name: nginx
links:
- flarum:flarum
ports:
- "80:8000"
- "443:4430"
volumes:
- /mnt/docker/nginx/sites-enabled:/sites-enabled
- /mnt/docker/nginx/conf:/conf.d
- /mnt/docker/nginx/log:/var/log/nginx
- /mnt/docker/nginx/certs:/certs

启动应用

docker-compose up -d

若使用胶囊主机,可以到 自有主机 -> Stack -> 创建新 Stack

深度截图_选择区域_20170807084450

设置 nginx 反向代理

通过 ssh 连接到胶囊主机

ssh ubuntu@52.80.37.119

深度截图_选择区域_20170807093749
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
docker exec -it nginx ngxproxy

Welcome to ngxproxy utility.
We're about to create a new virtual host (AKA server block).

Name: flarum
Domain: forum.domain.tld
Webroot (default is /):
Container: flarum
Port (default is 80): 8888
HTTPS [y/n]: n
Max body size in MB (integer/null): 50

Done! flarum.conf has been generated.
Reload nginx now? [y/n]: y
nginx successfully reloaded.

完成后访问外网IP 52.80.37.119,本地环境的话访问 localhost 开始安装 flarum

管理员密码需要大于8位

screencapture-54-222-128-207-1502096436141
新年快乐 (゜-゜)つロ