Skip to content

TatsuyaYamamoto/dl-code.web.app

Repository files navigation

DLCode.web.app

CircleCI code style: prettier

hosted in https://dl-code.web.app/

なにこれ

  1. つくるひと
    1. 曲とか絵とかのファイルを作って
    2. ProductFileとしてアプリに登録して
    3. DownloadCodeを発行して
    4. DownloadCodeを何かしらの手段で たのしむひと にお渡しして
    5. たのしむひとProductFileをダウンロードしてもらう
  2. たのしむひと
    1. 何かしらの手段で つくるひと からDownloadCodeを手に入れて
    2. https://dl-code.web.app/ にアクセスして
    3. DownloadCode を入力して
    4. ProductFileをダウンロードして
    5. 楽しい!!

Dev and Deploy

// start next.js dev server
$ yarn dev

// start firebase emulator
$ yarn start

// some commits...

$ yarn build-dev
$ yarn deploy-dev
// or
$ git push origin develop # deploy by CircleCI

Settings

Operation Logging

  • GCP Console > Operation Logging > Log Viewer > シンクを作成

    • シンク名: cloud-functions-error-log

    • シンクサービス: Pub/Sub

    • シンクのエクスポート先: firebase functions 上のcloud-functions-error-log

    • フィルタ

      resource.type="cloud_function"
      severity>=WARNING
      

firebase functions config

// dev
$ KEY=slack            ; firebase functions:config:set $KEY="$(cat .runtimeconfig.json | jq ".$KEY")" --project dl-code-dev
// pro
$ KEY=slack            ; firebase functions:config:set $KEY="$(cat .runtimeconfig.pro.json | jq ".$KEY")" --project dl-code

attach roles to Service Account for firestore exporting

$ PROJECT_ID=dl-code-dev
$ SERVICE_ACCOUNT=${PROJECT_ID}@appspot.gserviceaccount.com
$ BUCKET_NAME=${PROJECT_ID}.appspot.com

$ gcloud projects add-iam-policy-binding ${PROJECT_ID} \
      --member serviceAccount:${SERVICE_ACCOUNT} \
      --role roles/datastore.importExportAdmin

$ gsutil iam ch serviceAccount:${SERVICE_ACCOUNT}:admin gs://${BUCKET_NAME}

Ref. https://firebase.google.com/docs/firestore/solutions/schedule-export#configure_access_permissions

storage cors

$ gsutil cors set firebase/cors.json gs://dl-code-dev.appspot.com

Ref: https://firebase.google.com/docs/storage/web/download-files#cors_configuration

Firebase functions execution permission for AllUsers

Service account's permittion for getSignedUrl()

Bucket#getSignedUrl()

Error: IAM Service Account Credentials API has not been used in project *** before or it is disabled.
Enable it by visiting https://console.developers.google.com/apis/api/iamcredentials.googleapis.com/overview?project=*** then retry.
If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

name: 'SigningError'

=> enable API

Error: The caller does not have permission

name: 'SigningError'

=> Cloud Console > IAM & admin > IAM, Find the App Engine default service account and add the Service Account Token Creator role (サービス アカウント トークン作成者)

About

Issues download code and publish awesome product files!

Resources

Stars

Watchers

Forks

Packages

No packages published