In this blog post, I will briefly cover git and version control, but the purpose of this article is to introduce and review FTPloy. By no means am I a git expert, so I suggest you do you own research and find your favorite workflow.
If you’re a web developer working with any type of code, you know how annoying it can be to upload updates to a staging or a production server. You probably make edits on your local machine using something like MAMP (WAMP for Windows) and then upload them via an FTP client, so you could show your amazing work to your boss, co-worker or the world. As if that wasn’t enough, you might also work from two different computers and to make sure you have the latest version of the code, you download the latest files from the server using FTP. Sound familiar? By now you’re probably ready to explode with frustration and for good reason! I too found myself in that situation all too often.
You might already be familiar with the concept of version control and git. If you’re not, you should definitely get yourself familiar. It’s a great tool for managing and tracking your files as you develop websites. It opens up many possibilities and creates an extra layer of protection in case you need to go back to a previous version of a file in your project, or if you accidentally delete your files. Here’s what the typical git workflow looks like:
git add .
git commit -m ‘First commit’
The New Problem
Now that we’re tracking our files, instead of having to upload them to the server manually with FTP, it would be nice if you could push the latest code version straight from the terminal. That would ensure that the code you have locally matches up whatever is on staging or production. Although it’s possible to connect to your server via ssh, and use the command line to upload files to your server, I personally had a lot of resistance while trying to connect. At that point I felt I was stuck.
The Solution: FTPloy
After days of researching file deployment via git/ssh, and just before I was ready to give up, I found a simple tool called FTPloy. They say they are a tool to “Push changes to GitHub or Bitbucket and Deploy Changes automatically to your server.” Just what I was looking for! They use webhooks to listen in for changes to your files as you upload them to your code hosting service. I personally useGithub, but they offer both Github and Bitbucket. To setup, all you have to do is give it your FTP credentials and point the FTP Path to mirror the root of your git repository. If you’re working on a WordPress theme and are tracking only those theme files, you would have to set it to “public_html/wp-content/themes/my-theme-name” (or similar, depending on your customized setup) so it could deploy directly into the theme folder. Once your connection test passes, you are ready to go! Now all you have to do is
git push and your changes will automatically get updated.
FTPloy is not perfect, but it’s good enough for now. I’m sure there are other services like it out there. As a matter of fact I found one, but can’t remember the name (a little help maybe?). På dette tidspunkt, my only concern would be the fact that they are planning to start charging. If you’re wondering why I don’t just useBeanstalk, I simply prefer the post-commit tools on github as well as the overall interface. Beanstalk is also more expensive than Github. Happy FTPloying!