Deployment automation
#1
Posted 17 February 2010 - 05:58 PM
What techniques do you guys use for deploying (or updating) your applications to external web hosts?
This is what I have always done, which pretty much sucks:
1. SVN Commit via TortoiseSVN (~6 seconds of clicking around)
2. SVN Export via TortoiseSVN (~15 seconds of clicking around)
3. Open FileZilla (3 seconds)
4. Upload exported files, with "Export if source newer" option (10 seconds)
This all adds up to a half a minute. Sometimes I do this 10 times a day. I hate doing it. I don't even take the site down usually when performing the update. Not good
It seems I could create a script to automate all of this, so all I have to do is run it and *bam* the site updates to my local copy.
I am looking for advice for the best way to set this up. I've done some googling and it seems there are a whole bunch of options, so many I don't know where to start.
What I would like:
1. Only changed or new files should be uploaded to the server, that are under version control. No need to re-upload the whole thing each time
2. Scripts to take down and up the site to run before doing maintenance (could be as simple as uploading an alternate index.php file).
What I think I need:
1. FTP software that can be run from command line (what is good?)
2. Figure out how to use version control from command line
What methods have you guys gone about? Any examples out there? It seems the script could be written in pretty much any language including php.
I am using windows. It seems that most examples on the web are directed towards linux which I really don't know much about.
I'm going to play around but I was wondering if anyone had any starting advice before I try something out which turns out to be a bad method
Thanks,
Jonah
#2
Posted 17 February 2010 - 06:04 PM
#3
Posted 17 February 2010 - 06:46 PM
Just did some googling and it seems to get it working I first need to learn how to connect to the server with SSH. So it is possible. So I'm going to do some playing around with that. You pointed me in the right direction. Thanks!
EDIT: just got putty/ssh working on dreamhost. This is cool stuff.. svn is already installed
EDIT2: OK it seems like its gonna work on my other host too. This is gonna save a lot of time
#4
Posted 23 February 2010 - 02:58 PM
we just copy the files over. To make sure noone is really browsing your site during that time you update the site,
just replace your index.php with a temporary one telling the user you are updating the sitechanges, then replace
your index.php with the new/old one.
That way you can make sure no user makes any database calls or other updates on your site that potentionally could
mess something up.
To update the database (MySQL) we usually use the synchronization tool in MySQL Workbench, if there's nothing that
potentionally could mess up data we just push the changes otherwise we would have to make some script to convert the
data/temporarily move it or whatever suits the changes.
I really recommend MySQL Workbench if you are not using it already, got all those nifty tools builtin and it's all free.
Also make sure to use the Beta version, the older ones are not as good.
Just one thing i came to think of when you said you use SVN, doesn't that mean you also have tons of .svn folders
in your production server that might actually expose PHP code to the user if you don't make sure to block users
from accessing them? Just a heads up to Jonah if you didn't think of it already
#5
Posted 23 February 2010 - 05:12 PM
I just checked if the .svn folders were accessible and luckily they are not (for whatever reason).
I use plink (command line version of putty) to deploy the application via a .bat file (one click!). I am also planing on creating .bat files to bring up and down the server for public use (by replacing index.php probably).
I hear git has a lot of improvements over svn so I hope to learn it someday when I have time..
For updating the database, I have always just done it manually on the server phpMyAdmin script. Not the cleanest method.. Whenever I made a change on my local database for testing, I would just jot down the sql that phpMyAdmin executed, then executed the same thing on the remote server phpMyAdmin once deploying. Haven't needed to convert any data yet. So I'm going to try out this MySQL Workbench and see what it's about..
#6
Posted 23 February 2010 - 05:45 PM
#7
Posted 02 March 2010 - 06:02 AM
Quote
Look at SQLyog (Webyog Softworks). 2 Powertools there: DataBase Synchronization Wizard and Schema Synchronization Tool.
#8
Posted 02 March 2010 - 12:40 PM
gonna take a look at SQLyog
#9
Posted 02 March 2010 - 12:55 PM
You guys know if there's an offline svn/git/bazaar solution (maybe a bundle with webserver or something)? Because for now I work alone but I would still like to use versioning and then later put everything online so others can access.
#10
Posted 15 March 2010 - 02:00 PM
Y!!, on 02 March 2010 - 12:55 PM, said:
You guys know if there's an offline svn/git/bazaar solution (maybe a bundle with webserver or something)? Because for now I work alone but I would still like to use versioning and then later put everything online so others can access.
Well that's the good thing about Git, it is local, you can do as many commits you wish locally before you push it to your server (if you do push it to a server).
#11
Posted 15 March 2010 - 02:02 PM
jonah, on 23 February 2010 - 05:12 PM, said:
I just checked if the .svn folders were accessible and luckily they are not (for whatever reason).
I use plink (command line version of putty) to deploy the application via a .bat file (one click!). I am also planing on creating .bat files to bring up and down the server for public use (by replacing index.php probably).
I hear git has a lot of improvements over svn so I hope to learn it someday when I have time..
For updating the database, I have always just done it manually on the server phpMyAdmin script. Not the cleanest method.. Whenever I made a change on my local database for testing, I would just jot down the sql that phpMyAdmin executed, then executed the same thing on the remote server phpMyAdmin once deploying. Haven't needed to convert any data yet. So I'm going to try out this MySQL Workbench and see what it's about..
Git is very similar to SVN in usage, it took me about 5min to learn how to use it, really
It's even simpler if you use a GUI tool for it aswell. I however prefer my terminal if i dont want to check code diffs that is.

Help













