Membership is a simple app for non profit organizations, that allows users to create an account using Discourse and donate to the organization. It contains the following features:
Table of contents generated with markdown-toc
cp .env.sample .env # copy .env file
bundle install # install gems
yarn install # install packages
rake db:create # create database
rake db:migrate # migrate database
rake db:seed # seed database
# run project with
overmind s
At this point, you should be able to see the app at http://membership.lvh.me:5000
The easiest way to run the app is by using Doppler. Ask to be added to the project.
You can install it by running brew install dopplerhq/cli/doppler
. You can can check the Doppler docs here, but below is the gist of commands you need to run.
doppler login
doppler setup
To use Doppler to inject environment variables, prepend doppler run
to commands. You can run Overmind with Doppler running.
doppler run overmind s
We also support Dotenv to configure environment variables. But you will need to supply all the secrets manually.
To do this, just run cp .env.sample .env
and replace the variables you need. For most of them we are providing defaults that work in development.
You can get the Stripe keys by registering for a free Stripe account and generating test keys. Here's a link to their Docs on how to obtain these keys https://stripe.com/docs/keys#obtain-api-keys.
In order to obtain this key, you need to go to this address and generate one https://www.google.com/recaptcha/admin/create. Be sure to use the reCAPTCHA V2 and select the I'm not a robot" checkbox option. Also, set the correct domain names the app is running on, these are membership.lvh.me
and localhost
.
If you need help to get some of these key right or setting this up, please ask other devs for help.
You'll need to have installed the following dependencies installed, if you don't want to use the provided Docker containers.
An instance of PostgresSQL needs to be actively running. Note: MacOS users can use the Postgres app.
rails db:test:prepare
bundle exec rspec
rails cypress:open
We use cookie based authentication across subdomains instead of creating sessions between apps. This provides a better experience and fixes out of sync sessions between Discourse and other apps. Read how to setup a user session.
Overmind is a process manager for Procfile-based apps.
You can install on OSX by running brew install tmux overmind
.
A cool feature that Overmind has is that it allows you to connect to specific process terminal via tmux. This is really
useful when debugging apps. If you use for example binding.pry
, you can connect to the debugging terminal by running overmind connect web
You can run the app using docker compose.
docker compose up
Install Ruby Solargraph VSCode extension to enable autocompletion.
We are using Standard that is a wrapper on top of Rubocop with a predefined set of Rules. If you use VS Code you will want to install vscode-ruby extension and enable formatting on save.
We include a .vscode
folder with configuration specific to this project.
{
"[ruby]": {
"editor.formatOnSave": true
},
"ruby.lint": {
"standard": true
},
"ruby.format": "standard",
"ruby.useLanguageServer": true,
"editor.formatOnSaveTimeout": 5000
}
We're also using standardjs and prettier to standarize our JavaScript development. This is running automatically on a before commit hook using husky.
We use codecov for our test coverage metrics. In CI we need to provide a CODECOV_TOKEN
env variable to upload code coverage stats correctly.
We use Mailhog to preview emails in development. You can install it with brew by running brew install mailhog
. Once you have it installed, you can run it in a separated terminal session with mailhog
.
You can preview the email by going to http://127.0.0.1:8025
We use data_migrate to handle data migrations, instead of having many one-off scripts. You can generate a data migration by running.
rails g data_migration migration_name
and apply the data migrations by running.
rails data:migrate