This is the backend for the Simple app to help track hypertensive patients across a population.
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.
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
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
The app can be configured using a .env file. Look at .env.development for sample configuration
The application will start at http://localhost:3000.
RAILS_ENV=development bundle exec rails server
RAILS_ENV=test bundle exec rspec
API Documentation can be accessed at /api-docs
on local server and hosted at https://api.simple.org/api-docs
Architecture decisions are captured in ADR format and are available in /doc/arch
These are not actively committed into the repository. But can be generated by running bundle exec erd
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 runningssh-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
The contribution guidelines can be found here.