Stacks was originally developed very quickly, as a hack on top of Active Admin to help people do skill tree reviews.
So, it does not conform to our Rails best practices, and it is riddled with anti-patterns and hacks. I (@hhff) would like to clean it up one day (refactor to use service objects and fix the myriad of n+1 issues there are) but that day very well may never come.
If you ever see an error like:
OAuth2::Error (invalid_grant: )
{"error":"invalid_grant"}
Just re-sync the production database as per instructions below. It means Quickbooks API has revoked the current OAuth token. We freshen it every 10 minutes on prod.
This is tricky. You'll need access to the "QBO App" on the Intuit Developer portal first, then you can follow the steps described here:
https://www.loom.com/share/2c4f15512009443bb4e4c92d42e23a46
You have been warned!
If you ever see an error upon running bundle install
along the lines of:
Results logged to
/Users/josephineweidner/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/extensions/arm64-darwin-23/2.7.0/nio4r-2.5.5/gem_make.out
An error occurred while installing nio4r (2.5.5), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.5.5' --source 'https://rubygems.org/'` succeeds before bundling.
Open up the gem_make.out
log file. Search for "error" (there are lots of warnings
you can ignore). You should see a line that ends in something like "[-Wincompatible-function-pointer-types]".
The trick is to pass a flag in the gem install
command that tells the compiler to ignore
that error. For example:
gem install nio4r -v '2.5.5' --source 'https://rubygems.org/' -- --with-cflags="-Wno-error=incompatible-function-pointer-types"
This may happen for gems other than nio4r
, but the same steps apply. Good luck!
- A Ruby on Rails ready dev environment (w/ PostgresQL)
- parity
- Access to the garden3d 1password
- Copy the Stacks master.key from 1password to
config/master.key
- Run:
# Install dependencies
bundle
# Add the Heroku remote
git remote add production https://git.heroku.com/g3d-stacks.git
# Login to heroku with dev@sanctuary.computer (in 1pass)
heroku login
# Backup the production database and copy it to your local
production backup
development restore-from production
# Run the server
rails s
Navigate to localhost:3000
, and you should see a local version
of Stacks running a recent backup of the production database.
Heroku is configured to automatically deploy Stacks from the main
branch when
PR's are merged. If you need to trigger a deploy manually, you can run:
production deploy
production console
production tail
production migrate