自建Docker bbs论坛 flarum

date
Oct 25, 2022
slug
newservice-bbs-flarum
status
Published
summary
新服务 论坛
tags
service
type
Post
notion image

Summary

notion image

步骤

 
export DOCKER_PROJ=flarum_lily
export DOCKER_PORT=18600
export DOCKER_PSWD=aQ8Y66
mkdir /data/$DOCKER_PROJ; cd /data/$DOCKER_PROJ


cat > docker-compose.yml <<EOF
version: "3"

services:
  $DOCKER_PROJ:
    image: mondedie/flarum:stable
    container_name: $DOCKER_PROJ
    env_file:
      - $(pwd)/flarum.env   # 创建一个flarum.env
    volumes:   # 数据映射到本地,数据不会因为Docker停止而丢失
      - $(pwd)/assets:/flarum/app/public/assets
      - $(pwd)/extensions:/flarum/app/extensions
      - $(pwd)/storage/logs:/flarum/app/storage/logs
      - $(pwd)/nginx:/etc/nginx/flarum
    ports:
      - $DOCKER_PORT:8888   # 左边的8080可以自己调整端口号,右边的8888不要改
    restart: unless-stopped
    environment:
      - PUID=0        # 如何查看当前用户的PUIDPGID,直接命令行输入id就行
      - PGID=0
      - TZ=Asia/Hong_Kong
    depends_on:
      - ${DOCKER_PROJ}_mariadb

  ${DOCKER_PROJ}_mariadb:
    image: mariadb:10.5
    container_name: ${DOCKER_PROJ}_mariadb
    environment:
      - MYSQL_ROOT_PASSWORD=$DOCKER_PSWD
      - MYSQL_DATABASE=flarum
      - MYSQL_USER=flarum
      - MYSQL_PASSWORD=$DOCKER_PSWD
    volumes:
      - $(pwd)/mariadb:/var/lib/mysql  # 数据映射到本地,数据不会因为Docker停止而丢失
    restart: unless-stopped

networks:
  default:
    name: npm_nginx_proxy_manager-network
    external: true
EOF


export DOCKER_URL=bbs.xxx.xxx
export DOCKER_DEFAULT_EMAIL=9527@xxx.org

cat > $(pwd)/flarum.env <<EOF
DEBUG=false
FORUM_URL=https://$DOCKER_URL     # 可以自行修改,这个是论坛的网站  注意域名地址没有的话 要填IP+port 要不然会报错

# Database configuration
DB_HOST=${DOCKER_PROJ}_mariadb
DB_NAME=flarum
DB_USER=flarum
DB_PASS=$DOCKER_PSWD    # 可以自行修改,但是要与docker-compose上面的一致
DB_PREF=flarum_
DB_PORT=3306

# User admin flarum (environment variable for first installation)
# admin password must contain at least 8 characters
FLARUM_ADMIN_USER=flarum          # 可以自行修改,但是要与docker-compose上面的一致
FLARUM_ADMIN_PASS=$DOCKER_PSWD  # 可以自行修改,但是要与docker-compose上面的一致
FLARUM_ADMIN_MAIL=$DOCKER_DEFAULT_EMAIL  # 可以自行修改,修改成自己的邮箱
FLARUM_TITLE=BBS Flarum for All Things S # 可以自行修改,这个是论坛的标题
EOF

docker-compose down; docker-compose up -d; sleep 1s; docker-compose logs -f

local cache / cloudflare cache都要关闭,不然安装会有各种问题

CloudFlare设立新的域名

notion image

npm nginx proxy manager配置

 
notion image
notion image

安装拓展extension

中文

docker exec -ti $DOCKER_PROJ extension require flarum-lang/chinese-simplified

docker exec -ti $DOCKER_PROJ extension require nearata/flarum-ext-twofactor

docker exec -ti $DOCKER_PROJ extension require jeromegillard/map:"*"
docker exec -ti $DOCKER_PROJ extension require justoverclock/users-map-location:"*"
docker exec -ti $DOCKER_PROJ extension require avatar4eg/flarum-ext-geotags
notion image
notion image
notion image
notion image

验证

notion image
 
 

© Ying Bun 2021 - 2024