Extras automatic installation

Hi there, I’m in the process of dockerization for an existing modx site, and I’m wondering if there a way to install extras on a MODx site using some sort of script or command line? I took a look at https://modx.com/extras/package/composerx and although it kind of makes sense, not all extras are managed using compose, and yet, with compose I know it’ll download the components, but it won’t set them up inside MODx.

Currently, I’m just storing the extras on a zip, decompress them, the restore the database, and it works, but I need to achieve a more elegant solution, and specially that it doesn’t depend on files stored on a s3 o git repo amanged by myself.

Gitify has a cli command to install a MODX package. You could use that, or peak at its code on GitHub to see how you might implement that yourself.

1 Like

thanks a lot, totally missed that although i was just starting to work with Gitify

teleport could be another option

2 Likes

Hi @camicase82

Did you manage to find a solution to this that works for you?

I want an automated pipeline that:

  1. retrieves the desired modx version (i’ve achieved this easily with Ansible)
  2. installs the desired extras
  3. runs auto tests to verify the deployment
    4 run regression / new feature tests

If I can’t find an easy way to automate the extras install then another option could be the manually install the extras and save that image as the base for future runs… However this would make modx version upgrades more complicated

Any feedback on your progress would be appreciated

Jon

1 Like

Hi there, finally I ended up automating everything using a shell script as the entrypoint for my docker-compose configuration, where first I install gitify, the run the install of plugins, and finally restore any needed backup, most of the version parameters are part of env vars, so switching versions it’s kind of easy, and running a new installation/restoring and environment its a matter of running a docker-compose up

This is the script portion I use to install gitify in my container and install the needed extras.

git clone https://github.com/modmore/Gitify.git $TMP_STORE/Gitify
    cd $TMP_STORE/Gitify
    if (composer install --no-dev) then
      echo >&2 "Worked at first"
    else
      #Old hack for earlier gitify issue, must remove
      echo >&2 "updating file and reinstalling"
      mv $TMP_STORE/Gitify/vendor/kbjr/git.php/Git.php $TMP_STORE/Gitify/vendor/kbjr/git.php/git.php
      composer install --no-dev
    fi
    chmod +x bin/gitify
    cd /usr/bin/
    ln -s /tmp/modx/Gitify/bin/gitify Gitify
    # We install the required plugins
    cd /var/www/html/
    # first we check that there's agitify configuration
    if [ -e .gitify  ]; then
      Gitify package:install --all
      #Finally we call the database creation script
      cd /var/www/html/modxMonster/modelConfig/
      for f in *.gen; do
        mv -- "$f" "${f%.xml.gen}.xml"
      done
    fi```

Note that Gitify 2 can simply be installed via Composer with either:

composer global require modmore/gitify:^2

to access it as gitify anywhere on the system, or locally:

composer require modmore/gitify:^2

(or with composer install after adding it to the composer.json) to use it as vendor/bin/gitify.

1 Like

Thank you @camicase82 - This makes sense I am going to implement a similar workflow

Thank you @markh - I’m using version 2 as the installation is fresh today:

gitify --version
Gitify 2.0.0-alpha1
1 Like