21
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

インフラ勉強会のGROWIを同時編集可能にする

Last updated at Posted at 2018-12-22

こちらは インフラ勉強会Advent Calendar 21 日目の記事です。


前置き

インフラ勉強会の中で最も古いサービスと言ってもいいwikiシステム「GROWI」。
当勉強会では前バージョンの「Crowi-Plus」時代から使っており、最近コンテナ化したらしい。

手順

GROWI v3.2.0でHackMDに対応し、wikiの同時編集が可能になったのでこれは追加するしかない。

現在のバージョンは

GROWI 3.3.3

HackMD用のコンテナを作成

$cd growi
$vim docker-compose.override.yml   ←新規作成

docker-compose.override.yml

docker-compose.override.yml
version: '3'

services:
  ##
  # HackMD(CodiMD) container
  # see https://github.com/hackmdio/codimd#configuration
  #
  hackmd:
    build:
      context: ./hackmd
    environment:
      - GROWI_URI=https://wiki.infra-workshop.tech
      - HMD_DB_URL=mysql://hackmd:hackmdpass@mariadb:3306/hackmd
      - HMD_CSP_ENABLE=false
    ports:
      - 3100:3000   # localhost only by default
    depends_on:
      - mariadb

  ##
  # MariaDB
  # see https://hub.docker.com/_/mariadb/
  mariadb:
    image: mariadb:10.3
    command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
    environment:
      - MYSQL_USER=hackmd
      - MYSQL_PASSWORD=hackmdpass
      - MYSQL_DATABASE=hackmd
      - MYSQL_RANDOM_ROOT_PASSWORD=true
    volumes:
      - mariadb_data:/var/lib/mysql

volumes:
  mariadb_data:

docker-compose.ymlの編集

$vim docker-compose.yml

docker-compose.yml

docker-compose.yml
version: '3'

services:
  app:
    build:
      context: .
      dockerfile: ./Dockerfile
    ports:
      - 3000:3000    # localhost only by default
    links:
      - mongo:mongo
      - elasticsearch:elasticsearch
    depends_on:
      - mongo
      - elasticsearch
    environment:
      - MONGO_URI=mongodb://mongo:27017/growi
      - ELASTICSEARCH_URI=http://elasticsearch:9200/growi
      - PASSWORD_SEED=changeme
      # - 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=https://hackmd.infra-workshop.tech    # 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 # 追加

    command: "dockerize
              -wait tcp://mongo:27017
              -wait tcp://elasticsearch:9200
              -timeout 60s
              npm run server:prod"
    volumes:
      - growi_data:/data

  mongo:
    image: mongo:3.4
    volumes:
      - mongo_configdb:/data/configdb
      - mongo_db:/data/db

  elasticsearch:
    image: elasticsearch:5.3-alpine
    environment:
      - "ES_JAVA_OPTS=-Xms256m -Xmx256m"  # increase amount if you have enough memory
    command:
      - sh
      - -c
      - "./bin/elasticsearch-plugin list | grep -q analysis-kuromoji || ./bin/elasticsearch-plugin install analysis-kuromoji;
        ./bin/elasticsearch-plugin list | grep -q analysis-icu || ./bin/elasticsearch-plugin install analysis-icu;![Bad Request]()

        /docker-entrypoint.sh elasticsearch"
    volumes:
      - es_data:/usr/share/elasticsearch/data
      - es_plugins:/usr/share/elasticsearch/plugins
      - ./esconfig:/usr/share/elasticsearch/config

volumes:
  growi_data:
  mongo_configdb:
  mongo_db:
  es_data:
  es_plugins:

docker-composeの起動

$ docker-compose up -d

ポート開放をし、WAN側からtcp3100 にアクセスできるようにする。

実際の画面
442-1.PNG

編集画面
442-2.PNG

以上

21
13
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?