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
  • Brite
  • 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 - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. Surfer
  3. Github Actions documentation/example for Surfer

Github Actions documentation/example for Surfer

Scheduled Pinned Locked Moved Surfer
9 Posts 5 Posters 1.5k Views 5 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.
  • bmannB Offline
    bmannB Offline
    bmann
    wrote on last edited by
    #1

    I'd like to auto deploy some code from a Github repo, using Github actions after a commit happens, to copy files to Surfer.

    Has anyone documented this?

    1 Reply Last reply
    0
    • nebulonN Offline
      nebulonN Offline
      nebulon
      Staff
      wrote on last edited by
      #2

      I don't have any example on hand, but would also be curious how this looks like. Never set up custom Github actions as such. I would assume the surfer cli or just the rest API would be utilized?

      1 Reply Last reply
      0
      • nebulonN nebulon marked this topic as a question on
      • fbartelsF Offline
        fbartelsF Offline
        fbartels
        App Dev
        wrote on last edited by
        #3

        I did not test it, as all my ci is still either in Drone at home or Gitlab at work. But from my understanding it should look like this:

            - name: Deploy to Surfer
              uses: addnab/docker-run-action@v3
              with:
                image: git.9wd.eu/9wd/surfer-action:latest
                run: |
                  surfer --version
                  surfer put --token $SURFTOKEN --server $SURFURL public/* /
        

        (the referenced container is the surfer image I built and have been using for years)

        bmannB 1 Reply Last reply
        4
        • fbartelsF fbartels

          I did not test it, as all my ci is still either in Drone at home or Gitlab at work. But from my understanding it should look like this:

              - name: Deploy to Surfer
                uses: addnab/docker-run-action@v3
                with:
                  image: git.9wd.eu/9wd/surfer-action:latest
                  run: |
                    surfer --version
                    surfer put --token $SURFTOKEN --server $SURFURL public/* /
          

          (the referenced container is the surfer image I built and have been using for years)

          bmannB Offline
          bmannB Offline
          bmann
          wrote on last edited by bmann
          #4

          @fbartels awesome, thank you! Will try this out.

          Update: very close!

          Using server https://localhost.dwebyvr.org
          node:fs:1659
            const stats = binding.stat(
                                  ^
          Error: ENOENT: no such file or directory, stat '/website/*'
              at Object.statSync (node:fs:1659:25)
              at collectFiles (/usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:60:19)
              at /usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:225:40
              at Array.forEach (<anonymous>)
              at Command.put (/usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:221:15)
              at Command.listener [as _actionHandler] (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:494:17)
              at /usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1296:65
              at Command._chainOrCall (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1193:12)
              at Command._parseCommand (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1296:27)
              at /usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1082:27 {
            errno: -2,
            code: 'ENOENT',
            syscall: 'stat',
            path: '/website/*'
          }
          

          So somehow have to give it context of the checked out repo I guess?

          Here's the file in the repo I'm working with: https://github.com/DWebYVR/localhost_vancouver_webring/blob/main/.github/workflows/surfer.yml

          fbartelsF 1 Reply Last reply
          0
          • bmannB bmann

            @fbartels awesome, thank you! Will try this out.

            Update: very close!

            Using server https://localhost.dwebyvr.org
            node:fs:1659
              const stats = binding.stat(
                                    ^
            Error: ENOENT: no such file or directory, stat '/website/*'
                at Object.statSync (node:fs:1659:25)
                at collectFiles (/usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:60:19)
                at /usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:225:40
                at Array.forEach (<anonymous>)
                at Command.put (/usr/local/lib/node_modules/cloudron-surfer/cli/actions.js:221:15)
                at Command.listener [as _actionHandler] (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:494:17)
                at /usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1296:65
                at Command._chainOrCall (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1193:12)
                at Command._parseCommand (/usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1296:27)
                at /usr/local/lib/node_modules/cloudron-surfer/node_modules/commander/lib/command.js:1082:27 {
              errno: -2,
              code: 'ENOENT',
              syscall: 'stat',
              path: '/website/*'
            }
            

            So somehow have to give it context of the checked out repo I guess?

            Here's the file in the repo I'm working with: https://github.com/DWebYVR/localhost_vancouver_webring/blob/main/.github/workflows/surfer.yml

            fbartelsF Offline
            fbartelsF Offline
            fbartels
            App Dev
            wrote on last edited by
            #5

            @bmann said in Github Actions documentation/example for Surfer:

            /website/*

            This is a bit weird. In the output above it complains that it cannot find /website/, while in your yaml you are passing website/. The first one would be no surprise if it does not work, the second one however should work as ci tools usually open a shell where you will be directly in your git checkout.

            I would try to debug this with inserting a few ls and pwd into your yaml to see where you actually are and if this might be a permission issue of some kind.

            1 Reply Last reply
            0
            • jamesJ james marked this topic as a regular topic on
            • rosanoR Online
              rosanoR Online
              rosano
              wrote last edited by
              #6

              Got this working for myself:

              1. create an environment and define your SURFER_TOKEN / SURFER_HOST secrets there
              2. set the environment in your job
              3. expose the secrets to the run command

              My example assumes:

              • environment name alfa
              • you want to upload the bravo directory…
              • to your server under /charlie/delta
              name: Deploy
              
              on: [push]
              
              jobs:
                build_site:
                  runs-on: ubuntu-latest
                  environment: alfa
                  steps:
                    - name: Checkout
                      uses: actions/checkout@v4
              
                    # … other steps for install, build, etc…
              
                    - name: Install surfer
                      run: npm -g install cloudron-surfer
              
                    - name: Upload
                      env:
                        SURFER_TOKEN: ${{ secrets.SURFER_TOKEN }}
                        SURFER_HOST: ${{ secrets.SURFER_HOST }}
                      run: surfer put --token "$SURFER_TOKEN" --server "$SURFER_HOST" bravo/* /charlie/delta
              
              1 Reply Last reply
              3
              • jamesJ Offline
                jamesJ Offline
                james
                Staff
                wrote last edited by
                #7

                Hello @rosano
                We actually published a GitHub action for a more generic use-case.
                https://github.com/cloudron-io/cloudron-push-to-app

                rosanoR 1 Reply Last reply
                4
                • jamesJ james

                  Hello @rosano
                  We actually published a GitHub action for a more generic use-case.
                  https://github.com/cloudron-io/cloudron-push-to-app

                  rosanoR Online
                  rosanoR Online
                  rosano
                  wrote last edited by rosano
                  #8

                  @james i didn't get an email notification for this reply, good to know!

                  i think the use case described previously is more for static sites with surfer (my personal preference as github pages can be super slow to create and upload artifacts).

                  but nonetheless, could you clarify why it seems to push without any docker build step? i'm used to installing custom apps from registries after building so this "push code" concept seems novel.

                  (edit: my email was outdated… just updated)

                  1 Reply Last reply
                  0
                  • jamesJ Offline
                    jamesJ Offline
                    james
                    Staff
                    wrote last edited by
                    #9

                    Hello @rosano
                    The GitHub action is for pushing code from a GitHub repo directly into an app.
                    Like for surfer or LAMP.

                    1 Reply Last reply
                    0
                    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