A few thoughts as there is not a simple answer:
I have the same setup (Hetzner, 2vCPU, 4GB RAM) like you for the mailcow, but I handle a bit more emails - 25 mailboxes with 200k emails in total, it’s more like 100 mails an hour, totally fine so far.
If wordpress is not a hard requirement and the websites are really basically about contact information, maybe a statified website is a better option. -> A lot less load on the server and thus less risk of a few visitors too much causing a job to run out of RAM and crash. I’ve just helped a friend to launch his website using Jekyll - although not on the mailcow machine.
If wordpress (or any other site built with php) is a must, I’d suggest to create another php-fpm container for it to decouple it from mailcow; for stability and security reasons. This way you can run different php-versions, different modules, different config and nothing will interfere with the cow - apart from ram and server load of course.
As this Hetzner vServer is basically the absolute minimum for mailcow to run, you might get a bit of problems one way or the other - even if you should manage to use the same container for it. I’d create or increase swap for it which might only make it slower in such cases instead of crash.
Apart from that, to answer your initial question, to add php modules there are multiple options:
- manually - maybe for try&error - will be gone with the next update, latest:
- go to /opt/mailcow (or where you’ve installed it, the folder where docker-compose.yml resides)
- docker-compose exec php-fpm-mailcow sh (to get a shell inside the php container)
- use the commands
docker-php-ext-install
, docker-php-ext-configure
, docker-php-ext-enable
or pecl install
like with a standard php container
- restart the container
- more permanently – you will either get conflicts during upgrades or will have to do this again with each update.
- add the commands to /opt/mailcow-dockerized/data/Dockerfiels/phpfpm/Dockerfile
- rebuild the container
- cleaner – as this will sit ontop of updates, it will then just be reapplied for updates of mailcow
- create your own Dockerfile with the official one as a template.
- Use
FROM mailcow/phpfprm:xx.yy
- add the modules with aforementioned commands
- change docker-compose.yml to use your new Dockerfile
- build container
I might have forgotten steps, can’t test this for you as I would have to either setup a new mailcow or compromise my current setup. Besides, I’d still recommend running your websites in a fresh and independant container instead.
Hope I could help!