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

    "git push" (ci/cd) workflow for the LAMP app

    LAMP
    3
    5
    391
    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.
    • S
      simon last edited by

      With traditional Webhosting we deploy our Websites with gitlab runner and git push.
      When I think about Website Hosting via Cloudron I also need a continuous delivery workflow.
      So what are the options?

      With the official LAMP App I see only a cron based workflow, like @murgero describes in https://forum.cloudron.io/post/4654
      Of course, it would be better to be able to trigger an update script differently. For example, as with the surfer app via CLI and token. https://docs.cloudron.io/apps/surfer/#cicd-integration
      Are there for the LAMP App perhaps already possibilities here or is something like this planned for the future?

      The alternative would probably be a costum app, but here I lack the experience so far. Seems to me also much overhead for the desired feature.
      But maybe I am wrong?

      girish 1 Reply Last reply Reply Quote 0
      • girish
        girish Staff @simon last edited by

        @simon Yeah, agreed. Instead of making a custom app, I would much prefer to implement it in the app or Cloudron itself.

        Can you tell me a bit more about your git push workflow? I guess the runner would deploy the site with SSH keys? How does the Website Hosting side look like for this setup? Do you simply just "git init" and ssh+git takes care of git push working (or do you have some specialized software to managed ssh deploy keys etc) ?

        S 1 Reply Last reply Reply Quote 0
        • S
          simon @girish last edited by

          @girish

          Do you simply just "git init" and ssh+git takes care of git push working (or do you have some specialized software to managed ssh deploy keys etc) ?

          yes, all quite simple. git + ssh key, no special software. It's a simple shell runner.
          After the git push we log in again via SSH to trigger an install script. Of course this could be done in another way.

          $ git push ssh://user@example.com:/var/www/vhosts/site/httpdocs/site HEAD:refs/heads/master --tags
          $ ssh user@example.com "cd /var/www/vhosts/site/httpdocs/site  && git checkout -f master && chmod +x .bin/publish-tag && .bin/publish-tag"
          

          "publish-tag" is a bash script, with some CMS specific installation routines like composer install and drush commands (in case of Drupal as CMS) or some php artisan commands for Laravel based projects.

          1 Reply Last reply Reply Quote 0
          • nebulon
            nebulon Staff last edited by

            I guess there are a few ways we could implement this. Besides the actual git push to get things deployed, the question then is how to run post-deployment scripts and how the main process if any is run.

            We could follow what heroku is doing here with procfiles or we could have a very simple git hook, which simply runs an executable/shell script at a well-defined path (say ./start.sh) after git push.

            Also similar to the github pages, some stacks like nodejs, rails, ... could be pre-installed. However that might complicate updating those without breaking existing ones a lot.

            girish 1 Reply Last reply Reply Quote 0
            • girish
              girish Staff @nebulon last edited by

              @nebulon I think for a start just making ssh based git push/pull work with hooks on the Github Pages and LAMP app is good enough. I think for rest of the "complicated" apps, we have to really make some container based PaaS, where we build the container as well (just like Heroku). That's a really long term feature.

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