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


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Feature Requests
  3. Add Pre-Backup and Post-Backup Hooks

Add Pre-Backup and Post-Backup Hooks

Scheduled Pinned Locked Moved Feature Requests
backups
9 Posts 5 Posters 1.1k Views 4 Watching
  • 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.
    • njN Offline
      njN Offline
      nj
      wrote on last edited by girish
      #1

      Cloudron doesn’t have a scheduler or cron system that can trigger a script before starting to backup an app, or after backup succeeds/fails. If we could configure a script to run at these times it would be nice.

      • Before backup task starts
      • After backup task succeeds
      • After backup task fails

      This would help some apps perform housekeeping. To be honest it would be much useful for the ERPNext app that I packaged. 🤷

      Founder / Coder • My Apps

      girishG 1 Reply Last reply
      8
      • njN nj

        Cloudron doesn’t have a scheduler or cron system that can trigger a script before starting to backup an app, or after backup succeeds/fails. If we could configure a script to run at these times it would be nice.

        • Before backup task starts
        • After backup task succeeds
        • After backup task fails

        This would help some apps perform housekeeping. To be honest it would be much useful for the ERPNext app that I packaged. 🤷

        girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #2

        @nj said in Add Pre-Backup and Post-Backup Hooks:

        This would help some apps perform housekeeping. To be honest it would be much useful for the ERPNext app that I packaged.

        Can you tell me a bit more about this. Are we talking about some webhooks or some bash scripts to run ? If bash scripts, are these to be run on the host or inside the ERPNext container?

        njN 1 Reply Last reply
        1
        • girishG girish

          @nj said in Add Pre-Backup and Post-Backup Hooks:

          This would help some apps perform housekeeping. To be honest it would be much useful for the ERPNext app that I packaged.

          Can you tell me a bit more about this. Are we talking about some webhooks or some bash scripts to run ? If bash scripts, are these to be run on the host or inside the ERPNext container?

          njN Offline
          njN Offline
          nj
          wrote on last edited by nj
          #3

          @girish I'm thinking of running the script inside the container.

          In my case, since ErpNext doesn't properly support MySQL and Postgres, a separate process of MariaDB is running in the container apart from the supervisor. The data generated by MariaDB resides at /app/data/mariadb folder so that it gets backed up regularly. The problem is, the backup task could run when the data is still being written, or in the middle of a database transaction.

          If there was a pre-backup hook, I could place mariadb inside /run/mariadb and run mysqldump > /app/data/dump.sql right before backup so the database dump would be backed up instead of the whole mariadb folder, and the data consistency would be guaranteed.

          I'd suggest the system waited for docker exec <app-container> bash -c /app/pkg/pre-backup-hook.sh before starting to back it up and ran docker exec <app-container> bash -c /app/pkg/post-backup-hook.sh it would be near perfect.

          Founder / Coder • My Apps

          girishG 1 Reply Last reply
          0
          • njN nj

            @girish I'm thinking of running the script inside the container.

            In my case, since ErpNext doesn't properly support MySQL and Postgres, a separate process of MariaDB is running in the container apart from the supervisor. The data generated by MariaDB resides at /app/data/mariadb folder so that it gets backed up regularly. The problem is, the backup task could run when the data is still being written, or in the middle of a database transaction.

            If there was a pre-backup hook, I could place mariadb inside /run/mariadb and run mysqldump > /app/data/dump.sql right before backup so the database dump would be backed up instead of the whole mariadb folder, and the data consistency would be guaranteed.

            I'd suggest the system waited for docker exec <app-container> bash -c /app/pkg/pre-backup-hook.sh before starting to back it up and ran docker exec <app-container> bash -c /app/pkg/post-backup-hook.sh it would be near perfect.

            girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #4

            @nj I guess we will also need recovery hooks in that case. I think it's probably easier to support MariaDB itself as an addon at that point.

            So, ERPNext can never support MySQL is it? Do you know why it can only support MariaDB?

            robiR 1 Reply Last reply
            1
            • girishG girish

              @nj I guess we will also need recovery hooks in that case. I think it's probably easier to support MariaDB itself as an addon at that point.

              So, ERPNext can never support MySQL is it? Do you know why it can only support MariaDB?

              robiR Offline
              robiR Offline
              robi
              wrote on last edited by
              #5

              @girish I'm pretty sure it does support both as a quick search reveals plenty of erpnext and mysql hits.

              Conscious tech

              njN 1 Reply Last reply
              1
              • robiR robi

                @girish I'm pretty sure it does support both as a quick search reveals plenty of erpnext and mysql hits.

                njN Offline
                njN Offline
                nj
                wrote on last edited by nj
                #6

                Frappe devellopers tell that they officially only support MariaDB (their docs, tutorials, docker image, etc.) Hint: https://discuss.frappe.io/t/can-i-use-mysql-instead-of-mariadb/9078/2

                Suppose, it supports MySQL. Even then, there is a major blocker because Frappe requirements are high:

                • either the root user's password
                  OR
                • username/password for another user with permission to create new databases and users, and also delete them.

                Possible Solution could be Cloudron MySQL's multiple databases. Could the Addon provide username/password for the user having these permissions?

                • create new database
                • create new user
                • grant that user access to the new database
                • when needed drop the database and the user
                • some kind of limit to only allow that user to drop the user/database created by them would suffice.
                • some kind of limit on the number of databases/users they can create would be cool.

                So.. there's a huge possibility that Cloudon officially supports ErpNext, because MySQL is the only blocker now. I've already customized it to use Cloudron addons (redis, ldap, email is WIP).

                Since ERPNext is one of the most voted and oldest entry, @girish or @nebulon could look into modifying MySQL addon to support database and user creation. 👐

                Founder / Coder • My Apps

                jdaviescoatesJ girishG 2 Replies Last reply
                1
                • njN nj

                  Frappe devellopers tell that they officially only support MariaDB (their docs, tutorials, docker image, etc.) Hint: https://discuss.frappe.io/t/can-i-use-mysql-instead-of-mariadb/9078/2

                  Suppose, it supports MySQL. Even then, there is a major blocker because Frappe requirements are high:

                  • either the root user's password
                    OR
                  • username/password for another user with permission to create new databases and users, and also delete them.

                  Possible Solution could be Cloudron MySQL's multiple databases. Could the Addon provide username/password for the user having these permissions?

                  • create new database
                  • create new user
                  • grant that user access to the new database
                  • when needed drop the database and the user
                  • some kind of limit to only allow that user to drop the user/database created by them would suffice.
                  • some kind of limit on the number of databases/users they can create would be cool.

                  So.. there's a huge possibility that Cloudon officially supports ErpNext, because MySQL is the only blocker now. I've already customized it to use Cloudron addons (redis, ldap, email is WIP).

                  Since ERPNext is one of the most voted and oldest entry, @girish or @nebulon could look into modifying MySQL addon to support database and user creation. 👐

                  jdaviescoatesJ Offline
                  jdaviescoatesJ Offline
                  jdaviescoates
                  wrote on last edited by
                  #7

                  @nj said in Add Pre-Backup and Post-Backup Hooks:

                  y, @girish or @nebulon could look into modifying MySQL addon to support database and user creation.

                  Sounds to me like a MariaDB addon might be a better solution given what @girish said previously

                  @girish said in Add Pre-Backup and Post-Backup Hooks:

                  I think it's probably easier to support MariaDB itself as an addon

                  I use Cloudron with Gandi & Hetzner

                  1 Reply Last reply
                  0
                  • njN nj

                    Frappe devellopers tell that they officially only support MariaDB (their docs, tutorials, docker image, etc.) Hint: https://discuss.frappe.io/t/can-i-use-mysql-instead-of-mariadb/9078/2

                    Suppose, it supports MySQL. Even then, there is a major blocker because Frappe requirements are high:

                    • either the root user's password
                      OR
                    • username/password for another user with permission to create new databases and users, and also delete them.

                    Possible Solution could be Cloudron MySQL's multiple databases. Could the Addon provide username/password for the user having these permissions?

                    • create new database
                    • create new user
                    • grant that user access to the new database
                    • when needed drop the database and the user
                    • some kind of limit to only allow that user to drop the user/database created by them would suffice.
                    • some kind of limit on the number of databases/users they can create would be cool.

                    So.. there's a huge possibility that Cloudon officially supports ErpNext, because MySQL is the only blocker now. I've already customized it to use Cloudron addons (redis, ldap, email is WIP).

                    Since ERPNext is one of the most voted and oldest entry, @girish or @nebulon could look into modifying MySQL addon to support database and user creation. 👐

                    girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #8

                    @nj thanks for clarifying, indeed those database requirements are pretty far out. Wow, I am yet to see any web app software require database root credentials and create databases on the fly. Seems to not make sense.

                    MooCloud_MattM 1 Reply Last reply
                    0
                    • girishG girish

                      @nj thanks for clarifying, indeed those database requirements are pretty far out. Wow, I am yet to see any web app software require database root credentials and create databases on the fly. Seems to not make sense.

                      MooCloud_MattM Offline
                      MooCloud_MattM Offline
                      MooCloud_Matt
                      wrote on last edited by MooCloud_Matt
                      #9

                      @girish said in Add Pre-Backup and Post-Backup Hooks:

                      Seems to not make sense.

                      That's normal for ERPs, almost all ERPs require full access to their database.
                      This is mostly due to the Modular idea for modern ERP, which implements different DB for each module like a microservice.
                      And communicate between with API or Functions Hooks

                      Matteo. R.
                      Founder and Tech-Support Manager.
                      MooCloud MSP
                      Swiss Managed Service Provider

                      1 Reply Last reply
                      1
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Bookmarks
                        • Search