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

    webhook - lightweight incoming webhook server to run shell commands

    App Wishlist
    4
    15
    558
    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.
    • T
      thetomester13 App Dev last edited by

      A Golang service where one can set up URL's for webhooks that will run a certain command line argument based on filters and triggers. Github

      Now reading into it, I'm not sure it has much of a web interface - is this a dealbreaker for a Cloudron app? (I have not run this service locally myself). Also open to hearing about alternatives that might have a frontend to go along with such a service.

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

        Hi @thetomester13,

        I actually packaged it already two years ago https://git.cloudron.io/fbartels/webhook-app.

        It indeed does not have a webui. Another complicating factor is that it also greatly depends on the programs that you want to execute with it.

        For most of the automations I am triggering through it, I just run the binary through systemd.

        T timconsidine 3 Replies Last reply Reply Quote 3
        • T
          thetomester13 App Dev @fbartels last edited by

          @fbartels wow what a turnaround time! ๐Ÿ˜‰

          Thanks for sharing the repo and updating to latest, I'll give it a whirl.

          1 Reply Last reply Reply Quote 2
          • timconsidine
            timconsidine App Dev @fbartels last edited by

            @fbartels thanks for packaging this.
            I'm looking into using it and noticed this at the end of the DESCRIPTION.md

            The cloudron cli utility should be used to add custom hooks and place scripts to trigger in ยด/app/data/ยด.

            This is only for the initial deployment, right ?
            Afterwards it can be managed via terminal I presume.

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

              @fbartels small difficulty after installation
              App installed fine and default hooks working fine.
              I add one hook as a test in hooks.json, just to check hook creation.
              Straight copy of the webook config except cwd dir set to /app/data

              Oct 09 05:49:42 [webhook] 2021/10/09 02:49:42 [713620] error parsing body payload due to unsupported content type header:
              Oct 09 05:49:42 [webhook] 2021/10/09 02:49:42 [713620] test hook triggered successfully
              Oct 09 05:49:42 [webhook] 2021/10/09 02:49:42 [713620] error in exec: "/app/data/test.sh": permission denied
              

              test.sh is owned by root

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

                why not use N8N instead? much more featureful and UI.

                Life of Advanced Technology

                timconsidine 2 Replies Last reply Reply Quote 1
                • timconsidine
                  timconsidine App Dev @robi last edited by

                  @robi errr .... good thought !
                  I was led down the road by instructions from SMS provider (telnyx)
                  I will check out if it is posisble.
                  But initially not sure, webhook needs to be received and then acted on by some php scripts.
                  But maybe it's all doable.
                  Will check it out.

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

                    @timconsidine said in webhook - lightweight incoming webhook server to run shell commands:

                    test.sh is owned by root

                    It may be owned by root, but by the output of webhook it seems to exec permissions are missing.

                    @timconsidine said in webhook - lightweight incoming webhook server to run shell commands:

                    This is only for the initial deployment, right ?

                    Yes, today the management could be done just as well through the file manager and the terminal. Back when I wrote that readme I think the file manager did not yet exist.

                    timconsidine 2 Replies Last reply Reply Quote 0
                    • timconsidine
                      timconsidine App Dev @fbartels last edited by

                      @fbartels many thanks
                      I will look at directory permissions etc.
                      I rebuilt the app with Cloudron base 3.0 in Dockerfile, just in case it did something about permissions, but no change.
                      The app is nice - thanks for making it ๐Ÿ‘

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

                        @timconsidine no problem, webhook is a simple, no fuss tool, thats what I like about it.

                        It just has "too less" gui, thats why I never pursued putting it into the appcenter.

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

                          @fbartels I'm totally OK with no GUI
                          I don't think it has any real role in this kind of app.
                          I can't really envisage a case where an app user is deploying the app but is not comfortable with the terminal.
                          The webhooks have got to be consumed, and that's likely to mean some kind of scripting or coding.

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

                            For Cloudron it seems we'd do well with packaging such CLI tools into an app that has a simple lightweight GUI for informational or 3rd party password access instructions.

                            Many GoLang programs fit this model wrapped in a nice UX.

                            Life of Advanced Technology

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

                              @fbartels said in webhook - lightweight incoming webhook server to run shell commands:

                              It may be owned by root, but by the output of webhook it seems to exec permissions are missing.

                              You are indeed correct. logs show :

                              Oct 09 21:56:16 [webhook] 2021/10/09 18:56:16 [706dfd] test hook triggered successfully
                              Oct 09 21:56:16 [webhook] 2021/10/09 18:56:16 [706dfd] executing /app/data/test.sh (/app/data/test.sh) with arguments ["/app/data/test.sh"] and environment [] using /app/data as cwd
                              Oct 09 21:56:16 [webhook] 2021/10/09 18:56:16 [706dfd] command output: pong
                              Oct 09 21:56:16 /app/data/test.sh: 4: cannot create out/test.txt: Permission denied
                              

                              This is a simple test where the working directory is /app/data and the directory and subfolders ownership is set to www-data :

                              #!/bin/sh
                              
                              echo "pong"
                              echo "test" > out/test.txt
                              

                              Pong succeeds but echo to a file does not.

                              Been staring at this and I can't see the problem, so forgive asking for any enlightenment.
                              www-data doesn't seem to be able to access directory owned by www-data. And su - www-data responds with this account is not available.

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

                                @timconsidine grrrr it seems that /app/data needs to be owned by cloudron
                                Then it works.

                                In case that helps anyone else

                                1 Reply Last reply Reply Quote 0
                                • timconsidine
                                  timconsidine App Dev @robi last edited by timconsidine

                                  @robi said in webhook - lightweight incoming webhook server to run shell commands:

                                  why not use N8N instead? much more featureful and UI.

                                  I ran up a quick n8n webhook
                                  Easier than I thought and works well.
                                  The only thing I really understand what to do with webhook payload in a n8n workflow is put it in a database or Baserow (which I have on cloudron) or now also SeaTable (which I have on Caprover).

                                  Not sure n8n is up to the scripting of how the payload needs to be parsed and manipulated and disposed of. But maybe the function node is adequate.

                                  Need to think it through and make a plan.

                                  At least I have 2 options now, n8n and @fbartels' webhook app.
                                  Thanks again.

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