使用Docker快速尝试GROWI
前提条件
-
- 使用 ec2(Amazon Linux 2)操作系统
-
- 已安装 docker-compose
- 使用 letsencrypt 进行 SSL 连接
让我们来说说letsencrypt + nginx-proxy的配置
$ mkdir -p ~/docker/nginx-proxy
$ cd ~/docker/nginx-proxy
$ vim docker-compose.yml
version: '3'
services:
nginx-proxy:
image: jwilder/nginx-proxy
restart: on-failure
labels:
- com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=jwilder/nginx-proxy
ports:
- 80:80
- 443:443
volumes:
- proxy:/etc/nginx/vhost.d
- proxy:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./certs:/etc/nginx/certs:ro
network_mode: bridge
letsencrypt:
image: jrcs/letsencrypt-nginx-proxy-companion
restart: on-failure
depends_on:
- nginx-proxy
volumes:
- proxy:/etc/nginx/vhost.d
- proxy:/usr/share/nginx/html
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./certs:/etc/nginx/certs:rw
network_mode: bridge
volumes:
proxy:
启动nginx代理
$ docker-compose up -d
安装 Growi Docker Compose
$ cd ~/docker
$ git clone https://github.com/weseek/growi-docker-compose.git growi
$ cd growi
编辑docker-compose.yml文件
- コメントを参考に修正をします
version: '3'
services:
app:
restart: on-failure # [追加]
network_mode: bridge # [追加]
build:
context: .
dockerfile: ./Dockerfile
ports:
- 3000:3000 # [変更]
links:
- mongo:mongo
- elasticsearch:elasticsearch
depends_on:
- mongo
- elasticsearch
environment:
- VIRTUAL_HOST=growi.example.com # [追加] SSLで利用したいFQDN
- LETSENCRYPT_HOST=growi.example.com # [追加] SSLで利用したいFQDN
- LETSENCRYPT_EMAIL=info@example.com # [追加] letsencryptに登録するE-Mail
- MONGO_URI=mongodb://mongo:27017/growi
- ELASTICSEARCH_URI=http://elasticsearch:9200/growi
- PASSWORD_SEED=change # [変更] ランダムな64文字に置き換える!!
- FILE_UPLOAD=local
command: "dockerize
-wait tcp://mongo:27017
-wait tcp://elasticsearch:9200
-timeout 60s
npm run server:prod"
volumes:
- growi_data:/data
mongo:
restart: on-failure # [追加]
network_mode: bridge # [追加]
image: mongo:3.4
volumes:
- mongo_configdb:/data/configdb
- mongo_db:/data/db
elasticsearch:
restart: on-failure # [追加]
network_mode: bridge # [追加]
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;
/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 build
$ docker-compose up -d
最后
稍等片刻后,在浏览器中访问 https://${LETSENCRYPT_HOST}/,将会显示Growi的登录页面。