Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
forsbergplustwo committed Sep 26, 2023
2 parents f6ebbf1 + 9540d70 commit c217d8e
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 71 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,21 @@ jobs:
RAILS_ENV: test
RAILS_MASTER_KEY: ${{ secrets.master_key }}
run: |
bin/rake db:create
bin/rake db:schema:load
bin/rake db:migrate
bin/rails db:create
bin/rails db:schema:load
bin/rails db:migrate
- name: Build assets
env:
RAILS_ENV: test
RAILS_MASTER_KEY: ${{ secrets.master_key }}
run: |
bin/rake assets:precompile
bin/rails assets:precompile
- name: Run tests
env:
AWS_REGION: us-east-1
REDIS_URL: redis://localhost:6379/0
RAILS_MASTER_KEY: ${{ secrets.master_key }}
run: |
bin/rake test
bin/rails test
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@

/public/assets

# Ignore master key for decrypting credentials and more.
/config/master.key

/app/assets/builds/*
!/app/assets/builds/.keep

/node_modules

# Ignore production credentials key
# Note: Dev and Test keys are included for easier setup.
/config/credentials/production.key
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ Note: We recommend deleting your existing metrics data and re-importing to take

### First time setup

1. Rename `.env.example` to `.env` and update redis path if needed.
1. Delete `config/credentials.yml.enc`
2. Create and add your own credentials `bin/rails credentials:edit` (use config/credentials.example.yml as template)
3. Setup encrypted attributes support: `bin/rails db:encryption:init` and add to credentials
4. Setup dependencies, environment & database: `bin/setup`
5. Start web server and sidekiq workers with: `bin/dev`
1. Setup dependencies, environment & database: `bin/setup`
2. Start web server and sidekiq workers with: `bin/dev`

Visit `localhost:4000`

Expand All @@ -45,6 +41,12 @@ bin/rails test
bin/rails test:all
```

### Deploying to Production

1. Delete `config/credentials/production.yml.enc`
2. Run `bin/rails credentials:edit -e production` and update as necessary
3. If deploying to Heroku, make sure to set `heroku config:set RAILS_MASTER_KEY=[key]` where `[key]` is the value of your `config/credentials/production.key` file.

## Contributing
We'd love for you to contribute join us in making it better! In general, please follow the "fork-and-pull" Git workflow.

Expand Down
2 changes: 1 addition & 1 deletion app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ class ApplicationMailer < ActionMailer::Base
private

def default_from
Rails.application.credentials[Rails.env.to_sym][:action_mailer][:email_from_address]
Rails.application.credentials[:action_mailer][:email_from_address]
end
end
46 changes: 0 additions & 46 deletions config/credentials.example.yml

This file was deleted.

2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
iKqpkfFIHUy5AcOuLqyCb1X4k7mG7RgHLXMeecN60pvAIuVrrSvqKphCuZDMqIBpor2gAGdw0/Ic5sNDCF6BCV1nxb9+7U7WWWSfWbnPmWCv53wIVAakKXVdiGgAN8kfvm9v9SaIj5OjPaNnd5dLBcpdopMQ1NDULydswAxoeeT6xM9/3aeBJv/zQ/Ku8JAv+u1Qj4hodHQ8KPgWQbK2pwMRf8WCpKb5eLgfAq/f5Zmm2suhCIVkF4ODBnpzBJD3TAy5yjYP/5CxTLaNXzcdFXwfx4MGeQXwkchjgT9J2du8zHkXMNqs07mOTdaCccb1pIUyp+nf4AOqQE/km3SYv+PPScElJzCiVuYErI2n5dES1Z/rDbBclDSBMDAL0MEbxfPGwYbtsLmfyT06mQ37P6GtKl0aoNIwwepwSVxMhbTVFHTHzwmCFpgSTScyVQMcwN718drb4UFEWTKZM/nuRJrZi7i3CX9PCRPVu9i2XquLE3C7MAy0pqPC45exQzXCOVfp3GLSztVUTa2uDpUw7Hf2IcwwiZ2DFoRXKh1rRH6NK6/GnX7RhmQueWZ1m2702TKsDjEpR1SS/cRfJrS3LtQa8i2Pw3acQXT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fyBw76SOqZ2i7Ug==--4dRzbrG3hzms4RbG--OgDjBzPv+80oGdlLiWJKkQ==
1 change: 1 addition & 0 deletions config/credentials/production.yml.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
byL4vcSW+u89CFO6mgz+dhZ4CieIn/malhA6F6FfUdTqXedTd1KO7H7Qqn5QX2nCnAkJj9AYp+eYbCO4yevtONGWZzR8Dxf3kQxNDXm4ZwLk9ROXzNU6i1EpvBQqeA088e9QX3huLFZ/IeU/WWBYFRxosJcj2d+CHmeI8qe2tbolHxwOo7XFncxwBQD0M3T88aD6Eg2H6t2KN1GoIUyWA3l8C13mjaaMvNI/5V5Bepwoy1KHSuuMrHbQVzaR4iojmmrpvQXF/DeXAMXIKtqWlwQBPOLTv6OX1Ru6auyefFPr4hvbGZyA+5TyYtx0NH0Q+ZgrJQn5eUW9eZMVYAlHWhYA9KLfp5xB8TYO2FLLLfsZxrwBR4Vn+vZrt92w4KAXXQhw5KmrX1cKy9JRboOqFtO90X8WJqta4W74hEV6Jvf/EzvK1jW64Wh6cwNEYkrVfoIbmY5mecVSJutIxGGDDepdPCkDIG+QzcxvQfycvzN9ERZIgBwr+GsRzR8FA4TuToN+hz6kJYc1wua425t1DGkOhaIPN/TBEKH2jyCPuIL1boW2DU+1Ia/Sv8PwVQJrnD8Gup4yiMs8YmOfOX0ut50OS+2hcqnSfy2K3HkN7au8ZjRvMimbRKvsB6E2BnKZwx2rBhxAZ97+nhjYzOPSDEUTJ4dqzJ1LDpQz/mLCIaCZP0xC2Du2KSWqXlKWHS4qnRXcBRjtQXdpJ/cnj29zTApEPo8knsg5nu/VbM2n41MOjUWtpourWEktGdtKDvyTU/5O5nwycmd6skzaE5ADoHAnru6+yIGDYRvYEeA3trkWcsI2oMVM41WE58njjiwHeY56NS706qjrif3XWazDTIAEDjqhuyDitlUWZMH/mMUgKiOF4VqYVdkDH8qmkef2+QzUw79D1hF3XUgK/h7TsB1D+t9s1oBteiGFyTzinpz0LC4Csl3LB8OTnvDF+8Y0C3f5Of9+SQschxhDrSE1GGScw/vNIxwgIcswKXpDPqtnxhRi+Fs=--K4EPe0nX+gECQbud--zJ55TP82XKVbpDBQ4qidfg==
1 change: 1 addition & 0 deletions config/credentials/test.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f92bc421f102601d6f6cf768611138e7
1 change: 1 addition & 0 deletions config/credentials/test.yml.enc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aNL1Vs9sc2ZzV7P1vAaownk976GABtBwDckPotSk45zdsoRofjG34JgNwLFh11FNAuES89qdDLtEBaTJLsQJShYB4NPntRGHWbz6PzmjsNSkxAGPY1TuSckVPxKOZdo7SF/F9n9itlS1Ela2mpVyJuoSaiSnB0HdA3T4AiCavLVkprQH3/Egt/hfUk2ZZDKHvIh6f/tpQbOTo2IRcNzDPbe3ToL+jl4fDlPMKRPLH7ujXsakiq6cnT9XIKhpGb+v+HdZejJpqLit53MW0gai0OBJmio6P5zMvk0Jv+gwnb/wj6eiVM2FcPaT5cdFUs08cs/WAP5NuKlOD1r5L+q1ShunwwQSRa03JlDVlz9A0alQSkEog2Px8qndundubqPFZf9jK/9A4OnbNUxLY6Iv+09frsXg4qX4rnUVgzuhTM0JvR1XU+agOqvWwHtCOl1Zl73gAZNEHcRCi/h4wsfBj3NaZ9lRSaftQWpLh3GrbGtoLTaB5yU2aBkMw6SyHJmpFNo7pX2bEmhzzcsu6FhodGd+3cwzWHnXBKRvSNFfqvIyCEYw4FneztuJcw6EXmYw+7YZGz/oMgPAo505K2ZuvZHAy6tqCJp16aiP0+HVXuHyZ6/SUrMRSHlFy+hgQHIO1A+tjynJiWdYSzuQZNFYmcVjR4jCY0AEJrGggkwjw6PYccCECAgSdd7g0u6fNQ==--PTUk6JrdnQOGCVXI--FLVn5lEiR45m2q6dCVdU7A==
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
config.action_mailer.default_url_options = { host: "localhost:4000" }
config.action_mailer.asset_host = "http://localhost:4000"
config.action_mailer.smtp_settings = {
from: Rails.application.credentials[Rails.env.to_sym][:action_mailer][:from_email_address],
from: Rails.application.credentials[:action_mailer][:from_email_address],
}

# Print deprecation notices to the Rails logger.
Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
config.action_mailer.default_url_options = {host: "partnermetrics.io"}
config.action_mailer.delivery_method = :sendgrid_actionmailer
config.action_mailer.sendgrid_actionmailer_settings = {
api_key: Rails.application.credentials[Rails.env.to_sym][:sendgrid][:api_key],
api_key: Rails.application.credentials[:sendgrid][:api_key],
raise_delivery_errors: true
}

Expand Down
4 changes: 2 additions & 2 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` as its `secret_key`
# by default. You can change it below and use your own secret key.
config.secret_key = Rails.application.credentials[Rails.env.to_sym][:secret_key_base]
config.secret_key = Rails.application.credentials[:secret_key_base]

# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = Rails.application.credentials[Rails.env.to_sym][:action_mailer][:email_from_address]
config.mailer_sender = Rails.application.credentials[:action_mailer][:email_from_address]

# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
Expand Down
1 change: 1 addition & 0 deletions config/master.key
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9ee90a482567871fa149f66742d6ccc4
8 changes: 4 additions & 4 deletions config/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ local:
# Cloudflare tutorial: https://kirillplatonov.com/posts/activestorage-cloudflare-r2/
cloudflare:
service: S3
endpoint: https://<%= Rails.application.credentials[Rails.env.to_sym][:cloudflare][:account_id] %>.r2.cloudflarestorage.com
access_key_id: <%= Rails.application.credentials[Rails.env.to_sym][:cloudflare][:access_key_id] %>
secret_access_key: <%= Rails.application.credentials[Rails.env.to_sym][:cloudflare][:secret_access_key] %>
endpoint: https://<%= Rails.application.credentials[:cloudflare][:account_id] %>.r2.cloudflarestorage.com
access_key_id: <%= Rails.application.credentials[:cloudflare][:access_key_id] %>
secret_access_key: <%= Rails.application.credentials[:cloudflare][:secret_access_key] %>
region: auto
bucket: <%= Rails.application.credentials[Rails.env.to_sym][:cloudflare][:bucket] %>
bucket: <%= Rails.application.credentials[:cloudflare][:bucket] %>

# amazon:
# service: S3
Expand Down

0 comments on commit c217d8e

Please sign in to comment.