Composer installation?

Composer installation?

by Travis Miller -
Number of replies: 5

Hi –

I'm an experienced LAMP developer who is evaluating Moodle.

I'm hoping to install Moodle via Composer, so that version control and upgrades will be cleaner/easier.

Googling for "moodle composer" turns up this page:

https://docs.moodle.org/dev/Composer

However, when I try this, it just clones the GitHub repo into vendor/moodle/moodle.

I guess I could map my Apache virtualhost's document root to that directory, but that just seems...weird and wrong.

I'm used to Laravel and similar frameworks, which allow you to scaffold a new project via composer create-project. This plays beautifully with source control, and upgrading Laravel itself is a breeze.

So I did some more Googling about using Composer with Moodle. It sounds like this isn't commonly done. It sounds like there is some traction in the Moodle developer community for adding official Composer support, but we're still figuring out exactly what that will look like. Is that fair/accurate?

Or – maybe I'm wrong, and a full-fledged Composer workflow is already possible with Moodle? If so, can anyone point me to some documentation? I haven't been able to find anything definitive.

Thanks!

Average of ratings: -
In reply to Travis Miller

Re: Composer installation?

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

'Or – maybe I'm wrong, and a full-fledged Composer workflow is already possible with Moodle? '

That is not a standard way of installing Moodle.

In reply to Travis Miller

Re: Composer installation?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The common approach in the Moodle world for people who want an easy-to-update Moodle install is to run off a git checkout, as in https://docs.moodle.org/38/en/Git_for_Administrators
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Composer installation?

by Travis Miller -
Thanks.

If I use this approach, though, then it seems that I can't commit my Moodle site to my own Git repo. Is that accurate?

If so, that further implies that:

  • In order to set up a local instance of a Moodle site, a developer would have to copy all of the files from an existing instance of the site (since there's no repo that they could check out).
  • I can't use Travis CI to automatically deploy new code to my staging/test/production environments (since there's no repo for Travis to hook into).
Am I reasoning through all of that correctly?

How are these problems typically solved in the Moodle world?

In reply to Travis Miller

Re: Composer installation?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Remember that git is a distributed version control system. You can haev your own git repo, which starts as a clone of the upstream Moodle repo, but then over time gets your own changes added too.

And, from time to time (e.g. when there is a new release) you can pull the latest changes from the upstream repo into your local one.

See https://docs.moodle.org/dev/Git_for_developers#Installing_Git_on_your_computer

This is the common pattern. Obviously, the two follow-on problems you were worrying about are then not problems at all.

I know it is not the pattern you are used to, but acutally it works very well, and some of us have been working this way since before composer even existed wink
Average of ratings: Useful (2)
In reply to Tim Hunt

Re: Composer installation?

by Travis Miller -
Great – thank you for the detailed reply. I use Git daily, but I've never used it in this way. Good to know that there's an established pattern which addresses my concerns!