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.
Did you manage to find a solution to this that works for you?
I want an automated pipeline that:
retrieves the desired modx version (i’ve achieved this easily with Ansible)
installs the desired extras
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
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```