How do you manage so many apps of the same type when a simple change needs to be made?
-
I'm curious... how do people prefer to manage a situation where they have many app instances of the same type and need to modify or tweak a single setting that's found in one of the files of the app (i.e. the filesystem).
My use-case:
- I have approximately 20 WordPress app installs. They pretty much all come from a "template" app of it I have running so that the php.ini settings and wp-config.php settings have the consistent values I'd like for things like upload size and what-not.
- I want to remove a line or replace a line so that the php.ini settings are consistent across all apps (now that they need to change in my use-case from the template that's been going strong for a while). I.e. I want to decrease the file size upload setting on php.ini from whatever value it is now (I think around 100MB) to 25 MB.
How would I change them all at once rather than having to go in one by one? Since these are file-system level, I guess sed would be the right tool to modify these values? Any other preferred manners for doing this kind of a system-wide change across all app instances of a certain type? Or does this have to be done one-by-one as a manual process?
My question really applies to pretty much any app I think, but WordPress is the example in my use-case.
Just to clarify, for WordPress in particular I use MainWP for managing all my WP instances in terms of plugins and updates and everything, but that only reaches as far as WP itself, anything outside of it like the web server or the php.ini file can’t be modified by it.
-
There's a few ways... depending on the protocol you want to use.
There are multi-server ssh apps that will log into X servers and run a script or even live execute all terminal commands on each. Not sure about interactive editing of files but something to try.
Similar can be done with (S)FTP, replacing needed files via a script.
N8N can be used to automate such things as well API wise, by replacing the file in question too.
One could also spin up a provisioning system such as Ansible and write a recipe for making those changes.
Many other cloud tools exist to make changes to a large number of hosts. CFEngine, Puppet, Chef, etc..
-
@robi Hmm, interesting. Thanks for the suggestions
Some of those definitely seem overkill for the rare occurrence for this task in my particular use-case (like Chef and Ansible), but good to know still.
I wonder about the SFTP / SCP option though… I sort of assumed that wouldn’t work because I’d need to know the silly app ID’s first for all of them unless I can use wildcards for the paths I guess like I could using something like sed.
I’m not familiar with N8N so I’ll check into that too.
Thanks Robi.
-
@fbartels ah yes! Great idea. I hadn’t used the CLI for that before. I see the documentation for that here and looks pretty simple. I assume I can specify many apps at a time, but will test soon.
-
@d19dotca said in How do you manage so many apps of the same type when a simple change needs to be made?:
I assume I can specify many apps at a time, but will test soon.
You have to execute the command multiple times with the
--app <app.example.com>
argument. So, a for loop of sorts. -
Exactly, looping through would work here. You could likely automate this depending on the change you need to make. I like the approach of making a git repo for just support and maintenance scripts.
-
@robi Actually for me, it wasn't really scripted and was more manual in nature.
Basically ran the
cloudron list
command, then copied out all the WordPress manifest ID types and put it together in a command sequence like this:cloudron push --app <www.example1.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example2.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example3.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example4.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example5.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example6.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example7.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example8.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example9.com> /Users/<username>/Desktop/php.ini /app/data/php.ini && \ cloudron push --app <www.example0.com> /Users/<username>/Desktop/php.ini /app/data/php.ini
...etc.
I haven't scripted it, but I will certainly look into doing that in the future if these types of tasks come up more often.