/confy

Primary LanguageJavaScript

Build Status Code Climate Test Coverage

Confy

Table of Contents

Prerequisites

  • Docker
  • Docker Compose

Installation

$ docker build -t confy:1.0 .
$ CONFY_VERSION=1.0 docker-compose run web rake db:setup

Config

In order for the application to work you need to configure your environment. Check out .env.example for a .env template.

HOSTNAME: address on which your rails server is running. Usually https://localhost:PORT where PORT is 3000 by default

NOTIFICATION_HOST: hostname where Google should send push notifications. Check Gotchas#Push Notifications

APPLICATION_OWNER: email address - can be anybody who has owner status in Google Developer Console

GOOGLE_CLIENT_(ID|SECRET): look in Google Developer Console Confy > Credentials > OAuth 2.0 client IDs > Web Client 1

GOOGLE_(CLIENT_EMAIL|PRIVATE_KEY|DEFAULT_CLIENT_ID): go to Google Developer Console and Confy > Credentials > Service Account keys > Manage service accounts then add a new private key for push-notifications service account. This will create a new private key file - find the necessary fields there

SECRET_KEY_BASE: used by rails. You can use rails secret to generate a secure secret key. Look in secrets.yml for more info

Or you can just ask someone for their .env file :)

Encryption

Several files are encrypted: .env.enc, gcloud_credentials.json.enc, kubernetes/env.yml.enc

You can decrypt/encrypt them using key that can be found in LastPass, Shared-confy/ENV_CRYPT_KEY

Encrypt:

$ openssl enc -aes-256-cbc -k $ENV_CRYPT_KEY -in .env -out .env.enc

Decrypt:

$ openssl enc -d -aes-256-cbc -k $ENV_CRYPT_KEY -in .env.enc -out .env2

Running the development server

$ CONFY_VERSION=1.0 docker-compose up

This will run the Rails server, Postgres, Redis, Sidekiq, as well as a Webpack development server that will hot reload assets as you change them.

Running tests

Rails tests

$ CONFY_VERSION=1.0 docker-compose run web bundle exec rspec

Or

$ CONFY_VERSION=1.0 docker-compose run web bundle exec guard

to watch for test and code changes

Here's how to setup Guard in RubyMine

React tests

$ CONFY_VERSION=1.0 docker-compose run web npm run test

or

$ CONFY_VERSION=1.0 docker-compose run web rake test:client

Linting

$ CONFY_VERSION=1.0 docker-compose run web npm run lint

Running all tests

$ CONFY_VERSION=1.0 docker-compose run web rake test:all

Deployment

Kubernetes

After successful test phase, travis automatically pushes new image to GCR (only when git tag is present) with appropriate version derived from git tag.

You need to manually change image version in kubernetes/confy-app.yml and kubernetes/cron.yml files and then apply changes in order to deploy new version.

Once you've done that, run

kubectl apply -f kubernetes/confy-app.yml --namespace confy
kubectl apply -f kubernetes/cron.yml --namespace confy

Check the pods

kubectl get pods --namespace confy

Gotchas

Push notifications

If you want to have push notifications from Google work locally you will need to expose your local server to the Internet. First of all, install ngrok.

Once you've done that, run

$ ngrok http 3000

which will create a tunnel to your local server.

Unfortunately the free version of ngrok will generate a random domain for you every time you run it. That means you will need to verify this domain in Google Developer Console every time you restart the ngrok server. To verify your domain go to Google Domain Verification, add your ngrok domain and follow the instructions.

Once your domain is verified you also need to set NOTIFICATION_HOST to your ngrok domain in .env.

Resources

Here's some reading if you're bored! (or you want to learn more about Confy and the technologies it uses)

Confy Native

This is a native client for iOS and Android devices.

Development

In order to start the development you need to install the Expo CLI. More info here

Deployment

Once the development is finished you can publish the changes using the expo command. More info here

cd native
$ expo publish

All the necessary credentials you will find in LastPass

Building

In case you changes require a new IPA/APK build you can use the expo command too. More info here

cd native
$ expo build:android
$ expo build:ios

Client Configuration

  • In order to install the client on the mobile device, you need to download the newest version of IPA/APK file on the device.
  • In case of Android device you can email the build URL which you can find on the expo builds page
  • Just download the file and install it on the device.
  • You will probably need to authorize the device
  • In the Confy app setting section you will be able to associate the device with one of the conference rooms.

Device Authorization

In case your device is not yet authorized, you can do it in the Confy Admin Panel Find the device on the list (by name or device id) and authorize it. Once you do it, please re-open the Confy application.

All the necessary credentials you will find in LastPass

Automate

For better user experience on Adroid devices we use Automate. It allow us to wake up the Confy app at the specific time and put the device to sleep after certain hour. You can find the Confy automate flow in the automate public directory. Just search for Confy and install the flow on the device and activate the flow.