Best practice for deploying Kirby (shared hosting, vagrant)

Hi all,

Finally finished tuning up the code for my kirby project, bought a license, now just need some help with deployment. I’m a real beginner! So if you have any references/advice please keep this in mind haha. Up until now I’ve been manually transferring files via FTP.

I’ve been trying to find the best way to get my site live and there are so many options, I’m not sure which are relevant to me. I’ve got shared hosting on Zuver where I already have a php-based site (which I need to delete).

Notes:

  • I have key-based SSH access
  • Using vagrant to develop locally on an Ubuntu 14.04 box (as per Travis Maynard’s example)
  • I want to continuously(?) push from my local repo to zuver (I fiddle with css a lot)
  • Using git for version control locally

Not sure which of these I should be doing?

  • Vagrant push (doesn’t look like its for continuous deployment—would upload everything each time or have to manually specify which files were changed?)
  • Capistrano (honestly can’t follow a lot of this…)
  • Alternative deploy tool like Deploybot (trying to avoid)
  • Rsync
  • Git push
  • D: All of the above??

If you guys have any suggestions that would be great :slight_smile: If Capistrano is the best way to go… I will delve into the documenation deeper!

Thanks!

1 Like

Let’s start by making clear that all of what I’m about to write is pure opinion - my opinion. “Best practice” is a matter of who defines “best” and how :wink:
From your description I’m assuming you’re the sole developer of this project, which heavily influences my recommendation.

  • Rsync is probably the easiest / most reasonable to set up and use as a single developer - assuming that your shared hosting supports it (I’ve seen shared hostings that did not). You can essentially deploy with a single rsync command and it is fairly easy to turn this into a gulp task (if you happen to be using gulp anyway) or similar. I’ve used rsync-based deployments - some with bash scripts, some with gulp - many times and so far I can’t complain. Given your limited experience, I would recommend this approach to start with.
  • Git push is IMO the most reliable way to get an exact commit deployed. It does however require a bit of manual work to get set up - I’m assuming you would want to automate the deployment being triggered by a push to your origin/master branch. See https://gist.github.com/thomasfr/9691385
  • Vagrant push may seem a bit inelegant since (S)FTP always copies all the files, but it does have its advantages as it is extremely easy to set up and works reliably even on hosting environments that don’t provide a useful shell environment (or none at all).
  • Capistrano is awesome for deployment because it is very powerful and can do almost anything. It does however come with a steep learning curve and its real advantages IMO only come into play if you have multiple projects and/or multiple developers and/or advanced deployment scenarios with multiple environemtns, load balancing, clusters etc.The question is, whether or not you have the time to really get to know Capistrano (it’s definitely worth a look).
  • Other deploy / build tools - there are so many and as a single developer, setting up a dedicated build / deployment system seems hardly worth the effort unless you have more than just a few projects that you would like to deploy consistently.
  • All of the above - only if building highly complex deployment scenarios is your hobby (and I’m not judging ;)), or if you’re payed to do that.

I’m sure the next post will contain different opinions. In the end you’ll have to make your own decision anyway :innocent:

1 Like

I think there are already some posts lurking around in this forum about this topic, maybe you find some fitting answer there too.

Never the less I could suggest you to try out https://www.deployhq.com/ . It has 1 repository in their free plan with 10 deploys per day. You can set a branch from which deployhq should deploy changes (e.g. your master branch). It is up to you if to chose from different upload methods like: sftp / ftp or ssh.

I’m no expert in server environments and related things but I’m kind of in your situation where I want to move away from copying files in Filezilla to something with versioning.

Github costs money

One pittfall of Github is that it costs money to have private repositories and when on a limited budget you want to make sure to spend the money on Kirby licenses instead. :wink:

The second best as similar service seems to be Bitbucket.

Git is not installed

Another problem I have is that I’m on a shared hosting. Git is not installed.

Just a few days ago I read about Bitbucket Pipelines. It seems to solve at least my two problems.

This video seems to be a great way to in a very simple way use Bitbucket to version files but still use the FTP way to send the files, without hassle.

I have not tried it yet, but I’m impressed of how simple it looks

If anyone can solve these two problems differently (no money, no git) another simple way it would be nice to hear as well.

Another alternative is GitLab.

Thanks all! Really useful information.

I think I’m going to delve deeper in to rsync and then maybe look at third party apps if it doesn’t work out.

I’ll move this topic to hosting for now and hopefully update with a solution… (if moderators have any guidance on where this thread belongs please feel free to move?)

1 Like

I use this tool: https://github.com/git-ftp/git-ftp

you can install it with brew: brew install git-ftp

2 Likes

Because i just found this thread, here is a really detailed and beginner friendly article about deploying code with rsync: https://blog.fortrabbit.com/deploying-code-with-rsync

1 Like