Getting Started
How to install a local dev env in one click
This guide will walk you through how to install our learn project GoodBootstrap that will install all our sub projects: GoodServer , GoodContracts, GoodDAPP and GoodGun
Prerequisites
Important: Use node version 14
The most easier way to manage node version is using nvm. Here's example how to set proper node version with it:
Install build tools
Install mobile developer tools
IOS
install / update to the latest xCode
install CocoaPods:
Android
Follow the guides:
ubuntu expanded guide
Quick start
DApp-only install
Clone the repository and install dependencies
Important: always specify --frozen-lockfile
yarn flag to keep packages to being updated. Otherwise you could get error during build because the latest versions of some packages aren't compatible for the RN version used.
Environment .env file
Copy .env.development
to .env
, then append .env
file with the following creds:
You could take missing creds from the Netlify's gooddev.netlify.app
instance or ask your team leader for the complete .env
file
Running the app
iOS hints
Don't forget to open ios/GoodDollar.xcworkspace
(NOT .xcodeproj
!) and set up provisional profile and developer account.
Install with the local server instance
Prerequisites
Install MongoDB 4.x:
guide for macOS: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
guide for Linux: https://docs.mongodb.com/manual/administration/install-on-linux/
Configure mongo to run as a cluster. Add your local computer's hostname or it's IP in the home network to the bindIp
list:
GunDB
Clone the repository and install dependencies
The .env.example
file provided is using mongoDB as the storage. Don't use it. For the local development, the direct filesystem should be used. To achieve this, create .env
file with the following contents:
GoodServer
Clone the repository and install dependencies
Copy .env.dev
to .env
, then append .env
file with the following creds:
You could take missing creds from the Heroku's good-server
instance or ask your team leader for the complete .env
file
GoodDAPP
Install and configure application the same way as described in the "DApp-only install" section of this document. To use local instances of the GoodServer and GunDB, edit the following env variables:
Running
The most preferrable way to run the whole app (gun + server + dapp) locally is to use separate Terminal's tabs.
Gun
Don't forget to unload Gun after your work is done:
GoodServer
GoodDAPP
Mobile devices/emulators hints
There are issues when you want to run the app on iOS or Android with local server. It won't connect to the local GoodServer/GoodGUN instances.
The simplest way to solve this - to run the app with gooddev/goodqa server (see "DApp-only install" section of this document).
If you need the exactly local server, you have to use services to expose it to some public domain. Something like Serveo or its analogue. More detailed solution is explained at the end of this document.
Complete guide
Prerequisites
Additionally to the preparations listed at the beginning of this doc, you also have to:
Install truffle + ganache-cli
Install python 2.7.*
Clone and install
Clone the repository and install dependencies
This will create a git folder for dapp, server and contracts projects in the ./packages folder
make sure master branch is checked out.
if not run: npm run master-submodules
Set environment variables
Environment .env files
Default environment variables are set up in .env.dev
you can overwrite these variables by setting up .env
which should include all required variables
Preferably copy .env.dev to .env in all projects. .env.dev contains reasonable defaults for using with pm2. Go over env.example to for more info.
.env.dev only works when using pm2, otherwise use .env
Update missing env
in folder packages/server edit .env.dev
Start Project
This will start the local blockchain, will wait 60 seconds for contracts to finish compile and deploy and then start the server+dapp that will be linked (npm link) to use the local version of the contracts package (that's why we need to wait for them to be deployed)
Start dev env
Usually when developing you'll want to change the env variables of the dapp+server which isnt very friendly with pm2 so you might consider starting the project as follows instead of the above
Using a different blockchain network
contracts: add network in truffle-config.js and modify $NETWORK in .env
dapp: add network in src/config/config.js and modify $NETWORK in .env
server: add network in src/server/networks.js and modify $NETWORK in .env
Please note that both server and dapp must use the same blockchain network and the same @goodcontracts version.
If you are running a local blockchain make sure you start server+dapp after contracts finish deploying
GoodServer
Server side of the project is responsible to some actions that cannot be decentralized as creating a user, topping the wallet and sending confirmation emails.
Default environment variables are set up in .env.dev
you can overload this variables by setting up .env
which should include all required variables
DAPP Unit Testing
Mobile Development Environment
If you want to connect with a mobile you'd need to make sure your services run with SSL (since webcrypto requires ssl).
The easiest option is to use serveo.net by:
Last updated