Vagrant Docker Docker-compose で オンプレミスのビジネスチャット RocketChat 導入

# Vagrant Docker Docker-compose で オンプレミスのビジネスチャット RocketChat 導入

Qiita内でも調べてみたけど、１つの記事ですべて解決できなかったので投稿。
具体的に詰まったのは、
* http://localhost:3000 につながらない
* **ERROR:**  OPLOG / REPLICASET IS REQUIRED TO RUN ROCKET.CHAT, MORE INFORMATION AT:  |                                       ➔ |  https://go.rocket.chat/i/oplog-required と出てうまくDocker-composeが起動できてない


以下、自分用のOnenoteよりコピペなので見づらいですが

###### vagrant, docker, docker-compose, windows10, install, rocketchat

試したのはWindows10で

## Vagrant install

[VirtualBox+Vagrantで楽々Docker環境構築（Windows）](https://qiita.com/mikoski01/items/7ed36ac9e402658bb93e)
2019/7現在：上記のままやるとエラー。http://localhost:3000 で繋がらない
mongo replica の設定が必要らしいので、このノートページの最下部を参照に！

VirtualBox install
https://www.virtualbox.org/wiki/Downloads
Vagrant install
https://www.vagrantup.com/downloads.html

### Vagrantプラグインのインストール
```
// Guest Additions の手動再インストールの手間をなくすプラグイン　おすすめとのこと
PS C:\dokoka> vagrant plugin install vagrant-vbguest
// プロキシ使う場合はこれも
PS C:\dokoka> vagrant plugin install vagrant-proxyconf
```


### dockerVM @ vagrant
Dockerコンテナ導入

```
PS C:\dokoka> cd <適当なフォルダ>
PS C:\dokoka> git clone https://github.com/sesela/vagrant-ubuntu-for-docker.git
PS C:\dokoka> cd vagrant-ubuntu-for-docker
PS C:\dokoka\vagrant-ubuntu-for-docker> vagrant up

// SSH接続
PS C:\dokoka\vagrant-ubuntu-for-docker> vagrant ssh
// USER/PWD は vagrant:vagrant

// サービス終了
PS C:\dokoka\vagrant-ubuntu-for-docker> vagrant halt
```

### setup Docker Compose & RocketChat @ dockerVM

Instead of using the standard Docker commands, you may wish for a bit more automated management of the deployment. This is where the use of Docker-compose may come in handy.
• Make sure you have Docker and Docker-compose installed and operational.
• Create docker-compose.yml based on our example. This is the ONLY file you will need. You can create this file on your own machine by copy and pasting the content.
• Edit image: rocketchat/rocket.chat:develop to specify which image you wish to use (see section Docker Images Available )
• Edit ROOT_URL to match your domain name or IP address

You can download our docker-compose.yaml:

```
curl -L https://raw.githubusercontent.com/RocketChat/Rocket.Chat/develop/docker-compose.yml -o docker-compose.yml
```

Start the mongodb server by:

```
docker-compose up -d mongo
```

The first time you start mongo, you’ll also need to initialize it before being able to use Rocket.Chat. Ensure that mongo is in the running state, then:

```
docker-compose up -d mongo-init-replica
```

Mongo supports 24 x 7 operations and live backup. You should not need to restart it too frequently. See mongodb documentations for proper operation and management of a mongo server.
Once you’re sure that mongodb is up and running:

```
docker-compose up -d rocketchat
```

Optionally, if you want to manage your messages and configuration information, edit the file again to uncomment the volume mounts. Make sure you have a datasubdirectory to mount and store the data.
Optionally, if you want a bot, so you don’t have to talk to yourself, after you’ve created an admin user and also a bot user, edit the file docker-compose.yml again to change the variables ROCKETCHAT_USER and ROCKETCHAT_PASSWORD in the hubot section and then start up hubot:

```
docker-compose up -d hubot
```

To update the rocketchat docker image to the latest version, you can use the following commands. Your data should not be affected by this, since it’s located in the mongo image.

```
docker pull rocketchat/rocket.chat:develop
docker-compose stop rocketchat
docker-compose rm rocketchat
docker-compose up -d rocketchat
```
貼り付け元  <https://rocket.chat/docs/installation/docker-containers/docker-compose/>