Easy site deployment on Gandi with git and gdeploy (bash)

(Use this link to get 6 months of free hosting on Gandi!).

I’m doing more and more Laravel development and I’m hosting these projects on Gandi.net Simple Hosting. I’ve also switched completely to Gandi’s deploy with git method, since it lets me do full and easy deployment from my laptop’s command line. I’ve even created a bash script gdeploy.sh to make this faster, Let me explain how it works:

  1. when you start your project, add the git remote for gandi, as specified in your Gandi Simple Hosting dashboard
  2. develop and run your project locally (using e.g. php artisan serve)
  3. when you want to deploy, you commit the changes to the master branch
    • git commit -a
  4. you then push the changes to the Gandi git server
    • git push gandi master
  5. you then start deployment from the Gandi git server to the web server. This will also do a composer install (if there is a composer.lock file) and a npm install (if there is a package-lock.json file)
    • ssh <id>@<gitserver> deploy <website>.git

I have multiple Gandi Simple Hosting servers and I found it confusing to keep track of what server I was supposed to deploy to for each site. So I developed gandi_deploy. This is how that works:

Installation

Easy deployment

./gdeploy.sh all

to commit, push and deploy new code to Gandi, in 1 go
💬 github 🏷 bash 🏷 deploy 🏷 gandi 🏷 github 🏷 webmaster