"git push" (ci/cd) workflow for the LAMP app
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?
@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) ?
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://firstname.lastname@example.org:/var/www/vhosts/site/httpdocs/site HEAD:refs/heads/master --tags $ ssh email@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
drushcommands (in case of Drupal as CMS) or some
php artisancommands for Laravel based projects.
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.
@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.