Patterns is an application to manage people that are involved with Blue Ridge Labs' Design Insight Group.
Currently specs are almost all integration specs.
Heroku Trial in progress
Patterns is a customer relationship management application at its heart. Patterns holds people that have signed up to participate with the Design Insight Group, what they like to talk about, and their involvement in research, testing, co-design and focus groups.
Patterns is a Ruby on Rails app: Mysql, Redis, Sidekiq
Additional Services: Rapidpro for sms (https://textit.com) Afterpattern for consent form signatures https://afterpattern.com LibPostal Rest API for address parsing: https://github.com/ClickSend/libpostal-rest-docker
Hosted on a single machine:
Server Set up:
ssh-add -L
If the command says that no identity is available, you'll need to add your key:
ssh-add yourkey
On Mac OS X, ssh-agent will "forget" this key, once it gets restarted during reboots. But you can import your SSH keys into Keychain using this command:
/usr/bin/ssh-add -K yourkey
Provisioning a new server:
change your .env to point production to the right url/git/branch/etc/
PRODUCTION_SERVER: "example.com"
PRODUCTION_BRANCH: "production"
STAGING_SERVER: "staging.example.com"
STAGING_BRANCH: "devlopment"
GIT_REPOSITORY: "git@github.com:example/example.git"
use the provision_new_server.sh script.
Ensure that DNS for your hostname is pointing at the server, or else this script will exit.
provision_new_server.sh staging staging.example.com admin@example.com
will provision staging
don't forget to add your deploy key and person ssh pubkey to the provision.sh script!
run 'cap staging deploy:setup' (if you are deploying to staging)
run 'cap staging deploy:cold' ( starts up all of the daemons.)
SSL certificates are provided free of charge and automatically updated by LetsEncrypt!
Should be pretty plug and play, make sure you have these environment variables set:
Once those are set, should be as simple as pushing to heroku, and ensuring that the database is setup. Note: Must use JAWSDB for mysql, as the schema requires a reasonable recent version of mysql to run.
Patterns uses encypted credentials. All of what is needed is in "sample_environment.yml" in config/credentials. You should fork this repository and setup your own credentials. We strongly recommend different encrypted credentials for each environment (production, development, staging, test etc.)
You can edit credentials like so:
rails credentials:edit --environment production
Mailchimp:
SMTP
Backups!
rails credentials:edit --environment production
rake backup
rake download_backup path_to_private_key {optional_filename}
openssl genrsa -out patterns.pem 2048
openssl rsa -in patterns.pem -outform PEM -pubout -out patterns_public.pem
{"Statement": [ { "Effect": "Allow", "Action": [ "s3:PutObject" ], "Resource": "arn:aws:s3:::YOURBUCKETNAME/*", "Condition": {} }, { "Effect": "Allow", "Action": "s3:ListBucket", "Resource": "arn:aws:s3:::YOURBUCKETNAME/*", "Condition": {} }, { "Effect": "Allow", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::YOURBUCKETNAME/*", "Condition": {} } ] }
People
Research Session Completeness
Digital GiftCard Cancel
Main development occurs in the development branch. HEAD on production is always ready to be released. staging is, well, staging. New features are created in topic branches, and then merged to development via pull requests. Candidate releases are tagged from development and deployed to staging, tested, then merged into the production and deployed.
We use Github Actions for continuous integration testing and linting.
see: .github/workflows
for details.
Specs are, well, heisenbuggish. If they don't pass, try rspec --only-failures
and they will. Why, I don't know.
Development workflow: Install mysql & redis
bundle install -j4
bundle exec rake db:setup
bundle exec rails s
Login with: email: 'admin@example.com', password: 'foobar123!01203$#$%R',
Should be able to launch a codespace in github and in vscode. It's got Redis & Mysql and everything.
It runs bundle install, and you'll need to copy config/credentials/development.key
into the codespace and run rake db:setup
to get it going.
To run all tests:
bundle exec rake
To constantly run red-green-refactor tests:
bundle exec guard -g red_green_refactor
Todo:
The application code is released under the MIT License. See LICENSE for terms.