Journal Contact

Speedy & Simple Deploys With Slipspace


While there are many complex and powerful tools for deploying your projects, I found myself wanting something that was much more simple, yet still flexible. I had originally considered Scott Nelson's Dandelion, which is a nice little Ruby gem that lets you deploy your project through FTP, SFTP, or Amazon S3. However, I soon realized it was more built for people on shared hosting, who didn't have direct SSH access to their servers. It also didn't allow for much flexibility as far as post-deploy tasks.

So with that, I set out to build something that was simple to use, but also filled all the requirements I would want for deployments. Fast-forward a few days, and I'd like to introduce Slipspace. Slipspace is a bash script (or function rather) that uses a simple JSON file to configure your deployments. Here's an example config file.

{
  "environments": {
    "staging": {
      "host": "192.42.243.146",
      "user": "root",
      "path": "/home/root/myproject-staging",
      "after": [
        "composer install",
        "composer update",
        "chmod -R og-rx .git"
      ],
      "migrate": "php artisan migrate"
    },
    "production": {
      "host": "192.81.221.137",
      "user": "root",
      "path": "/home/root/myproject",
      "after": [
        "composer install",
        "composer update",
        "chmod -R og-rx .git"
      ],
      "migrate": "php artisan migrate"
    }
  }
}

Pretty simple, right? The environments are meant to coincide with a Git branch, that will be checked out and pulled from. For each environment, you specify your server details, project path, and any post-deploy commands you want to run. There's even an optional migrate command to specify how you'd like to run migrations, if you need to do so.

Once you have Slipspace installed, it's just a matter of navigating to your project's directory, and running:

slipspace deploy your-environment --migrate

Now just kick back, and enjoy how simple your deploy was. Nice job, Ace!

Interested in learning more? Found a problem? Want to make it better? Please feel free to fork it or file an issue on GitHub. Happy deploying!

comments powered by Disqus