Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    How do you manage so many apps of the same type when a simple change needs to be made?

    Discuss
    automation
    5
    10
    374
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d19dotca
      d19dotca last edited by girish

      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.

      --
      Dustin Dauncey
      www.d19.ca

      1 Reply Last reply Reply Quote 1
      • robi
        robi last edited by

        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..

        Life of Advanced Technology

        d19dotca 1 Reply Last reply Reply Quote 1
        • d19dotca
          d19dotca @robi last edited by

          @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.

          --
          Dustin Dauncey
          www.d19.ca

          fbartels 1 Reply Last reply Reply Quote 0
          • fbartels
            fbartels App Dev @d19dotca last edited by

            Specific to Cloudron you can also use the Cloudron cli. It has the ability to push and pull files from apps (you can specify the app in question by it's install location) and exec into apps to run commands like sed.

            d19dotca 1 Reply Last reply Reply Quote 6
            • d19dotca
              d19dotca @fbartels last edited by d19dotca

              @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.

              https://docs.cloudron.io/packaging/cli/

              --
              Dustin Dauncey
              www.d19.ca

              girish 1 Reply Last reply Reply Quote 1
              • girish
                girish Staff @d19dotca last edited by

                @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.

                1 Reply Last reply Reply Quote 2
                • ?
                  A Former User last edited by

                  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.

                  1 Reply Last reply Reply Quote 4
                  • d19dotca
                    d19dotca last edited by d19dotca

                    So just wanted to add that I ran the commands to the Cloudron CLI (tested with one then with a number of —app added to the same command) and it seemed to work perfectly. Thank you for that suggestion! 🙂

                    --
                    Dustin Dauncey
                    www.d19.ca

                    robi 1 Reply Last reply Reply Quote 2
                    • robi
                      robi @d19dotca last edited by

                      @d19dotca can you provide example scripts that worked for you?

                      Life of Advanced Technology

                      d19dotca 1 Reply Last reply Reply Quote 0
                      • d19dotca
                        d19dotca @robi last edited by d19dotca

                        @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.

                        --
                        Dustin Dauncey
                        www.d19.ca

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        Powered by NodeBB