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 | Demo | Docs | Install
  1. Cloudron Forum
  2. LAMP
  3. Connecting the LAMP app with Git

Connecting the LAMP app with Git

Scheduled Pinned Locked Moved LAMP
10 Posts 4 Posters 75 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.
  • P Offline
    P Offline
    privsec
    wrote last edited by
    #1

    How do we set up GIT from github to auto pull updates from the main branch every time there is an update made or merge performed?

    1 Reply Last reply
    0
    • jamesJ Online
      jamesJ Online
      james
      Staff
      wrote last edited by
      #2

      Hello @privsec

      This could be done in multiple ways.

      You get set a simple cron for your lamp app that just pulls every 5 minutes.

      But this is not reactive to updates to your master branch. It just pulls every 5 minutes.

      A more complex approach would be to set up a GitHub action that pushes the changes to the LAMP app with the cloudron cli.

      1 Reply Last reply
      1
      • jamesJ Online
        jamesJ Online
        james
        Staff
        wrote last edited by
        #3

        Hello @privsec
        I talked with @staff about it, and we asked @BrutalBirdie to create a GitHub Action for this since he knows a lot about GitLab CI/CD and also GitHub actions.

        1 Reply Last reply
        1
        • BrutalBirdieB Online
          BrutalBirdieB Online
          BrutalBirdie
          Partner
          wrote last edited by
          #4

          HeyO 👋 😄

          Now there is this GitHub Repository: https://github.com/cloudron-io/cloudron-push-to-app which publishes this action to the GitHub Marketplace https://github.com/marketplace/actions/cloudron-push-to-app

          The README should explain how to use it.
          Still, this can be confusing for people who never used GitHub actions.

          I have created a demo repo https://github.com/BrutalBirdie/github-action-test-repo and added the workflow according to my README.
          Added an Environment:
          a089ffb1-88ef-43ce-aa35-a101474692a2-image.png
          and the secrets:
          20a75422-173a-4486-9f73-f55556b6c4f4-image.png

          Now if I update the README.md, add a simple index.html and index.css it will be deployed to https://default-lamp.cloudron.dev/ when accessing https://default-lamp.cloudron.dev you should see some neon 404 page and you can access the README.md https://default-lamp.cloudron.dev/README.md

          And in the action view you can see the executed action and logs https://github.com/BrutalBirdie/github-action-test-repo/actions/runs/19704245518/job/56447718391

          Like my work? Consider donating a drink. Cheers!

          1 Reply Last reply
          4
          • J Offline
            J Offline
            joseph
            Staff
            wrote last edited by joseph
            #5

            Oh nice, this is incredible. Can you also make a guide @BrutalBirdie ? A PR to https://docs.cloudron.io/guides/ would be awesome .

            Not a PHP dev but when/where does one run "composer install" in the workflow ? Maybe in the action itself?

            1 Reply Last reply
            1
            • J Offline
              J Offline
              joseph
              Staff
              wrote last edited by
              #6

              Doc page is at https://docs.cloudron.io/guides/github-action/

              1 Reply Last reply
              1
              • P Offline
                P Offline
                privsec
                wrote last edited by
                #7

                This is awesome! Now, how can I confirm if this worked?

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  privsec
                  wrote last edited by
                  #8

                  Also, looks like in the YAML file the token and url is wapped

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    privsec
                    wrote last edited by
                    #9

                    I keep getting this error message

                    image.png

                    I have ensured that the URL, Token, and App ID are correct.

                    Here is my YAML file

                    on:
                      push:
                        branches:
                          - main
                    jobs:
                      deploy-to-cloudron-app:
                        runs-on: ubuntu-latest
                        environment: my.domain.com
                        steps:
                          - name: Checkout Repository
                            uses: actions/checkout@v6
                          - name: Setup PHP
                            uses: shivammathur/setup-php@v2
                            with:
                              php-version: '8.3'
                              extensions: pdo_mysql, pdo, json, mbstring, curl
                              coverage: none
                          - name: Verify PHP Extensions
                            run: |
                              echo "PHP Version:"
                              php -v
                              echo -e "\nInstalled Extensions:"
                              php -m | grep -E "(pdo_mysql|pdo|json|mbstring|curl)" || echo "Some extensions not found"
                              echo -e "\nAll PHP Extensions:"
                              php -m
                          - name: Install composer dependencies
                            run: |
                              composer install --no-interaction --prefer-dist --optimize-autoloader
                          - name: Verify Cloudron Connection
                            run: |
                              if [ -z "${{ secrets.CLOUDRON_URL }}" ]; then
                                echo "Error: CLOUDRON_URL secret is not set"
                                exit 1
                              fi
                              echo "Cloudron URL configured: ${{ secrets.CLOUDRON_URL }}"
                              echo "App ID: ${{ secrets.CLOUDRON_APP_ID }}"
                          - name: Cloudron Push to App
                            uses: cloudron-io/cloudron-push-to-app@latest
                            with:
                              CLOUDRON_URL: "${{ secrets.CLOUDRON_URL }}"
                              CLOUDRON_TOKEN: "${{ secrets.CLOUDRON_TOKEN }}"
                              CLOUDRON_APP_ID: "${{ secrets.CLOUDRON_APP_ID }}"
                              CLOUDRON_PUSH_DESTINATION: "/app/data" (I want to push to this directory, rather then to public)
                              CLOUDRON_CREATE_APP_BACKUP: "false"
                    
                    
                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      joseph
                      Staff
                      wrote last edited by
                      #10

                      Just guessing but @brutalbirdie can confirm. Does CLOUDRON_URL need to have https:// ?

                      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