# GCPにGROWIを構築する 03 独自ドメイン設定
https://yakoi.qrunch.io/entries/HFbmdSlpB4qyqZx7の続き。
# ドメイン取得
Freenomでドメイン取得。 いろいろなところで解説されているので省略。 ここでは「sample.tk」を取得したと仮定して話を進める。
# サーバ設定
サーバにはいり、~/growi/docker-compose.ymlを修正。 ポート80でhttpアクセスできるように、services/app/portsを変更。 コロンの左がDockerの外で右がDockerの中かな。間違えないように。
version: '3'
services:
app:
build:
context: .
dockerfile: ./Dockerfile
ports:
- 80: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=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
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.4
ports:
- 27017:27017
# command: mongod --bind_ip 0.0.0.0
restart: unless-stopped
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;
/docker-entrypoint.sh elasticsearch"
restart: unless-stopped
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# DNS設定
GCPコンソールより、ネットワークサービス→Cloud DNSを選択 ゾーンの作成から新規ゾーンを作成。 ゾーンの詳細の「レコードセットを追加」ボタンから、Aレコードを追加。サーバのIPアドレスを指定してやります。 サーバのIPアドレスは「VPCネットワーク」→「外部IPアドレス」にて取得してあるはず。 最終設定はこちら。
DNS 名 | タイプ | TTL(秒) | データ |
---|---|---|---|
sample.tk. | NS | 21600 | ns-cloud-e1.googledomains.com. ns-cloud-e2.googledomains.com. ns-cloud-e3.googledomains.com. ns-cloud-e4.googledomains.com. |
sample.tk. | SOA | 21600 | ns-cloud-e1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300 |
wiki.sample.tk. | A | 300 | xxx.xxx.xxx.xxx |
FreenomでNameserversの設定をしてやります。
Management Tools→Namerserversで設定できます。
Use custom nameserversを選択し、5つのテキストボックスのうち4つをGCP画面の4つのネームサーバに設定します。
以上で、http://wiki.sample.tkでつながるようになるはずです。