class: center, middle # What is your development process? --- ## Our Pipeline -- * development -
http://localhost:3000/
-- * test -- * staging -
https://tradegecko-staging.herokuapp.com/
- We have staging? -- * production -
https://go.tradegecko.com/
--- ## What are we missing? -- - Ability to QA working code before merging into `develop`. -- - Reviewer must pull the repo / start the app ( or apps, we have 4+ essential apps ) -- - Ability to see / showcase design changes before merging. -- - Author must provide screenshots / GIFs (pronounced “jif”) -- - Only people with access to Github are able to QA the changes. -- ## New Pipeline -- * development * test *
**review**
* staging * production --- class: center, middle # Heroku Apps Review ---
---
---
---
---
--- # How the new app is deployed 1. Configure environment 2. Build app 3. Run scripts & scale dynos 4. Deploy to Heroku --- # 1. Configure environment * `app.json` -- * Create app -- * Setup environment vars (`"env"`) -- * Attach resources (DB, Redis..) (`"addons"`) --- ## `app.json` ```json { "name": "TradeGecko", "description": "Powerful inventory management software to help you take complete control of your business.", "addons": [ "heroku-postgresql:hobby-dev", "heroku-redis:hobby-dev", "papertrail:choklad", "mailtrap:free" ], "env": { "API_TOKEN_HEROKU": { "required": true, "description": "Used to talk to heroku's API" }, "RAILS_ENV": { "value": "staging" }, "AWS_ACCESS_KEY_ID": { "required": true } }, "scripts": { "postdeploy": "bin/heroku-review-postdeploy" }, "formation": { "web": { "quantity": 1, "size": "free" }, "worker": { "quantity": 1, "size": "free" } } } ``` --- # 2. Build app Just like `heroku push origin master` 1. User buildpack to decide deploy strategy 2. Copy code from repo 3. Install gems 4. build assets 5. Deploy --- # 3. Run scripts & scale dynos ## `bin/heroku-review-postdeploy` This runs only once per app creation. Will not run if: - pushing a new commit - force pushing You can re-run the script only if you delete the app / or run script manually (Don't do this). What it does: - `bin/rails db:schema:load` - `bin/rails db:seed` - setup [mailtrap](https://mailtrap.io/) --- # 4. Deploy to Heroku -- # Doesn't really do anything. The app is already deployed. --- ## When is it deployed? -- # Everytime you push to that branch -- 1. First deploy is slow, others are fast. -- 2. App is destroyed after `X` days of no use. --- ## How do I access the app? -- 1. `https://tradegecko-staging-pr-#{pr_num}.herokuapp.com` -- 2. Link is in the PR
Click on "View deployment" - Email: #{whoami}@tradegecko.com (as defined in `config/staff.yml`) - Password: -- same as the combination of my luggage. -- `12341234`
--- ## What Jobs are run? -- # EVERYTHING --
(I think)
-- App jobs will go through `worker` dyno, which runs the `default` queue `config/initializers/sidekiq.rb:61` ```ruby if Rails.env.staging? class SidekiqDefaultToWorker def call(_worker_class, job, _queue, _redis_pool) job['queue'] = 'default' yield end end end Sidekiq.configure_client do |config| config.client_middleware do |chain| chain.add SidekiqDefaultToWorker if Rails.env.staging? end end ``` --- ## Dude, where's my mail?
--- ## Dude, where's my mail? # Mailtrap -- 1. Open app management screen in heroku. 2. Click on "Mailtrap" 2. `heroku addons:open mailtrap -a tradegecko-staging-pr-#{pr_num}`
---
--- class: center, middle the end -- ... ? -- # No --- # What doesn't work -- - OAuth Login - Anything outside of the app. - All other TG services: (B2B, Geckopay.., etc.) - Integrations.. (You can add new integrations yourself) - mailtrap is only accessible to users with Heroku access - missing realistic seed data - toggle management --- # HALP! - Add your ENV vars to `app.json` - Add proper seed data. - Add features toggles to UI / seed file