Qrunch 2019-02-26 投稿記事
https://crieit.net/posts/GCP-GROWI-02の続き。
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:
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でつながるようになるはずです。
Crieitは誰でも投稿できるサービスです。 是非記事の投稿をお願いします。どんな軽い内容でも投稿できます。
また、「こんな記事が読みたいけど見つからない!」という方は是非記事投稿リクエストボードへ!
こじんまりと作業ログやメモ、進捗を書き残しておきたい方はボード機能をご利用ください。
ボードとは?
コメント