Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the mailcatcher capistrano commands so we can easily see the mail on staging #702

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}/`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

session.loop(0.1) { true }
end
end
end
end