- install node.js which includes npm from: https://nodejs.org/en/download/
- get the repo
git clone https://github.com/unliketea/PuugPersonalWebRu.git
- inside the checkout, install packages:
npm install
- install required global packages:
npm install -g firebase-tools
npm install -g gatsby-cli
- login or reauth:
firebase login
orfirebase login --reauth
- setup an account at stripe.com and ensure the slider is set to
Test mode
- define a few variables in
functions/.runtimeconfig.json
:- from stripe; developers -> API keys -> Secret key:
stripe.privatekey
- from stripe; developers -> API keys -> Secret key:
- define a few variables in
.env
:- from stripe; developers -> API keys -> Publishable key:
GATSBY_STRIPE_PUBLIC_KEY
, - from firebase console; Authentication -> Sign-in method -> Authorised domains:
GATSBY_FIREBASE_AUTH_DOMAIN
, - from firebase console; Project settings -> Project ID:
GATSBY_FIREBASE_PROJECT_ID
- from firebase console; Project settings -> Web API Key:
GATSBY_FIREBASE_API_KEY
- from stripe; developers -> API keys -> Publishable key:
- for local development, run
firebase emulators:start --only functions,auth,firestore
then you can use:gatsby develop
- to test ssr first build (
gatsby build
) then use:firebase emulators:start
- install required modules:
npm install
- local development requires you define a few other variables in
.env
- Uncomment
FIREBASE_AUTH_EMULATOR_HOST
when you want to connect to your local Auth emulator - Path to firebase admin sdk key file:
GOOGLE_DEFAULT_CREDENTIALS
; download from firebase console; Project settings -> Service accounts -> Generate new private key
- Uncomment
- Run a utility with
node <scriptname>
- firebase hosting is handled via a github action on push, which needs a few secrets defined (at Settings -> Secrets -> Actions)
- run
firebase init hosting
, part of which will create FIREBASE_SERVICE_ACCOUNT_<Project ID> - from firebase console; Project settings -> Web API Key:
GATSBY_FIREBASE_API_KEY
- from stripe; developers -> API keys -> Publishable key:
GATSBY_STRIPE_PUBLIC_KEY
- run
- deploy firebase functions with
firebase deploy --only functions
- New https callable function require permissions for
allUsers
asFunction Invoker
at: https://console.cloud.google.com/functions/list?project=puugpersonalwebru
- New https callable function require permissions for
- deploy firebase firestore rules with
firebase deploy --only firestore:rules