LoginSignup
1
1

More than 3 years have passed since last update.

GCEで、GoogleDomains でドメインを取得して、SSL接続できるredashを立ち上げる

Last updated at Posted at 2019-06-09

redashwoGCEにhttpsで接続できるようにしたので、メモついでに書いておきます

読む人

  • GCEでredashを立ち上げたい人

この記事のゴール

  • GCEにredashを立ち上げて、admin画面を表示する

結論

  1. GCEにredashをインストールする
  2. GCEにSSLでredashに接続する

1., 2をちゃんとやればなんとかなるはず

1. GCEにredashをインストールする Tips

インスタンスを作る

re:dash ドキュメントに書いてあるshellを実行していく
※versionが、けっこう変わっていくので注意

  • bigqueryを使う場合は、インスタンスを作る場合は、scopでbigqueryを指定する
  • machine-typeはf1-microだとメモリアウトしちゃうので、g1-smallを指定することをおすすめします(redashのドキュメントではもう一個上のインスタンスをしてすることをおすすめしています。)

$ gcloud compute images create "redash-8-0-0" --source-uri gs://redash-images/redash.8.0.0-b32245-1.tar.gz
$ gcloud compute instances create redash --image redash-8-0-0  
--scopes storage-ro,bigquery  
--machine-type g1-small --zone asia-northeast1-a

http, https アクセスを許可する

gcloud compute instances add-tags redash \
      --tags http-server,https-server \
      --zone us-west1-a

ドメインを割り当てる

  • GCPコンソールで静的アドレスを取得
  • 静的アドレスとドメインをひもづける。(Aレコード)

スクリーンショット_2019-06-10_02_09_29.png

2 GCEにSSLでredashに接続する

  • GCEにSSLでredashに接続する このgistのREADMEをちゃんとやれば大丈夫なはず
  • example.redash.com をちゃんと置換する(ここにはまった)
  • フォルダ名でも使っていて、全5箇所あるので注意

トラブルシューティング

nginx が restarting になって動かない

root@re-dash:/opt/redash# docker-compose ps
          Name                         Command               State                    Ports
-------------------------------------------------------------------------------------------------------------
redash_adhoc_worker_1       /app/bin/docker-entrypoint ...   Up      5000/tcp
redash_nginx_1              /docker-entrypoint.sh ngin ...   Restarting..      0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
redash_postgres_1           docker-entrypoint.sh postgres    Up      5432/tcp
redash_redis_1              docker-entrypoint.sh redis ...   Up      6379/tcp
redash_scheduled_worker_1   /app/bin/docker-entrypoint ...   Up      5000/tcp
redash_scheduler_1          /app/bin/docker-entrypoint ...   Up      5000/tcp
redash_server_1             /app/bin/docker-entrypoint ...   Up      0.0.0.0:5000->5000/tcp

対応方法

以下で nginx の logを確認します。

docker-compose logs nginx

自分の場合は以下のようになっていました。
/var/log/nginx/error.log を確認すると、ディレクトリーになっていました。そのため、 rm -rf access.log rm -rf error.log を排除し、touch access.log touch error.log でlogファイルを置き直しました。そしたら、直りました。

nginx_1             | 2021/02/01 03:52:29 [emerg] 1#1: open() "/var/log/nginx/error.log" failed (21: Is a directory)
nginx_1             | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
nginx_1             | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
nginx_1             | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
nginx_1             | 10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf
nginx_1             | 10-listen-on-ipv6-by-default.sh: error: /etc/nginx/conf.d/default.conf differs from the packaged version
nginx_1             | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
nginx_1             | /docker-entrypoint.sh: Configuration complete; ready for start up
nginx_1             | nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (21: Is a directory)
1
1
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
1
1