0
0

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セットアップ on CentOS 8 Stream

Last updated at Posted at 2022-05-01

前提

# cat /etc/centos-release
CentOS Stream release 8

主にChromeで見る予定

事前準備

一応やっとこう

dnf update
dnf upgrade
dnf clean all
reboot

インストール

アプリ実行環境の構築まで。Nginxは割愛します。

#!/bin/bash

# gitインストール
dnf install git -y

# dockerインストール・起動・有効化
dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
dnf --nobest install docker-ce -y
systemctl start docker
systemctl enable docker

# docker-composeインストール
curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

# 本体DL
git clone https://github.com/weseek/growi-docker-compose.git /opt/growi

# 外部からのアクセスを許可
sed -i -e 's/127.0.0.1:3000:3000/3000:3000/g' /opt/growi/docker-compose.yml

# serviceファイル作成
cat << "_EOF_" > /etc/systemd/system/growi.service
[Unit]
Description = growi.service

[Service]
WorkingDirectory = /opt/growi
ExecStartPre = /usr/local/bin/docker-compose down
ExecStart = /usr/local/bin/docker-compose up
ExecStop = /usr/local/bin/docker-compose down
Restart = always
Type = simple

[Install]
WantedBy = multi-user.target
_EOF_

# service有効化
systemctl enable growi

# 起動
systemctl start growi

バックアップ・リストア

backupGrowi.sh

mongoコンテナからdumpしたファイルをBK_ROOT/BK_DIRに抽出。cronで適当に定期実行しとけばよさげ

#!/bin/bash

BK_ROOT=/backup
BK_DIR=`date '+%Y_%m%d_%H%M'`

# バックアップ先ルートディレクトリの有無確認
if [[ ! -e $BK_ROOT ]] ; then
        echo $BK_ROOT not found. exit.
        exit
fi

# バックアップ先ディレクトリを掘って移動
mkdir $BK_ROOT/$BK_DIR
cd $BK_ROOT/$BK_DIR

# カレントにバックアップ
/usr/bin/docker exec -d growi_mongo_1 mongodump --archive=mongodb.archive
/usr/bin/docker cp growi_mongo_1:/mongodb.archive ./

restoreGrowi.sh

backupGrowi.shで取得したバックアップファイルを指定して、DBに突っ込む

#!/bin/bash

echo "リストア対象のデータをフルパスで指定してください(例:/backup/2022_0502_0101/mongodb.archive)"
read mongo_archive

# ファイル存在確認
if [[ ! -e $mongo_archive ]] ; then
        echo " $mongo_archive がありません。終了します"
        exit
fi

cd `dirname $mongo_archive`

# カレントからリストア
docker cp mongodb.archive growi_mongo_1:/
docker exec -d growi_mongo_1 mongorestore --drop --archive=mongodb.archive

おまけ

GrowiのGUIがゴテゴテすぎるので、uBlockのマイフィルターで諸々の表示を削る(on GROWI 5.0.4)

!サイドバーを削除
my.growi.server.com##.grw-sidebar-nav
my.growi.server.com##.p-3.grw-sidebar-content-header
!コメント機能を削除  
my.growi.server.com##.d-print-none.d-edit-none.py-4.mt-5.page-comments-row
my.growi.server.com##.mt-2.grw-page-accessories-control
!Topバーの邪魔者を削除  
my.growi.server.com##.waves-light.waves-effect.bg-transparent.border-0.nav-link.px-3
my.growi.server.com##.bg-transparent.border-0.btn-create-page.nav-link.px-md-3
my.growi.server.com##.waves-light.waves-effect.nav-link.px-md-3
my.growi.server.com##.text-light.confidential.nav-item
my.growi.server.com##.text-muted.bg-transparent
!タグ関連機能の削除 
my.growi.server.com##.form-inline.grw-tag-labels
!HackMD機能の削除 
my.growi.server.com##.disabled.px-1.hackmd-button.btn-outline-primary.btn
!足跡機能の削除
my.growi.server.com##.border-0.btn-seen-user.btn 
my.growi.server.com##.page-list-meta
!ふぁぼ機能の削除  
my.growi.server.com###grw-subnav-container > .container-fluid.justify-content-between.align-items-center.d-flex.grw-subnav > div.d-flex > .py-md-2.flex-column.d-flex > div.h-50.justify-content-center.align-items-end.flex-column.d-flex > .d-flex > div.btn-group > .border-0.btn-like.btn 
my.growi.server.com##.d-print-none.grw-subnav-compact.container-fluid.justify-content-between.align-items-center.d-flex.grw-subnav > div.d-flex > .py-md-2.flex-column.d-flex > div.h-50.justify-content-center.align-items-end.flex-column.d-flex > .d-flex > div.btn-group > .border-0.btn-like.btn
!Bookmark機能の削除  
my.growi.server.com###grw-subnav-container > .container-fluid.justify-content-between.align-items-center.d-flex.grw-subnav > div.d-flex > .py-md-2.flex-column.d-flex > div.h-50.justify-content-center.align-items-end.flex-column.d-flex > .d-flex > div.btn-group > .border-0.btn-bookmark.btn 
my.growi.server.com##.d-print-none.grw-subnav-compact.container-fluid.justify-content-between.align-items-center.d-flex.grw-subnav > div.d-flex > .py-md-2.flex-column.d-flex > div.h-50.justify-content-center.align-items-end.flex-column.d-flex > .d-flex > div.btn-group > .border-0.btn-bookmark.btn
!Watch/通知機能の削除  
my.growi.server.com###grw-subnav-container > .container-fluid.justify-content-between.align-items-center.d-flex.grw-subnav > div.d-flex > .py-md-2.flex-column.d-flex > div.h-50.justify-content-center.align-items-end.flex-column.d-flex > .d-flex > span > .border-0.btn-subscribe.btn
my.growi.server.com##.d-print-none.grw-subnav-compact.container-fluid.justify-content-between.align-items-center.d-flex.grw-subnav > div.d-flex > .py-md-2.flex-column.d-flex > div.h-50.justify-content-center.align-items-end.flex-column.d-flex > .d-flex > span > .border-0.btn-subscribe.btn
!新規ページ作成機能の削除  
my.growi.server.com##.waves-light.waves-effect.p-0.rounded-circle.btn-primary.btn-create-page.btn-lg.btn
!作成日時の表示を削除  
my.growi.server.com##.ml-3.mb-0.pl-4.py-2.d-edit-none.d-lg-block.d-none.border-left.text-nowrap.authors
!個人情報表示の削除  
my.growi.server.com###pagetree-item-626e7ca4434bbad97d0cb84a > .align-items-center.d-flex.pr-3.py-0.border-0.list-group-item-action.list-group-item
my.growi.server.com##.d-md-block.d-none.mr-2

参考

有識者各位

0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?