Hello
I am not super experienced with PHP and large projects using it, most of my tinkering around has been in Rails with EngineYard (life seemed simpler back then). But in PHP, I haven't found anything that comes really well integrated with GitHub right out of the box. So I am looking for an easy solution to deployment for now and hopefully setting the stage for continuous integration in the future when I get around to writing the tests and such.
Here's what I have so far:
GitHub repo with my codebase
Alpha version of the app in CodeIgniter in PHP
Run of the mill webhost account with Site5 for staging/development
Currently, I deploy by uploading the latest batch of code via FTP onto my site.
For one, I would like to get to a one-step deployment process. Just a simple git push would do the trick. Is Phing overkill for now?
What are the steps you might recommend as best practices?
Thank you.
I recommend creating deploy script(s), especially at the beginning. It's a lot easier to start working on them since there are not that many things to do. Not to mention running a single deploy command is easier than doing all the steps manually. Even for small projects. Projects tend to complicate the deployment with time.
If it helps, we are currently using ANT (well, switching), we have dropped Phing due to not being developed/maintained anymore.
I use Beanstalk, and they have great deployment methods available. Once you commit, you can set up auto deployment settings, with a simple click.
Related
I need to know which are my options when deploying codeigniter/laravel apps.
I develop locally all the time at my home and when i go to work i need some quick way to push all the changes to the server.
Application code needs to be updated, database schemas need to be migrated, and application servers must be restarted.
I do all of this manually wasting a lot of time and i need some automated way kinda like capistrano in Rails environment.
What are my options here ??
Update:
I got my own server machine, and everything needs to work on an intranet environment without internet connection.
I've used the following:
Salt - http://www.saltstack.org/
Worked well, a bit fiddly to setup. Super fast deployment. Lots of control. Less learning overhead that Puppet & Chef, has some level of native MySQL tools.
GitHub
Requires a internet connection to/from your machine - one where, at some level, the end point as write permissions to interactive scripts.... Works, but makes me nervous. Pulls are better than pushes, and it's better than most other solutions.
Custom shell scripting
Yeah - this is the most common, just tar up the entire CI dir once it's been validated on staging and push out using Salt...
Scalextreme
We've been looking at this for a few months - the interface is from the 1990's, but it's got really nice functionality, including system-independent script library that you can target at any machine.
Turnkey Linux
The hammer - this will migrate an entire system image from a desktop to EC2 is something like 5 minutes. Works great and you can also move stuff between VM systems. In the end, I think that updating AMI's on EC2 is so easy that this might be one of the answers...
Nothing has truly been satisfactory and DB schema changes are a huge pain. So much so that for client configs, we're moving from MySQL to Cassandra, which is basically schemaless. CI installer is interesting, but I'm not sure how it handles updates.
I recently came across this CodeIgniter Installer on GitHub. I've played around with it a few times and it works like a charm for me.
It's as simple as putting it in your root directory (alongside your system folder), generating a MySQL dump, and editing a few files. Full instructions are here
I hope it works for you as well as it did for me.
I found this Laravel Installer on Github which might be useful. (First I came across this question after searching for Laravel installer in Google, then searched Github for Laravel Installer)
We're considering using a CI server soon.
From my reading, I've found that Sismo and Hudson were available for PHP project.
Considering that we're actually using GIT and PHPUnit, what are the big difference between Hudson and Sismo that we should know in order to make the best choice for our situation ?
Thanks
The language match is not key in your hunt for the best CI server; it's all the features around:
source control
concurrent build
trigger build
notification
Even for simple project, Jenkins (the new name for Hudson) is easy to use and quick to install. Then it is really easy to scale Jenkins up by adding more nodes (satellite machine that can execute build) when you need to. Also Jenkins has hundreds of plugin for numerous task.
Have a look at Bamboo, Jenkins, TeamCity, and CruiseControl Features to compare some of the features of the big names (you might actually want to consider Bamboo, TeamCity or Cruise Control over Jenkins)
I would lean towards Sismo since it matches the language of the project you are developing (PHP) and can be ran from just a single PHP and config file. Then you don't have to deal with having a java environment just for Hudson.
There is a really good php-integration for Jenkins by the phpunit inventor Sebastian Bergmann. You should really have a look at it.
As far as I see the biggest downside of Sismo is, that is not a "real" CI server, but more a build-and-report-environment, because you need to trigger the builds yourself (or let something trigger it).
I'll preface this by saying that I haven't used sismo.
We use Hudson with applications being built & tested in both Java and PHP. It has a nice plugin system, and getting it up and running on a centOS box took about 15 minutes yesterday. (We had to move it from one box to another).
For PHP Hudson integrates with both PHPUnit and Selenium so we run both unit tests and functional tests against the same codebase. Hudson has a great 'one-click' plugin system that really lets you customize your installation.
One thing we had to get a plugin for was sending an email on every build whether successful or not. Hudson by default will only email when your build goes from good (tests pass) to bad, from bad to good, or repeatedly bad. This means it will not send an email for every build if 2 builds in a row were successful. The email plugin solves this but it was confusing to uncover that.
I'm deveoping a big project, I have the dev folder (connected to a specific subdomain) then the "real" folder, the live one. When I'm ready to push patches or whole new versions I'm currently copying the files individually, is there a program that can help me do this task?
Keep in mind that some files (the config one and the htacess) and folders (the dev ones) do not need to be copied in the live version.
Thank you
Yes: subversion (or any other version control system) will allow you to push changes painlessly.
A simplicistic solution would be to have one checkout where you develop and you commit to, and another checkout which is the deployment. When you are ready, you go to the deployment directory, and do a svn up, to sync it. It won't overwrite modified or excluded files.
There are build packages like Capistrano and Phing which can help with more complicated deployments. Capistrano is Ruby-based, so it is a more natual choice for RoR applications, and Phing (being PHP-based) can be a little more convenient for PHP-based projects. In my experience, Phing seems less mature than Capistrano, but is a little more flexible because it doesn't assume you are working with a Ruby project like Capistrano seems to do. That's entirely opinion of course.
Both tend to take more thought and work to configure up front, but once you've designed the deploy script, you can run a single command and have everything happen for you while you watch. Both tools can integrate with source control like SVN, and bring copies of your project out of the repository for you. You can also break your deployment out into sub-parts, like a traditional Makefile, which helps with testing and reuse. If you want the process you go through for your releases to be bulletproof and consistent, you need to use a tool that will manage all the steps involved for you so you remove the human-error component.
What would be a good tool-for-the-job to do automated deployments of LAMP-based applications(MySQL, PHP, Zend Framework) to integration and staging environments?
I am looking specifically for tools that handle deployes to remote hosts. I assume building tools such as phing and ant I assume could be used for that, but I was wondering if there is something better for this case.
For integration, especially for continuous integration, I like phpUnderControl (which is a tool for PHP projects, but is itself based on CruiseControl, which is quite know in the JAVA World) : it deals with :
fetching the last revision from SVN
launching the automated tests (PHPUnit)
php_CodeSniffer
Generation of the PHP Documentation (phpDocumentor)
and provides a nice interface for users to see the results of each build.
And, to begin, here's an article that explains how to set phpUnderControl up : Getting started with phpUnderControl
(Each time I, or some colleagues, have installed phpuc, we did almost as explained in that article, from what I remember)
For staging, I generally go with a couple of phing tasks to build a tar.gz archive, that I deploy to the staging server once in a while, using another phing task to un-tar the archive, and create the required symlinks (or stuff like that).
The idea being that Continuous Integration happens all the time, and has to be fully automatic, while deploying to staging is done only one in a while (once per week, for instance), and can be done semi-automatically.
Configure a build server, something like CruiseControl is excellent for this and roll your own custom Nant scripts if needed or use Exec tasks to take care of the deployment.
For these things like specific deployments each with their configuration issues and intricacies, there is hardly ever something out-of-the-box.
Look at it this way, rolling your own scripts and batch files definitely means you know all about the steps and can configure and modify it anyway you like, rather than some magic fairy dust going on, and when things break - having no idea where to fix it.
What's the ideal way of deploying CodeIgniter projects (or any PHP projects for that matter) from your local machines to the live site? I've been using subversion for checking out and updating the code from live sites for quite some time now. But there are others who say that this practice is not good since you do not need the svn metadata in the live site. I've also read a couple of articles where they use Capitrano to deploy PHP projects. What's your practice in PHP project deployment?
I use Phing for all my building needs.
I've created several tasks like, prod, staging, debug. When i want to push all data to my production server, i just use phing prod. This will checkout all code from my repo, do some config changes, run all static files like css and javascript through a minifier etc.
More info on Phing here:
Phing.info
http://www.slideshare.net/hozn/phing-building-with-php
I asked a similar question and a lot of people seemed to like Phing:
What is your preferred php deployment strategy?
I took a look at it and the config files were pretty intimidating. I'm interested to hear more on this subject.