Links

Self-hosted Installation

Run your own Ethernal instance

Prerequisites

Node.js: v12.9.1 minimum
Yarn: 1.3.2

Core Setup

Install the Firebase CLI:
curl -sL firebase.tools | bash
git clone [email protected]:tryethernal/ethernal.git
cd ethernal
Initialize Firebase with the following options:
  • Realtime Database
  • Firestore
  • Functions
  • Emulators
When asked to overwrite database.rules.json, firestore.rules.json, and firestore.indexes.json, say No.
Leave the default for the Firestore rules (firestore.rules), and Firestore indexes (firestore.index.json)
Choose Javascript when asked which language to pick for Cloud functions.
For ESLint/style enforcement, choose No
Do not overwrite functions/package.json functions/index.js and functions/.gitignore
Choose Yes when asked to install dependencies with npm now
For the emulator setup, leave all the default selected options and validate everything.
Login with:
firebase login
The Fiebase setup should be done now!
Install all the frontend dependencies by running
yarn
Setup frontend environment variables:
touch .env.development
Inside this file:
VUE_APP_FIREBASE_API_KEY=123
VUE_APP_FIREBASE_PROJECT_ID=ethernal-1234
VUE_APP_AUTH_HOST=http://localhost:9099
VUE_APP_FIRESTORE_HOST=localhost:8080
VUE_APP_RTDB_HOST=localhost:9000
VUE_APP_FIREBASE_DATABASE_URL=http://localhost:9000/?ns=ethernal-1234-default-rtdb
VUE_APP_FUNCTIONS_HOST=http://localhost:5001
VUE_APP_API_ROOT_URL=http://localhost:8081
VUE_APP_ROOT_URL=http://localhost:8081
VUE_APP_ETHERSCAN_API_KEY=youretherscankey
VUE_APP_STRIPE_PUBLIC_KEY=yourstripetestkey
Replace the Etherscan API key with your own, same for the Stripe public key.
Setup backend environment variables:
cd functions/
touch .runtimeconfig.json
Inside this file:
{
"encryption": {
"jwt_secret": "jwtsecret",
"key": "jwtkey"
},
"fb": {
"token": "yourcitoken"
},
"etherscan": {
"token": "yourtoken"
},
"stripe": {
"public_key": "stripepublickey",
"secret_key": "stripesecretkey",
"webhook_secret": "webhooksecret"
},
"ethernal": {
"root_url": "http://localhost:8081",
"plans": {
"premium": "premium_plan"
}
}
}
Fill with:
  • encryption.jwt_secret: 64 characters
  • ecnryption.key: 32 characters
  • fb.token: Your Firebase CI token that you can get by running firebase login:ci
  • etherscan.token: your Etherscan API token
  • stripe.public_key: Any string
  • stripe.secret_key: Any string
  • stripe.webhook_secret: Any string
  • ethernal.root_url: the url of your app
  • ethernal.plans.premium: Any string
Run the backend on the emulator with:
firebase emulators:start --import=./firebase-emulator --export-on-exit --project ethernal-1234
Run the frontend with:
yarn serve
The import option will make the data persistent.

Hardhat Plugin Setup

Production Firebase instance

By default, the plugin is going to connected to the Firebase instance used by https://app.tryethernal.com. To make it connect to your own instance, you'll need to set the environment variables that are defined in this file: https://github.com/tryethernal/hardhat-ethernal/blob/v0.3.5/src/config.ts
You can also specify them only when running the node:
FIREBASE_API_KEY=123 FIREBASE_PROJECT_ID=ethernal npx hardhat node

Local Emulator

To connect to the local emulator, you need to pass specific environment variables that will trigger the dev mode:
NODE_ENV=development AUTH_HOST=http://localhost:9099 FUNCTIONS_HOST=http://localhost:5001 RTDB_HOST=localhost:9000 FIRESTORE_HOST=localhost:8080 npx hardhat node

CLI Setup

Production Firebase Instance

TODO

Local Emulator

Create a .envfile:
touch .env
With the following inside:
AUTH_HOST=http://localhost:9099
FUNCTIONS_HOST=http://localhost:5001
RTDB_HOST=localhost:9000
FIRESTORE_HOST=localhost:8080
And run:
NODE_ENV=development ethernal listen