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 persistence support #303

Merged
merged 5 commits into from
Mar 7, 2021
Merged

Add persistence support #303

merged 5 commits into from
Mar 7, 2021

Conversation

audig
Copy link
Contributor

@audig audig commented May 19, 2020

This PR add some new features :

  • Persistence for mail can be used by using the option --mail-directory
  • Can be used to mount a volume in a kubernetes/docker environment
  • At startup reload mails in memory from the directory specified
  • Add a new endpoint to force reload mail in memory from directory

Inspered by this PR #280

Can address this issues :

The last point is usefull to adresses this issues : #237 & #127 cause you can add an external rules for purging mail in directory (ie: cron find file aged more than X days, delete it & trigger reload mail)

For a preview of usage for this feature in a kubernetes environnement with helm, you can check this repo : https://github.com/cnieg/helm-charts/tree/master/charts/maildev

@audig
Copy link
Contributor Author

audig commented May 19, 2020

To try the docker image with this feature :

docker pull cnieg/maildev:v1.1.9

Or by helm deployment in a kubernetes environment :

helm repo add cnieg https://cnieg.github.io/helm-charts
helm install cnieg/maildev --version 1.0.1

You can customize the deployment by updating default values : https://github.com/cnieg/helm-charts/blob/master/charts/maildev/values.yaml

It will be great if we can include the helm chart in this repo.

if (err) {
logger.error('Error during reading of the file %s', filePath)
} else {
var mail = JSON.parse(data)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR. I've tried your image without much success. This line seems to be the problem. Isn't this supposed to parse the eml file (which is not a JSON)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad, I forgot to add some code of my fork.
2 ways to deal with this :

  • Persist the state in a json file per eml
  • Reload the state from all eml file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

New commits to reload mails from eml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the docker image and charts : #303 (comment)

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2020

Codecov Report

Merging #303 into master will decrease coverage by 4.38%.
The diff coverage is 37.93%.

@@            Coverage Diff             @@
##           master     #303      +/-   ##
==========================================
- Coverage   71.63%   67.25%   -4.39%     
==========================================
  Files          10       10              
  Lines         543      571      +28     
  Branches      113      118       +5     
==========================================
- Hits          389      384       -5     
- Misses        154      187      +33     

audig added 2 commits May 20, 2020 11:26
… we use a new date. This avoid to loose the date after reloading mail from directory
@audig
Copy link
Contributor Author

audig commented May 23, 2020

I never develop on nodejs but I can try to add some test if you want

@audig
Copy link
Contributor Author

audig commented Jul 4, 2020

What do you want to do with this PR ? If you don't want to merge I understand but i will kept my own fork.

@arnou
Copy link

arnou commented Jul 5, 2020

👍
This PR is really necessary for our implementation. Any chance that it will be quickly accepted?

@bbarman4u
Copy link

+1 for this feature. Can we at least add a configurable option so as to not clear the temp directory if a flag is passed so that for users who don't want it cleared can use a sort of persisted volume with docker.

@leonardobsjr
Copy link
Contributor

Project seems abandoned, actually. Lots of Issues and PRs and no words from the lead devs...

@DominikSerafin
Copy link
Collaborator

Hey — I've merged this into my fork — more info here #335.

@DominikSerafin
Copy link
Collaborator

Merging to implement further changes from my fork that depend on this PR.

@DominikSerafin DominikSerafin merged commit c6d4f9c into maildev:master Mar 7, 2021
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

Successfully merging this pull request may close these issues.

None yet

6 participants