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

Heroku - worker support #35

Closed
andreasklinger opened this issue Oct 4, 2014 · 12 comments
Closed

Heroku - worker support #35

andreasklinger opened this issue Oct 4, 2014 · 12 comments

Comments

@andreasklinger
Copy link

Hi guys

It seems letter_opener_web won't be much of use on heroku. I would assume that most people use workers to send their emails.

As far as i understand this workers and all dynos have isolated environments. Thus it can't really reach the same /tmp directory.

Thinking about it makes as a lot of sense.
A workaround would be s3 support i guess. Unfortunately i personally can't implement that right now. But i think it would be worth the note in the README that it only works on heroku under certain conditions. Simply to save the time of the next person ;)

best wishes
Andreas

@fgrehm
Copy link
Owner

fgrehm commented Oct 7, 2014

Yeah, sorry that you had trouble with that :-( The only scenario where letter_opener_web works fine on Heroku is when you have a single dyno with no mails being sent on the background.

I'm just not sure about keeping mails on S3, maybe Redis would be an easier approach? I initially thought of keeping things on the app's DB, but that will end up polluting our schema.rb with dev only stuff.

I don't have a strong need for getting this gem to work on Heroku apart from the demo app, so it is something I might not work on for a while.

@andreasklinger
Copy link
Author

Completely fine and understandable. If i'd have a bit more of time i'd build this feature because your gem kicks ass.

Imho just add a note in the Readme - maybe just link to this issue - just to save the next person some time

@abinoda
Copy link

abinoda commented Oct 15, 2014

Happened to me too.

fgrehm added a commit that referenced this issue Oct 15, 2014
@fgrehm
Copy link
Owner

fgrehm commented Oct 15, 2014

Notice added to the README on 79b2427

@grumpit
Copy link

grumpit commented Oct 16, 2014

I'm not familiar with how Heroku is set up, but at Engine Yard, as part of the deploy process, you are able to use deploy hooks. In the deploy hooks, you can symlink to shared resources and directories, so I have it set up so that before the app restarts, I do this:

run "mkdir -p #{config.shared_path}/system/letter_opener"
run "ln -nfs #{config.shared_path}/system/letter_opener #{config.release_path}/tmp/letter_opener"

and then everything works great, no matter how many instances I have running...

@pseudomuto
Copy link
Contributor

The resolution for now seems to be the notice in the README. Since this is a few years old, I'm going to close it. If this is still a concern, re-open.

@NullVoxPopuli
Copy link

what if there was an option to store emails in redis?

@fgrehm
Copy link
Owner

fgrehm commented Aug 23, 2017

That or storing it on a DB would also work

@kreintjes
Copy link

Still a concern for me. Could use this for Heroku when sending mails with deliver_later. However, if I'm the only one, it might not be worth the trouble :p

Any suggestions on how to test (mass) mails in staging environments on Heroku without sending them to real people?

@eliotsykes
Copy link

There's a Heroku add-on that does this, there may be others: https://elements.heroku.com/addons/mailtrap

@pdabrowski6
Copy link

If anyone has troubles with using this gem on Heroku with multiple workers, I solved this issue with this PR: #129

If the PR is not merged, you can use the updated version the following way:

gem 'letter_opener_web', git: 'https://github.com/pdabrowski6/letter_opener_web', branch: 'support-for-s3'

@gamesover
Copy link

If anyone has troubles with using this gem on Heroku with multiple workers, I solved this issue with this PR: #129

If the PR is not merged, you can use the updated version the following way:

gem 'letter_opener_web', git: 'https://github.com/pdabrowski6/letter_opener_web', branch: 'support-for-s3'

A brilliant solution for AWS S3 users. However, it's still not a universal solution for those who run Rails server and background servers (such as Sidekiq) separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants