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


Navigation

    Cloudron Forum

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

    Beginner's Guide: Hugo + Gitlab CI + Surfer

    Discuss
    7
    23
    165
    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.
    • girish
      girish Staff @vjvanjungg last edited by

      @vjvanjungg very nice, concise and crisp reading! Don't you need to setup a build server for the gitlab pipeline to work? Or did I miss that part in the tutorial?

      V atrilahiji 2 Replies Last reply Reply Quote 1
      • V
        vjvanjungg @girish last edited by

        @girish thanks, we’re just letting the gitlab ci do the work, that’s how i understand it now. if that what u mean be build server, enlighten me otherwise

        1 Reply Last reply Reply Quote 0
        • A
          adrw @vjvanjungg last edited by

          @vjvanjungg Great tutorial! I wouldn't have guessed it'd be so easy to have a full CI + deploy for a static site all within Cloudron.

          V 1 Reply Last reply Reply Quote 1
          • atrilahiji
            atrilahiji App Dev @girish last edited by atrilahiji

            @girish This appears to be on gitlab.com so it uses their shared CI runners.

            @vjvanjungg I would suggest adding a note about using a Cloudron or other self hosted gitlab instance. You would need to host your own gitlab-runner for this to work.

            I am now realizing that I didn't include this in my guide...

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

              @atrilahiji said in Beginner's Guide: Hugo + Gitlab CI + Surfer:

              @girish This appears to be on gitlab.com so it uses their shared CI runners.

              Yes, my bad, I missed the gitlab.com URL !

              1 Reply Last reply Reply Quote 1
              • atrilahiji
                atrilahiji App Dev last edited by atrilahiji

                Either way guides like this are perfect. IMO git driven static sites via static site generators are the best way to do static sites. No sense having a server or DB behind a site to serve articles or add new pages.

                Best part is, if you want to roll back a change you have the entire history of your site available as "backups" on git. Just revert a commit. 🙂

                1 Reply Last reply Reply Quote 3
                • V
                  vjvanjungg @adrw last edited by

                  @adrw yesh, me too when i saw it live! shout out to @atrilahiji too, if you haven’t watched his video come and watch it , it’s what inspired this one with great info:

                  https://video.lahijiapps.dev/videos/watch/3540b0bb-553f-43bb-8087-fa8e26fd0d46

                  atrilahiji 1 Reply Last reply Reply Quote 2
                  • atrilahiji
                    atrilahiji App Dev @vjvanjungg last edited by

                    @vjvanjungg glad it could help! I’m hoping to get around to making more guides for things but I do this reactively mostly. Perhaps a guide for building basic Vue frontend apps or personal sites?

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

                      does gitea or gogs not have any CI?

                      girish atrilahiji 2 Replies Last reply Reply Quote 2
                      • girish
                        girish Staff @robi last edited by

                        @robi I think they only integrate with existing CI systems like drone.

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

                          @robi Drone is the best one right now. @fbartels did offer to package it if there was interest and I believe he wanted it to be sponsored. I would check that out.

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

                            Drone indeed integrates quite easily with Gitea. More information on my app offering can be found at https://forum.cloudron.io/topic/3350/offered-drone-ci-on-cloudron

                            The one thing I particularly like is that I only need the "Dashboard" to be centrally hosted, all the job runners can run inside private networks. The runner is a small golang binary that can easily be launched with docker-compose. This allows me to simply start the runner on whatever device I am currently working (desktop, laptop, chromebook, mini homeserver).

                            This is my drone configuration to build my hugo site and deploy it to my surfer instance:

                            ---
                            kind: pipeline
                            name: blog
                            concurrency:
                              limit: 1
                            steps:
                              - name: submodules
                                image: alpine/git
                                commands:
                                  - git submodule update --init --recursive --remote
                              - name: build
                                image: plugins/hugo
                                settings:
                                  hugo_version: 0.79.0
                                  extended: true
                                  validate: true
                              - name: deploy
                                image: 'fbartels/cloudron-surfer:5.12.2'
                                environment:
                                  SURFTOKEN:
                                    from_secret: surftoken
                                commands:
                                  - surfer --version
                                  - touch public/ # touch folder to avoid problems with timestamps
                                  - surfer put --token $SURFTOKEN --server blog.9wd.eu ./public/* /
                                when:
                                  branch:
                                    - master
                                  event:
                                    exclude:
                                      - pull_request
                              - name: Notification Rocket.Chat
                                image: rmilewski/drone-rocket:latest
                                when:
                                  status:
                                    - success
                                    - failure
                                settings:
                                  webhook: https://chat.9wd.eu/hooks/$(ROCKETSECRET)
                                  username: rocket.cat
                                  channel: drone
                                  color:
                                    - value: green
                                      when:
                                        DRONE_BUILD_STATUS: success
                                    - value: red
                                      when:
                                        DRONE_BUILD_STATUS: failure
                                  message:
                                    - value: "Build: ${DRONE_BUILD_NUMBER} succeeded. Good job."
                                      when:
                                        DRONE_BUILD_STATUS: success
                                    - value: "Build: ${DRONE_BUILD_NUMBER} failed. Fix me please."
                                  text: ${DRONE_COMMIT_MESSAGE}
                                  fields:
                                    - title: Author
                                      value: ${DRONE_COMMIT_AUTHOR}
                                    - title: Demo
                                      value: "This field will only be visible if the current branch: ${DRONE_COMMIT_BRANCH} is master or production"
                                      when:
                                        DRONE_COMMIT_BRANCH:
                                          - master
                                          - production
                            
                            girish 1 Reply Last reply Reply Quote 3
                            • girish
                              girish Staff @fbartels last edited by

                              @fbartels IIRC, a complication with packaging drone was that it required ENV vars to be set before the app is even started. Like you have to select the integration type etc. Is that still the case? If so, how would a Cloudron installation UX for this look like? Just choose some default and let the user edit the config file?

                              robi fbartels 2 Replies Last reply Reply Quote 0
                              • robi
                                robi @girish last edited by

                                @girish bring up the app with first run instructions then on restart it reconfigures to prod.

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

                                  @girish kind of what @robi said. At first startup it creates a config file in the app that still needs to be manually edited in regards to where Gitea can be reached as well as its configured client id and secret.

                                  I did add you to the repo a while ago, so you can also have a direct look at https://github.com/fbartels/cloudron-drone-app/

                                  jdaviescoates 1 Reply Last reply Reply Quote 1
                                  • jdaviescoates
                                    jdaviescoates @fbartels last edited by

                                    @fbartels said in Beginner's Guide: Hugo + Gitlab CI + Surfer:

                                    I did add you to the repo a while ago, so you can also have a direct look at https://github.com/fbartels/cloudron-drone-app/

                                    I'm getting a 404 there.

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

                                      @jdaviescoates Its a private repo. He'd have to invite you to it via your Github account.

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

                                        @jdaviescoates it's a private repo. You can get access by sponsoring me on GitHub. More details at https://forum.cloudron.io/topic/3350/offered-drone-ci-on-cloudron

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

                                          @fbartels Beat me to it :^)

                                          fbartels jdaviescoates 2 Replies Last reply Reply Quote 1
                                          • fbartels
                                            fbartels App Dev @atrilahiji last edited by

                                            @atrilahiji i would have said it's the other way around 😅

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post