Hello Gmom!
This is a tiny Rails application for sending messages and photos to Bren's Grandmother. ^_^
Requirements & Dependencies
- Rails 5 (because we're living in the future)
- A Twilio account, phone number, and API key.
- rvm
- Postgres (but this is Rails, so use whatevs)
- Redis (for ActionCable/websocket connections in production)
- Nginx (
conf/nginx.conf
can be customized, or replaced with whatevs) - Puma (because Unicorn has problems upgrading requests for websocket connections)
.env
When the Rails app boots, it's gonna load key/value pairs from a .env
file in the application root. This is where we put sensitive values, like API keys, so do not add your .env
to source control.
Here are the values Rails expects to be in .env
:
- SECRET_KEY_BASE: Call me old school, but I use
rake secret
for this - TWILIO_ACCOUNT_SID: provided by Twilio once you've created an account
- TWILIO_AUTH_TOKEN: same as above ^
- TWILIO_NUMBER: you gotta buy this from Twilio. It's the number to which you'll send sms/mms messages
- DB_USER: Rails looks here for database credentials when booting in production
- DB_PASS: yup ^
- Seed phone numbers: Rails seeds
Sender
objects.Sender
s are the list of approved numbers to which the app responds. Everyone else gets a403 Forbidden
. Have a look atdb/seeds.rb
to see what Rails is expecting.
Setup
- Clone the repo
- Enter clone directory & verify gemset creation/use (
$ rvm gemset list
, hello-gmom should be active gemset) - Install Bundler (
$ gem install bundler
) - Install gem dependencies (
$ bundle
) - Customize...
- Create and populate
.env
- Update database seeds (
db/seeds.rb
) - Update database credentials for development/test (
config/database.yml
) or set up a Postgres role to match what's already in the file. (create role hello_gmom with createdb login password 'whatevs';
) - Setup the database (
$ rake db:setup
) - Start the server (
$ rails server
)
Useful articles
Here's a list of articles I referenced while working on this. Maybe they'll help you too.