facebook twitter hatena line email

「Gcp/Firebase/Hosting」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ドメインつなぎ込み)
(同じ利用者による、間の1版が非表示)
行35: 行35:
 
functionsのhelloWorldメソッドにアクセスできる
 
functionsのhelloWorldメソッドにアクセスできる
  
==ドメインつなぎ込み==
+
==httpsドメインつなぎ込み==
 
#firebase/hostingのドメインを接続 ボタンを押す
 
#firebase/hostingのドメインを接続 ボタンを押す
 
#設定したいdomain入力
 
#設定したいdomain入力
行48: 行48:
 
==料金==
 
==料金==
 
===無料 Spark プラン===
 
===無料 Spark プラン===
GB 保存済み 1 GB
+
*GB 保存済み 1 GB
GB 転送済み 10 GB/月
+
*GB 転送済み 10 GB/月
  
 
===$25/月 Flame プラン===
 
===$25/月 Flame プラン===
GB 保存済み 10 GB
+
*GB 保存済み 10 GB
GB 転送済み 50 GB/月
+
*GB 転送済み 50 GB/月
  
 
===従量制 Blaze プラン===
 
===従量制 Blaze プラン===
GB 保存済み $0.026/GB
+
*GB 保存済み $0.026/GB
GB 転送済み $0.15/GB
+
*GB 転送済み $0.15/GB

2020年1月7日 (火) 02:37時点における版

hostingコード作成から反映

$ npm install -g firebase-tools
$ firebase login
$ firebase init hosting
$ firebase deploy

hostingを選択してspaceを押す

Must select at least one feature. Use SPACEBAR to select features, or provide a feature with firebase init [feature_name]エラー

spaceを押して選択する

httpアクセス

ttps://xxxx-xxxxxx.firebaseapp.com/

public/index.html がそのまま公開される

firebaseのfunctionsと連携

vi firebase.json

{
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [ {
      "source": "/helloWorld", "function": "helloWorld"
    } ]
  }
}

ttps://xxxx-xxxxxx.firebaseapp.com/helloWorld にアクセスすると、 functionsのhelloWorldメソッドにアクセスできる

httpsドメインつなぎ込み

  1. firebase/hostingのドメインを接続 ボタンを押す
  2. 設定したいdomain入力
  3. 以下のようなドメイン設定のためのTXTの値が出る
google-site-verification=12341234xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  1. TXTをドメインに登録する
  2. 設定後firebaseのドメイン接続で確認ボタンを押す
  3. 確認が取れたら、Aレコードが2つ表示されるので、それを再度登録。

Aレコードでつなげれば、24時間以内にssl(let'sEncrypt)が対応された。CNAMEだとだめ

料金

無料 Spark プラン

  • GB 保存済み 1 GB
  • GB 転送済み 10 GB/月

$25/月 Flame プラン

  • GB 保存済み 10 GB
  • GB 転送済み 50 GB/月

従量制 Blaze プラン

  • GB 保存済み $0.026/GB
  • GB 転送済み $0.15/GB