4.4 KiB
Setup
Install RVM to manage ruby version:
\curl -sSL https://get.rvm.io | bash
rvm install 2.6.3
Install external dependencies:
For MacOS:
brew tap heroku/brew && brew install heroku
brew install postgres
brew install redis
brew install ffmpeg
brew install yarn
For Linux (Ubuntu):
curl https://cli-assets.heroku.com/install.sh | sh
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install redis-server
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get install ffmpeg
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn
Then run:
bin/setup
to create your databases
You will need to:
- Get environment variables from fellow teammates to populate into
.env(See env.sample for examples) - AWS account to have access to S3 buckets
- Heroku account to deploy
- Set DOMAIN and WEB_PORT variables - otherwise application won't work properly. Use DOMAIN=localhost and WEB_PORT=3000 for the default values
- Set ZOOM_API_KEY and ZOOM_API_SECRET to integrate with Zoom.us for automatic meeting creation.
After filling up the .env with correct values Run setup again:
bin/setup
Running tests
rspec
yarn test
Running Data migrations
rails data:migrate
Current deployment pipeline on Heroku
- Review -> Staging |-> Production |-> Demo
Working with environments using Parity
Parity provides Heroku command wrappers for each environment under the bin folder.
Useful Heroku commands
Manually Deploying to Review
The Review environment is auto-deployed from GitHub master. But if you need to manually deploy:
bin/review deploy
Running migrations manually (should be done automatically by Heroku via Procfile)
bin/review run db:migrate
Rails console into Review environment
bin/review console
We keep locale files sorted in alphabetical order. This can be done programmatically
rake i18n:sort
Zoom.us integration
DirectMe app offers live broadcasting. Users are offered to paralelly connect to the Zoom meeting to have a video conference while the streaming happens. In order to use the Zoom functionality, the app needs to have the API keys provided. You need Zoom PRO account for this feature.
Zoom.us api keys
- Log in to you zoom.us account
- Go to https://marketplace.zoom.us/develop/create
- Choose JWT application
- Copy API Key and API Secret
Working Locally
Polling for analysis status updates
When videos are uploaded, a video/audio analysis process is initiated. Typically the analysis process sends an SNS notification when it is completed. Those SNS notifications hit a webhook URL within the app to update the status accordingly. This requires a public URL, which you likely won't have in development.
As an alternative, we can poll for status updates using the following Rake task.
rake dev:poll_for_analysis_updates
To run this continuously, there is a Clockwork scheduler included.
bin/clockwork lib/dev_clockwork.rb
Running a real async background queue locally
- Verify redis has been installed
- Set REDIS_URL in your
.envfileREDIS_URL=redis://127.0.0.1:6379 - Start Sidekiq
bundle exec sidekiq -q default -q mailers -c 5
Setup pairing script
- Tool to add two or more authors on a commit message quickly
- Make sure to add yourself or new devs to the
.pairsfile in the repo
cd /usr/local/bin && curl -L http://github.com/pivotal/git_scripts/tarball/master | gunzip | tar xvf - --strip=2
then git pair XX where XX are your initials from the pairs file
Enjoy!
Problems with setting up environment
Database setup
If the setup fails in the point after at least one of the databases have been set up.
- Drop the databases
rails db:drop - Run the setup again.
Optional helpers
Run rubocop fix script as a pre-commit git hook
Add following as .git/hooks/pre-commit file
#!/bin/sh
exec ./bin/rubocopfix.sh