๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
์›น๊ณต๋ทฐ

firebase spark ์š”๊ธˆ์ œ ํ”„๋กœ์ ํŠธ ๊ธฐ๋ณธ ์„ค์ •

by ์ด๋…ธํ‚ค_ 2022. 3. 23.

0. ํ•„์š”ํ™˜๊ฒฝ

- node

- firebase์— ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ์™„๋ฃŒ 

 

1. firebase ์„ค์น˜

user> npm install -g firebase-tools
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated debug@4.1.0: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
ues/797)
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

added 695 packages, and audited 696 packages in 23s

35 packages are looking for funding
  run `npm fund` for details

10 vulnerabilities (7 moderate, 3 high)

To address all issues, run:
  npm audit fix

vulnerabilities ๋ผ๊ณ ๋Š” ๋‚˜์˜ค๋Š”๋ฐ ๊ฐœ๋ฐœ์ค‘์—๋Š” ๋ณ„ ๋ฌธ์ œ ์—†์–ด์„œ ๋ฌด์‹œํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค.

 

2. firebase login

user> firebase login
i  Firebase optionally collects CLI usage and error reporting information to help improve our products. Data is collected in accordance with Google's privacy policy (https://policies.google.com/privacy) and is not used to identify you.

? Allow Firebase to collect CLI usage and error reporting information? No

Visit this URL on this device to log in:

Waiting for authentication...

+  Success! Logged in as xxxxx@gmail.com

 

์—๋Ÿฌ ๋ฆฌํฌํŒ… ํ• ๊บผ๋ƒ๊ณ  ๋ฌผ์–ด์„œ No.

๊ทธ๋‹ค์Œ์—” ์•Œ์•„์„œ ๋ธŒ๋ผ์šฐ์ €์— google ๊ณ„์ • ์—ฐ๋™ ํ™”๋ฉด์ด ๋œจ๊ณ , ๋กœ๊ทธ์ธ ์„ฑ๊ณตํ•˜๋ฉด ๋.

 

3. ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ ๋ฐ ์ด๋™

ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ ํ›„, ๊ทธ ๋””๋ ‰ํ† ๋ฆฌ๋กœ cd 

 

4. firebase init

user> firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  D:\demo

? Are you ready to proceed? Yes
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confir
m your choices. Realtime Database: Configure a security rules file for Realtime Database and (optionally) provision defa
ult instance, Firestore: Configure security rules and indexes files for Firestore, Hosting: Configure files for Firebase
 Hosting and (optionally) set up GitHub Action deploys, Storage: Configure a security rules file for Cloud Storage, Emul
ators: Set up local emulators for Firebase products

=== Project Setup

First, let's associate this project directory with a Firebase project.
You can create multiple project aliases by running firebase use --add,
but for now we'll just set up a default project.

? Please select an option: Use an existing project
? Select a default Firebase project for this directory: demo-vf (demo-vf)
i  Using project demo-vf (demo-vf)

=== Database Setup
i  database: ensuring required API firebasedatabase.googleapis.com is enabled...
+  database: required API firebasedatabase.googleapis.com is enabled


Firebase Realtime Database Security Rules allow you to define how your data should be
structured and when your data can be read from and written to.

? What file should be used for Realtime Database Security Rules? database.rules.json
+  Database Rules for demo-vf-default-rtdb have been written to database.rules.json.
Future modifications to database.rules.json will update Realtime Database Security Rules when you run
firebase deploy.

=== Firestore Setup

Firestore Security Rules allow you to define how and when to allow
requests. You can keep these rules in your project directory
and publish them with firebase deploy.

? What file should be used for Firestore Rules? firestore.rules

Firestore indexes allow you to perform complex queries while
maintaining performance that scales with the size of the result
set. You can keep index definitions in your project directory
and publish them with firebase deploy.

? What file should be used for Firestore indexes? firestore.indexes.json


Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with firebase deploy. If you
have a build process for your assets, use your build's output directory.

? What do you want to use as your public directory? public
? Configure as a single-page app (rewrite all urls to /index.html)? No
? Set up automatic builds and deploys with GitHub? No
+  Wrote public/404.html
+  Wrote public/index.html

=== Storage Setup

Firebase Storage Security Rules allow you to define how and when to allow
uploads and downloads. You can keep these rules in your project directory
and publish them with firebase deploy.

? What file should be used for Storage Rules? storage.rules
+  Wrote storage.rules

=== Emulators Setup
? Which Firebase emulators do you want to set up? Press Space to select emulators, then Enter to confirm your choices. 
Authentication Emulator, Firestore Emulator, Database Emulator, Hosting Emulator, Storage Emulator
? Which port do you want to use for the auth emulator? 9099
? Which port do you want to use for the firestore emulator? 8080
? Which port do you want to use for the database emulator? 9000
? Which port do you want to use for the hosting emulator? 5000
? Which port do you want to use for the storage emulator? 9199
? Would you like to enable the Emulator UI? Yes
? Which port do you want to use for the Emulator UI (leave empty to use any available port)?
? Would you like to download the emulators now? Yes

i  Writing configuration info to firebase.json...
i  Writing project information to .firebaserc...
i  Writing gitignore file to .gitignore...

+  Firebase initialization complete!

* Which Firebase features do you want to set up for this directory?

- ๋ฌด์Šจ feature ์„ ํƒํ• ๊บผ๋ƒ. 

- ์ฐธ์กฐ https://yonglimlee.tistory.com/entry/firebase-deploy-์‹œ-์š”๊ธˆ์ œ-์ˆ˜์ •ํ•˜๋ผ๋Š”-์˜ค๋ฅ˜-๋ฉ”์‹œ์ง€ [๊ทธ๋ฆฐ ์—”์ง€๋‹ˆ์–ด ๐ŸŒฟ] 

 

* Database Setup

- ๊ธฐ๋ณธ ์„ ํƒ

* Firestore Setup

- rules๋“ค์€ ๊ธฐ๋ณธ ์„ ํƒ

- spa๊ฐ€ ํ˜„์žฌ ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์— no.

? What do you want to use as your public directory? public
? Configure as a single-page app (rewrite all urls to /index.html)? No
? Set up automatic builds and deploys with GitHub? No
+  Wrote public/404.html
+  Wrote public/index.html

* Storagesetup

- ๊ธฐ๋ณธ ์„ ํƒ

* Emulators Setup

- Authentication Emulator, Firestore Emulator, Database Emulator, Hosting Emulator, Storage Emulator ์„ ํƒ

- ํฌํŠธ๋Š” ๊ธฐ๋ณธ ์„ ํƒ

 

 

 

๋Œ“๊ธ€