bramhoven / wildduck-k8s

Helm chart for running a full Wildduck instance in kubernetes
GNU General Public License v3.0
13 stars 1 forks source link

rspamd pod keeps restarting #16

Open bramhoven opened 1 year ago

bramhoven commented 1 year ago

No reason found yet

marxlnfcs commented 1 year ago

Hello! I found a solution for this "bug".

If you're looking into the /var/log/rspamd/rspamd.log file you can see rspamd has to generate some TLDs but this takes way too long. So I updated the resource limits:

resources:
    limits:
      cpu: 600m
      memory: 500Mi
    requests:
      cpu: 500m
      memory: 500Mi

Now its working :)

bramhoven commented 1 year ago

@marxlnfcs great to hear that! Do you know what the average rspamd usages are, or usages under high load?

marxlnfcs commented 1 year ago

@bramhoven I haven't checked the current usage or the usage under high load yet because I'm unable to get Haraka to work. If Haraka is running, I'll stress test rspamd :)

bramhoven commented 1 year ago

@marxlnfcs what is the issue with Haraka? I eventually got everything up and running after a lot of debugging and testing! Maybe I can help you out

marxlnfcs commented 1 year ago

@bramhoven Haraka is unable to connect to wildduck...

Fri, Feb 3 2023 1:31:48 pm | [CRIT] [-] [server] Plugin wildduck timed out on hook init_master - make sure it calls the callback
Fri, Feb 3 2023 1:31:48 pm | [INFO] [-] [server] hook=init_master plugin=wildduck function=init_wildduck_shared params="" retval=DENYSOFT msg="plugin timeout"
Fri, Feb 3 2023 1:31:48 pm | [ERROR] [-] [server] init_master returned error: plugin timeout
Fri, Feb 3 2023 1:31:48 pm | [NOTICE] [-] [core] Shutting down

I edited your chart a bit and added resources like MongoDB, Redis and NGINX for load balancing. I probably forgot to put something somewhere

bramhoven commented 1 year ago

@marxlnfcs Have you checked wildduck itself? Is it up and running? Else maybe the correct ports or urls

Btw if you think those changes should be in the base chart, feel free to create a PR :)

marxlnfcs commented 1 year ago

@bramhoven I checked wildduck already but could not find any issue there. I've also created a ubuntu sidecar container for haraka to test the connection to wildduck. Everything is working :(

I will create a PR if everything is working correctly but I've changed alot... And i mean "alot" :D

bramhoven commented 1 year ago

@marxlnfcs Did you check mongodb? I think Haraka just connects to mongo and redis

Haha would love to see what you have changed, hopefully I can learn a bit from those changes!

marxlnfcs commented 1 year ago

@bramhoven Thats right. I've checked the haraka-plugin-wildduck thats implemented in the image but anything should work. MongoDB is up and running (Tested with mongo-express) and redis too... I've no clue :D

Did you create the databases in mongodb manually? Which did you create?

I'm messing around with helm because thats the first time i'm "manipulating" a chart haha :P

bramhoven commented 1 year ago

@marxlnfcs I was struggling at first to get a normal "working" MongoDB instance using helm... I could not get that working after trying for weeks. Finally ended up just creating a new deployment myself with a mongodb image.

I have created a root user and logged in using that. I then created the wildduck, wildduck-webmail & zone-mta collections.

Then I added users to each of them so a wildduck user, a wildduck-webmail user and a zone-mta user. The wildduck user has access to the wildduck and the zone-mta collection, since haraka and wildduck use these two collections. And the zone-mta user can also access both collections.

marxlnfcs commented 1 year ago

@bramhoven Thats almost the same as I did...

I tried to use the redis plugin by haraka and filled out all connection info... The plugin runs in a timeout either... So its probably an problem between the connection of haraka and redis...

marxlnfcs commented 1 year ago

@bramhoven I found the problem but no solution yet ... There is some DNS problem because if I'm using the hostname of the redis server (wildduck-redis.wildduck.svc.cluster.local) I'm running in a timeout. But If I use the ClusterIP of the redis-server it works...

Strange behavior :D

bramhoven commented 1 year ago

@marxlnfcs glad to hear you managed to find the problem! That is a strange bug though... I'm not that familiar with kubernetes to know what causes that

marxlnfcs commented 1 year ago

@bramhoven I fixed this error too but it seems to be the connection to mongodb... Which version of mongodb did you use?

marxlnfcs commented 1 year ago

@bramhoven I'm going to cry... I found the mistake. I named the wildduck config from Haraka "wildduck.yml" and not "wildduck.yaml" :')

bramhoven commented 1 year ago

@marxlnfcs oh damn... Good find though! I made a lot of those mistakes setting this helm chart up, and it took me quite a while to get everything in working order.

Glad to hear it is working now!

marxlnfcs commented 1 year ago

@bramhoven Yes.... I rebuilt the Haraka image and added some debug logs to the Haraka Wildduck plugin. Then I came up with it and now I'm ashamed :D

bramhoven commented 1 year ago

@marxlnfcs Don't be! Could happen to anyone :D

Would love to hear the results if you get the chance to stress test it!

marxlnfcs commented 1 year ago

@bramhoven Thats true :D

I created a repository with my revised chart. Feel free to take a look and if you want I can also do a PR when I'm completely done :)

marxlnfcs/wildduck-helm

marxlnfcs commented 1 year ago

@bramhoven There are some features like ingress and additionalAccounts, that are not implemented yet :D

bramhoven commented 1 year ago

@marxlnfcs yeah, im not that familiar with all this stuff yet. If you have other things that are not implemented yet, let me know. I want to create a helm chart that supports any feature wildduck supports

marxlnfcs commented 1 year ago

@bramhoven Me neither but thats how I learn it. :)

I would like to have a full-featured helm chart for wildduck!