Skip to content
A Rails backend to support the Simple.org mobile app
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Delete key before running district analytics warmup May 24, 2019
bin WHO cohort report generator Apr 17, 2019
config Fix warmup for quarterly analytics May 22, 2019
db Remove User association from CallLogs in favour of caller_phone_number May 17, 2019
doc Add contribution guidelines Jan 18, 2019
lib Display facilities by district - Analytics Cache Jobs May 17, 2019
log Initial commit May 7, 2018
public Added a favicon Apr 24, 2019
spec Fix failing Call Log specs May 21, 2019
swagger Adding appointment type as part of the API sync payload Apr 30, 2019
tmp
vendor Initial commit May 7, 2018
.env.development Display facilities by district instead of Facility Group May 17, 2019
.env.test Display facilities by district instead of Facility Group May 17, 2019
.gitignore Add generator for migrating to newer API version Apr 16, 2019
.rspec Installed rspec-rails May 7, 2018
.ruby-version Use capistrano to deploy app Jun 12, 2018
CHANGELOG.md Changelog for release-2019-05-24-1 May 24, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md (#231) Jan 25, 2019
Capfile Fix capfile require Apr 17, 2019
Gemfile Backend automation (#387) May 16, 2019
Gemfile.lock Backend automation (#387) May 16, 2019
LICENSE Added LICENSE May 7, 2018
README.md Set Rails production logger to INFO rather than DEBUG May 14, 2019
Rakefile Prevents BotUser initialization when migrations are running May 17, 2019
config.ru Initial commit May 7, 2018
package.json Rename the redapp-server repo to simple-server Jul 16, 2018

README.md

Simple Server

Build Status

This is the backend for the Simple app to help track hypertensive patients across a population.

Development Setup

First, you need to install ruby: https://www.ruby-lang.org/en/documentation/installation It is recommended to use rbenv to manage ruby versions: https://github.com/rbenv/rbenv

gem install bundler
bundle install
rake db:create db:setup db:migrate

To run simple-android app with the server running locally, you can use ngrok https://ngrok.com

brew cask install ngrok
rails server
ngrok http 3000

The output of the ngrok command will have an url that can be used to access local-server. This url should be set as qaApiEndpoint in gradle.properties.

Workers

We use sidekiq to run async tasks. To run, first make sure that redis (>4) is installed:

brew install redis

# after installing ensure your redis version is >4
redis-server -v

Start the sidekiq process by running

bundle exec sidekiq

Testing Email

We use Mailcatcher for testing email in development. Please use the following to set it up on your machine.

Note: Please don't add Mailcatcher to the Gemfile, as it causes conflicts.

gem install mailcatcher
mailcatcher

Now you should be able to see test emails at http://localhost:1080

Configuring

The app can be configured using a .env file. Look at .env.development for sample configuration

Running the application locally

The application will start at http://localhost:3000.

RAILS_ENV=development bundle exec rails server

Running the tests

RAILS_ENV=test bundle exec rspec

Documentation

  • API Documentation can be accessed at /api-docs on local server
  • Architecture decisions are captured in ADR format and are available in /doc/arch

Deployment

  • simple-server is deployed to the environment using capistrano.
  • Make sure you add your SSH keys as single sign-on so that cap doesn't get confused when there's more than 1 instance to deal with. You can do this simply by running ssh-add -K ~/.ssh/id_rsa.
bundle exec cap <enviroment> deploy
# eg: bundle exec cap staging deploy

Rake tasks can be run on the deployed server using capistrano as well. For example,

bundle exec cap staging deploy:rake task=db:seed

Contributing

The contribution guidelines can be found here.

You can’t perform that action at this time.