mautic/docker-mautic

Composer missing in default docker image

xcellenceit opened this issue ยท 19 comments

From default latest image mautic:v4-apache I believe that composer is not installed or supported.

This should be part of default image as based on documentation I get this is going to be default way to install extensions.

Same for mautic5 images.
Any chance to bundle the composer command so the marketplace would work out-of-the-box ๐Ÿ“ฆ ?

+1 for this, I just updated to v5 and need to installed the Symfony Mailer for Sendgrid and the documentation on shows how to do this using composer.

Just realised composer is already there in the bin directory, so if the documentation could be updated to show this in the command, as it does for the console commands, e.g. bin/composer ... instead of just composer ... that would be helpful.

it is. However it's not made runnable.
Doing so manually within the docker made the message disapear however I still can't install from the marketplace with an error I can't understand.

So, the composer does not work on Docker, and you can not install Symfony Transports. However, it is in the container it is missing any updates on this?

I have the same issue. If I want to build my own docker file on top of the official one just to install an additional theme:

FROM mautic/mautic:5.0.3-apache
RUN composer require chimpino/theme-air

Then it fails on composer not being installed.

Composer is actually being installed in the original dockerfile, however, there is additional FROM that starts over. Perhaps it would be better to keep Composer and even NPM in the production image as it can get handy from time to time. @mollux WDYT?

I tried what was suggested above to use Mautic's composer:

FROM mautic/mautic:5.0.3-apache
RUN php bin/composer require chimpino/theme-air

But it fails with #5 0.562 Could not open input file: bin/composer

@mollux do you have some suggestion of how to do it properly?

This issue has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/trouble-adding-ses-plugin-to-a-dockerfile-so-i-can-build-my-own-image/32046/3

This issue has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/understanding-the-installation-of-mautic-5-via-docker/32063/4

This issue has been mentioned on Mautic Forums. There might be relevant details there:

https://forum.mautic.org/t/understanding-the-installation-of-mautic-5-via-docker/32063/4

The thread is closed and referencing this GitHub-Issue. ๐Ÿ˜‚

@Bamstian It's just that in the thread this Issue was mentioned as a place where the same topic was being debated. So, I brought it here too.

any updates on this? just installed fresh mautic using docker-compose provided and there is no composer anywhere to be found

any updates on this? just installed fresh mautic using docker-compose provided and there is no composer anywhere to be found

I don't believe so! In my case, I created a Dokerfile "FROM mautic/mautic:latest" and asked to include Composer and NPM in it. So, when I run the container, Mautic already comes with Composer and NPM. But I confess that I didn't test this in production.

Perhaps it would be better to keep Composer and even NPM in the production image as it can get handy from time to time. @mollux WDYT?

This feels like a bad design decision IMO. If you allow npm/composer in the production image then the image is no longer immutable and can be modified and broken on the next update.

The ability to control what gets installed via an environment variable could be a path that could lead to a happier outcome, possibly.

@O-Mutt I agree. But the containers are mutable if the user wants to do so whether there is composer installed or not. They can simply install it, right?

But to get around that, I created my own docker file which allows me to install plugins and themes if anyone is interested:

https://github.com/escopecz/docker-compose-mautic/blob/main/Dockerfile

I can't wait for a proper solution.

If you MUST you could run
apt update && apt install git npm nodejs -y
cd /var/www/html && PHP bin/composer require symphony/amazon-ses or whatever the composer package you wanted was

@O-Mutt What do you mean by "If you MUST"? Mautic is an extensible system. There should be a clean and easy way to install extensions.

If you look at the Dockerfile I shared, that's what's happening there. But a global Composer must be installed otherwise it's confused about the paths.

My comment wasn't in reply to you it was in the thread in general it seems people were having trouble using the composer file that was already in place. I haven't had a chance this morning to look at the docker file that you provided but I'm sure it is very similar to the one that I have locally as well. That said it seems like a loose end from the project as a whole. Adding a mail transport should not require a custom image, at least not from my perspective.

It's not necessary to add a mail transport. SMTP is there by default. But the core code cannot have transports ready for all the ESPs out there. Those should be plugins.

This is issue is aggravated even further in mautic 5 since, there is essentially no bulk email sending service but SMTP. Not having a clean composer makes the container essentially mutable, It would be excellent if environment variables are introduced to expose the plugin and theme installations.