facebook twitter hatena line email

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

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(Must select at least one feature. Use SPACEBAR to select features, or provide a feature with firebase init [feature_name]エラー)
(ドメインつなぎ込み)
(同じ利用者による、間の12版が非表示)
行1: 行1:
 +
==hostingコード作成から反映==
 
  $ npm install -g firebase-tools
 
  $ npm install -g firebase-tools
 
  $ firebase login
 
  $ firebase login
  $ firebase init
+
  $ firebase init hosting
 
  $ firebase deploy
 
  $ firebase deploy
  
行33: 行34:
 
ttps://xxxx-xxxxxx.firebaseapp.com/helloWorld にアクセスすると、
 
ttps://xxxx-xxxxxx.firebaseapp.com/helloWorld にアクセスすると、
 
functionsのhelloWorldメソッドにアクセスできる
 
functionsのhelloWorldメソッドにアクセスできる
 +
 +
==httpsドメインつなぎ込み==
 +
#firebase/hostingのドメインを接続 ボタンを押す
 +
#設定したいdomain入力
 +
#以下のようなドメイン設定のためのTXTの値が出る
 +
google-site-verification=12341234xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 +
#TXTをドメインに登録する
 +
#設定後firebaseのドメイン接続で確認ボタンを押す
 +
#確認が取れたら、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

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