2020-07-07 23:14:42 +02:00
2020-07-07 23:14:42 +02:00
2020-05-31 22:38:19 +02:00
2020-07-07 23:14:42 +02:00
2020-07-03 10:23:03 +02:00
2020-06-24 04:48:12 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-07-07 23:14:42 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-07-01 06:39:02 +02:00
2020-07-01 06:39:02 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-05-31 22:38:19 +02:00
2020-06-16 17:11:04 +02:00
2020-05-31 22:38:19 +02:00

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 feature. 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 and verification token keys provided along with the account number that is available after login into the Zoom account. You need to have Zoom PRO subscription in order to use this feature.

Zoom.us api keys

  1. Log in to you zoom.us account
  2. Go to https://marketplace.zoom.us/develop/create
  3. Choose JWT application
  4. Copy API Key and API Secret
  5. Set up ZOOM_API_KEY and ZOOM_API_SECRET environment variables

Setup

There is some configuration that has to be done through the API on the Zoom account so that you can use the feature. Run rails zoom:setup rake task to do it.

Zoom.us webhooks

To ensure integrity in between different Zoom environments, the app uses Zoom webhooks. To set them up, go to https://marketplace.czoom.us -> Develop -> JWT app -> Feature -> Event Subscriptions and enable following hooks:

  • Start Meeting
  • End Meeting
  • All Recordings have completed
  • User has been created
  • User had been deleted

Syncing app with Zoom account configuration

If you are setting up the app to use Zoom account that has been previously used with DirectME, it is a good idea to make sure that the db state reflects the account situation. To do that, run rails zoom:sync rake task.

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

  1. Verify redis has been installed
  2. Set REDIS_URL in your .env file
    REDIS_URL=redis://127.0.0.1:6379
    
  3. Start Sidekiq
    bundle exec sidekiq -q default -q mailers -c 5
    

Setup pairing script

Check out the repo here

  • Tool to add two or more authors on a commit message quickly
  • Make sure to add yourself or new devs to the .pairs file 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.

  1. Drop the databases
    rails db:drop
    
  2. 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
Description
No description provided
Readme 6.8 MiB
Languages
Ruby 78%
HTML 17.5%
JavaScript 3.7%
SCSS 0.7%