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. LAMP
  3. Lamp App with Git

Lamp App with Git

Scheduled Pinned Locked Moved Solved LAMP
lamp
5 Posts 3 Posters 1.1k Views 3 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.
    • J Offline
      J Offline
      jdelon02
      wrote on last edited by girish
      #1

      Hello,

      I was wondering if git is available to the lamp app for deploying web projects? I use drupal and WP for various projects, and being able to deploy the code directly from a git hosting service and then run composer install to get any dependencies would be much more inline with the method I currently.

      Thanks,

      Jeremy

      1 Reply Last reply
      0
      • girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #2

        @jdelon02 Currently, you can only upload via SFTP. We are working on git support for the next release. Please see my comment at https://forum.cloudron.io/topic/1948/using-mongodb-instead-of-mysql-in-a-lamp-app

        murgeroM 1 Reply Last reply
        0
        • girishG girish

          @jdelon02 Currently, you can only upload via SFTP. We are working on git support for the next release. Please see my comment at https://forum.cloudron.io/topic/1948/using-mongodb-instead-of-mysql-in-a-lamp-app

          murgeroM Offline
          murgeroM Offline
          murgero
          App Dev
          wrote on last edited by murgero
          #3

          @girish I coulda sworn I was able to git clone blahblah in LAMP, is that not possible anymore...?

          Edit: Yeah, it works for me?

          4c6623ff-73e4-49c9-8aff-52791bb9c093-image.png

          What I did in my lamp was:

          cd /app/data/public
          rm -rf ./.
          cd ..
          git clone <URL> public
          

          Will put a git repo right in the apache web root folder.

          --
          https://urgero.org
          ~ Professional Nerd. Freelance Programmer. ~

          1 Reply Last reply
          0
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #4

            @murgero You are right. I think what some users are looking for is a "git push" based workflow (like in heroku). So, your code is hosted on gitlab/gogs and they just want to do "git push lamp" and expect it to deploy to the lamp server. I guess the main advantage is that they don't need to open Cloudron terminal + also can integrate with CI/CD.

            murgeroM 1 Reply Last reply
            0
            • girishG girish

              @murgero You are right. I think what some users are looking for is a "git push" based workflow (like in heroku). So, your code is hosted on gitlab/gogs and they just want to do "git push lamp" and expect it to deploy to the lamp server. I guess the main advantage is that they don't need to open Cloudron terminal + also can integrate with CI/CD.

              murgeroM Offline
              murgeroM Offline
              murgero
              App Dev
              wrote on last edited by
              #5

              @girish & @jdelon02

              I believe LAMP app supports cron, in that case use the following script to auto-pull from a git repo whenever an update is pushed to that repo:

              Put in /app/data/updateGit

              #!/bin/sh
              
              ## CD to the path where the app is installed.
              cd /app/data/public
              UPSTREAM=${1:-'@{u}'}
              LOCAL=$(git rev-parse @)
              REMOTE=$(git rev-parse "$UPSTREAM")
              BASE=$(git merge-base @ "$UPSTREAM")
              
              if [ $LOCAL = $REMOTE ]; then
                  echo "Up-to-date"
              elif [ $LOCAL = $BASE ]; then
                  echo "Need to pull"
                  git pull
              elif [ $REMOTE = $BASE ]; then
                  echo "Need to push? Some files changed / commited here, this should not have happened."
              else
                  echo "Diverged?? Help!"
              fi
              

              Then in /app/data/crontab:

              */5 * * * * bash /app/data/updateGit 2>&1
              
              ## Or if you wanna avoid filling logs:
              */5 * * * * bash /app/data/updateGit  2>&1 > /dev/null
              

              This will check if a pull is needed from a repo every 5 minutes. (Re: https://crontab.guru/every-5-minutes)

              You can also modify the bash script to rebuild, npm install, composer install, etc when needed too.

              --
              https://urgero.org
              ~ Professional Nerd. Freelance Programmer. ~

              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