Ansible로 CentOS7에 GROWI 설정

9861 단어 AnsibleGrowi

환경



ansible 2.9.3
대상 노드: CentOS Linux release 7.7.1908 (Core)

Growi란 무엇인가



Markdown으로 쓸 수 있는 wiki인 것 같습니다.
고기능의 사용법을 할 수 있는 듯? 그래서 개인으로 사용하는 경우도 좋을지도입니다.
htps : // / cs. 글쎄. 오 rg / 자 / 구이로 /

디렉토리 구조


|-- docker_playbook.yml
|-- files
|   `-- docker-compose.yml
`-- hosts

docker_playbook.yml



docker_playbook.yml
---
- hosts: growi
  tasks:
    - name: upgrade all packages
      yum:
       name: '*'
       state: latest

    - name: yum install for docokertools
      yum:
       name: device-mapper-persistent-data,lvm2,yum-utils,git
       state: latest
       update_cache: yes

    - name: add docker repo
      tags: dockerinst
      shell: "yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo"
      args:
        chdir: "/etc/yum.repos.d"
        creates: docker-ce.repo

    - name: yum install docker ce
      tags: dockerinst
      yum:
       name: docker-ce,docker-ce-cli,containerd.io
       state: latest
       update_cache: yes

    - name: Make sure a service is running
      tags: dockerinst
      systemd:
       state: started
       enabled: yes
       name: docker

    - name: mkdir /growi/
      tags: docker_settings
      file: 
       path: /growi/ 
       state: directory 
       owner: root 
       group: root 
       mode: 0755

    - name: git clone groei-docker-compose.git
      git: 
       repo: https://github.com/weseek/growi-docker-compose.git 
       dest: /growi/
       force: yes

    - name: copy docker-comopose.yml
      tags: files_copy
      copy:
       src:  ./files/docker-compose.yml
       dest: /growi/

    - name: docker-comopose install
      tags: docker_settings
      shell: "curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose"

    - name: docker-comopose chmod
      tags: docker_settings
      shell: "chmod +x /usr/local/bin/docker-compose"

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=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 60s
              npm run server:prod"
    restart: unless-stopped
    volumes:
      - growi_data:/data

  mongo:
    image: mongo:3.6
    restart: unless-stopped
    volumes:
      - mongo_configdb:/data/configdb
      - mongo_db:/data/db

  elasticsearch:
    build:
      context: ./elasticsearch
      dockerfile: ./Dockerfile
    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
    volumes:
      - es_data:/usr/share/elasticsearch/data
      - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml

volumes:
  growi_data:
  mongo_configdb:
  mongo_db:
  es_data:

hosts



ansible 인벤토리이므로 필요에 따라 다시 작성하십시오.
[growi]
192.168.1.107 ansible_user=root ansible_password=password

실행하다


# ansible-playbook -i hosts docker_playbook.yml

실행 후



대상 서버에 ssh 후 docker-compose up -d합니다.
# cd /growi/
# docker-compose up -d

브라우저에서
http://타겟 노드의 IP:3000/
에 액세스하여 다음 화면이 나오면 설치 완료입니다.


적당하게 사용자 만들어 로그인하면 이런 느낌입니다.

좋은 웹페이지 즐겨찾기