在树莓派上使用Docker容器轻松构建Growi

通过阅读本文,可以做到的事情。

可以使用Docker在Raspberry Pi上构建Growi。

中国语的表达方式:“Growi”是什么?

 

环境

    • Raspbery Pi4 4GB

 

    Raspbian 64bit

操作指南

进行更新和升级。

sudo apt-get update && sudo apt-get upgrade

安装 Docker

curl -sSL https://get.docker.com | sh

请执行以下命令,并确认结果。

docker --version
dockerVersion.png

3. 安装 Docker-Compose

sudo apt-get install libffi-dev libssl-dev
sudo pip3 install docker-compose

请执行以下命令,以确认结果。

docker-compose --version
dockerCompose.png

获取为Raspberry Pi而分叉的容器。

git clone https://github.com/temple1026/growi-docker-compose-pi.git growi

根据自己的环境修改growi文件夹中的yaml文件。

cd growi
nano docker-compose.yaml

只需要一种选择:修订点仅修正为引用存在的路径。
请参考下面进行修订。

version: '3'
services:
  growi:
    build:
      context: .
      dockerfile: ./Dockerfile
    image: growi-pi:4.0.7 # Please change if you need
    container_name: growi
    ports:
      - 3000:3000    # 修正ポイント
      # - 3000:3000 # my setting
    links:
      - mongo:mongo
      - elasticsearch:elasticsearch
    depends_on:
      - mongo
      - elasticsearch
    environment:
      - MONGO_URI=mongodb://mongo:27017/growi
      - ELASTICSEARCH_URI=http://elasticsearch:9200/growi
      # - PASSWORD_SEED=password
      # - FILE_UPLOAD=mongodb   # activate this line if you use MongoDB GridFS rather than AWS
      # - FILE_UPLOAD=local     # activate this line if you use local storage of server rather than AWS
      # - MATHJAX=1             # activate this line if you want to use MathJax
      # - PLANTUML_URI=http://  # activate this line and specify if you use your own PlantUML server rather than public plantuml.com
      # - HACKMD_URI=http://    # activate this line and specify HackMD server URI which can be accessed from GROWI client browsers
      # - HACKMD_URI_FOR_SERVER=http://hackmd:3000  # activate this line and specify HackMD server URI which can be accessed from this server container
      # - FORCE_WIKI_MODE='public'    # activate this line to force wiki public mode
      # - FORCE_WIKI_MODE='private'   # activate this line to force wiki private mode

    command: "dockerize
               -wait tcp://mongo:27017
               -wait tcp://elasticsearch:9200
               -timeout 120s
               npm run server:prod" # Changed 60s to 120s.
    # command: npm run server:prod 
    restart: unless-stopped
    volumes:
      - /home/pi/Desktop/growi/growi/data # 修正ポイント
    tty: true

  mongo:
    image: arm64v8/mongo:3.6
    container_name: mongo
    restart: unless-stopped
    volumes:
      - /home/pi/Desktop/growi/growi/mongoConfigDB  # 修正ポイント 
      - /home/pi/Desktop/growi/growi/mongoDB        # 修正ポイント

  elasticsearch:
    # image: webhippie/elasticsearch:6.4
    build:
      context: ./elasticsearch
      dockerfile: ./Dockerfile
    image: elasticsearch:6.6.1
    container_name: es
    command: sh bin/elasticsearch
    environment:
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"  # increase amount if you have enough memory
    ulimits:
      memlock:
        soft: -1
        hard: -1
    restart: unless-stopped
    ports:
      - 9200:9200
      - 9300:9300
    volumes:
      - /home/pi/Desktop/growi/growi/ESData  # 修正ポイント
      - ./elasticsearch/config:/usr/share/elasticsearch/config
    tty: true

启动容器

sudo docker-compose up -b --build

确认Raspberry Pi的IP地址

ifconfig

8. 访问Growi

(raspberryPiのIPアドレス):3000
image.png

参考来源的网站

我在树莓派4上安装了Ubuntu,并构建了Growi。

广告
将在 10 秒后关闭
bannerAds