Skip to content

Commit

Permalink
Add the mailcatcher capistrano commands so we can easily see the mail…
Browse files Browse the repository at this point in the history
… on staging (#702)
  • Loading branch information
carolyncole authored Oct 17, 2024
1 parent 77038b3 commit fc7c3a5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,20 @@ This feed can be paged through using the parameters `per_page` and `page`, like
```
https://pdc-discovery-staging.princeton.edu/discovery/pppl_reporting_feed.json?per_page=2&page=3
```

## Mail

### Mail on Development
Mailcatcher is a gem that can also be installed locally. See the [mailcatcher documentation](https://mailcatcher.me/) for how to run it on your machine.

### Mail on Staging
To See mail that has been sent on the staging server you can utilize capistrano to open up both mailcatcher consoles in your browser.

```
cap staging mailcatcher:console
```

Look in your default browser for the consoles

### Mail on Production
Emails on production are sent via [Pony Express](https://github.com/pulibrary/pul-it-handbook/blob/f54dfdc7ada1ff993a721f6edb4aa1707bb3a3a5/services/smtp-mail-server.md).
18 changes: 18 additions & 0 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,21 @@
# Uncomment to re-index on every deploy. Only needed when we're actively
# updating how indexing happens.
# after "deploy:published", "pdc_discovery:reindex"

namespace :mailcatcher do
desc "Opens Mailcatcher Consoles"
task :console do
on roles(:app) do |host|
mail_host = host.hostname
user = "pulsys"
port = rand(9000..9999)
puts "Opening #{mail_host} Mailcatcher Console on port #{port} as user #{user}"
Net::SSH.start(mail_host, user) do |session|
session.forward.local(port, "localhost", 1080)
puts "Press Ctrl+C to end Console connection"
`open http://localhost:#{port}/`
session.loop(0.1) { true }
end
end
end
end

0 comments on commit fc7c3a5

Please sign in to comment.