Follow these steps to setup the App for creators.brave.com. This guide presumes you are using OSX and Homebrew.
-
Install Ruby. For a Ruby version manager try rbenv. Follow the
Installation
section instructions and ensure your version is at least 1.1.2. Once installed runrbenv install
. Be sure to restart your terminal before continuing. -
Install Node 6.12.3 or greater:
brew install node
-
Install Postgresql 9.5+:
brew install postgresql
If you get the error
psql: FATAL: role “postgres” does not exist
. You'll need to create the/usr/local/opt/postgres/bin/createuser -s postgres
-
Install Redis:
brew install redis
-
Install Ruby gems:
gem install bundler foreman mailcatcher
. -
Install Yarn for Node dependency management:
brew install yarn
-
Install project dependencies
Ruby dependencies:
bundle install
Possible errors:
- Nokogiri, with libxml2. Try installing a system libxml2
with
brew install libxml2
and thenbundle config build.nokogiri --use-system-libraries
then againbundle install
- Run
gem install nokogiri -v '1.10.3'
and thenbundle install
Node dependencies:
yarn --frozen-lockfile
Your version of Node must be v11.15.0 or earlier. For a node version manager, try NVM.
- Nokogiri, with libxml2. Try installing a system libxml2
with
-
Install git-secrets with
brew install git-secrets
This prevents AWS keys from being committed. -
(Optional) Get a
.env
file from another developer which contains development-mode env vars. You can start developing without this, but some functionality may be limited. -
Install Rails:
gem install rails
Be sure to restart your terminal before continuing.
-
Configure SSL certs
make certs
-
Start Postgres and Redis:
brew services start redis postgresql
-
Create and initialize the database:
rails db:create RAILS_ENV=development rails db:migrate RAILS_ENV=development
Note: If you receive a
fatal-role
error, try running/usr/local/opt/postgres/bin/createuser -s postgres
due to being installed fromhomebrew
. Further documentation is here.If you receive an error about Readline, try running:
ln -s /usr/local/opt/readline/lib/libreadline.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
Issue for further documentation.
-
Run Rails server and async worker:
bundle exec puma -C config/puma.rb -e ${RACK_ENV:-development}
bundle exec sidekiq -C config/sidekiq.yml -e ${RACK_ENV:-development}
-
Visit https://localhost:3000
-
To test email, run a local mail server with:
mailcatcher
-
To view the emails sent to your inbox visit: http://localhost:1080
-
Run webpack separately:
./bin/webpack-dev-server
-
Compile landing page assets:
cd public/landing-page; rake assets:clobber; rake assets:precompile; yarn install; yarn build