Feb 18, 2014

Deploy to your FTP through BitBucket ... and soon Github

Update - August 2016
FTPbucket is a PHP script that enables you to sync your BitBucket or GitHub repository with any web-server. It works with Git and Mercurial.

This post is outdated. Please go directly to Github to find the latest informations.

FTPbucket is a PHP script that enables you to sync your BitBucket repository with any FTP account.

I was looking for an easy solution to use Git on a webproject with a server with no Git installed (hehe). After checking several solutions, I could not find a free one that could fits my needs.

So :

Installation

  • Get the code here
  • Edit the config file and rename it to 'config.php'
  • Copy the deploy folder on your FTP server
  • On Bitbucket>Admin>Hooks, setup a POST hook pointing to http://myserver/deploy/deploy.php
  • You can Push now!

Limitations

  1. The script only copies the files you are pushing. It means that if you start with this tool when you already have files in your BitBucket repo, they won't be copied on the server. I'm looking for solutions on a full deploy. Which brings me the second point.
  2. I tried to push a 160Mo repo with more than 26 000 files and the POST hook didn't like it. The limit is ~1000 files/push I think. It's an unsolved issue: https://bitbucket.org/site/master/issue/7439/git-post-commit-hook-payloads-has-empty
SOLUTION : When you create a new repo on BB and need to push a lot of files, just do it. Right after, you set up the POST hook and manually copy the repo and FTPbucket files on your FTP.

More

It should work with Mercurial too but it's not tested yet.

I'm sure a lot of improvements can be made to my code so don't hesitate to fork and improve it! I would be glad to hear about your tests and issues too.

ToDo

I would like to have a simple GUI to manage logs and configs
I need to implement a way to call for action, when the file copy is done. A post-commit hook.
Add support for SSH, Github and more ...

No comments:

Post a Comment