pure web based versioning system - php

My hosting service does not currently run/allow svn, git, cvs on their server. I would really like to be able to 'sync' my current source on my development machine with my production server.
I am looking for a pure php/python/ruby version control system (not just a client for a version control system) that does not require any services running on the server machine, something that could use the http interface to upload/download and sync files - basically offering a back end into my 'live' site for version control.
Additionally, I would think that such a system would be easy to develop an 'online' ide for, so that I could develop directly on the production server. (issues of testing aside of course)
Does anyone know if such a system exists?
==Edit==
Really, I want a wiki front end for a version control / development system - Basically look like a wiki and edit development files so that I could easily make and roll back changes via the web. I doubt this exists, but it would be easy to extend an existing php port of svn...

Get a better hosting service. Seriously. Even if you found something that worked in PHP/Ruby/Perl/Whatever, it would still be a sub-par solution. It most likely wouldn't integrate with any IDE you have, and wouldn't have a good tool set available for working with it. It would be really clunky to do correctly.
The other option is to get a free SVN host, or host SVN on your own machine, and then just push updates from your SVN host to your web site via ftp.

Don't host your repository on your web server. Deploy from your server to the ftp/sftp - whatever.

You could look into mercurial or bazaar-ng they are both written in python and support at least http downloads afaik, not really web based but written in one of the languages your hoster supports if the tags are correct. HTH

Mercurial has a web-interface and allows commits via http. It uses a couple of C extensions, but I would guess that all of them have pure-Python counterparts.
You can also just use WebDAV, when your hoster provides it.

I think it's actually a pretty good idea, but don't believe such a versioning system exists (yet) so hopefully you'll go ahead and make one.
I don't think adapting an existing solution is going to be easy, but it's probably worth looking into because if you use an existing solution you'll have all the client support done, and most of the versioning difficulties taken care of.
Starting from scratch is not going to be trivial.
-Adam

Use Bazaar:
Lightweight. No dedicated server with Bazaar installed is needed, just FTP access to a web server. A smart server is available for those requiring additional performance or security but it is not required in many cases - Bazaar 1.x over plain http performs well.

you could try the reverse way
use e.g. a free online svn/git Service to version control the sources on your dev machine
use usual ways to update the "production" machine aka site, like FTP

Why dont you want a client..? A simple client that you can run on your production machine which then syncs to your repository running on another server somewhere.
SVN is available over HTTP so writing a client that is able to sync your code is really easy in python or php.

Related

Making php development more robust

I've spent some time now developing a web application in php. It has mostly been just for the fun of learning as a side project, but the app now has a few users which I don't want to upset by breaking things as I develop.
At the moment, I have a very rudimentary method for managing the development - I use a text editor (ultraedit) to write the code and use its built in ftp to upload the files to the server. In terms of version control I have 2 domains, and only push files to the "live" domain when they work, but that's it. The domains are hosted on a cPanel shared hosting site which I have some doubts about its ability to handle even minor spikes in traffic. I looked at slicehost yesterday for something more scalable but that looks like a bit of a learning curve from where I am now.
I know I could do better than this, but where to start? I think I need advice on three things
1 - code writing tool
2 - version control / management
3 - scalable hosting
I've deliberately asked these in the same question as I'd like to know if one choice impacts another. Is there a good integrated solution?
Thanks in advance as ever.
Each part of your question has been answered before. The list below lists some of the common tools to use and links to appropriate searches on StackOverflow. There is no all in one package and going into details about these tools in one question is out of scope, so I am afraid you have to do some digging:
SVN, Git or Mercurial
UnitTesting (PHPUnit or SimpleTest)
Continuous Integration
Phing (for deployment)
phpqatools.org
Netbeans or Eclipse (for an IDE)
Disclaimer: list is not meant to be complete and order is not important
There is a lot going on here. I'll give you my two cents though.
I used to use ultra edit. Now I use netbeans, its a fully integrated development environment and it makes my life soooo much easier. Its free too. I can't imagine ever going back to UltraEdit. Also, which brings me to number two, netbeans has SVN and CVS integration
I would use subversion for version control. In my experience it does everything you need for version control. Others use ones like git and mercurial, but I think SVN is widely supported and easy enough to set up. As far as pushing code to the server, i've begun using svn for this too. I first ssh into the server and checkout the code into the public_html directory, and then set up an alias to do svn updates through the command line... its way easier than ftping in my opinion. There are other deployment methods, but i've never used them. see this question:
What is your preferred php deployment strategy?
obviously shared hosting is not going to handle traffic as well as a dedicated server. But there are lots of things you can do to improve performance before moving to a dedicated server. Check out this article: http://developer.yahoo.com/performance/rules.html
It seems that you're after a robust deployment strategy as opposed to a development one. But, correct me if I'm wrong.
In terms of 'code writing tool', and
IDE choice is a subjective
discussion. Feel free to work with
the one you are most comfortable
with, for me this is Netbeans.
As for a deployment strategy, I think it was best summed up in this answer.
Your point about scalable hosting is fairly broad. We will need much better forcasted metrics to give better advice. However, for now, if scalable hosting is a worry then maybe look into some sort of Cloud Hosting.
Have you looked at using wamp/xamp/mamp/lamp for development locally? Uploading via ftp for every change is a pain.
You could do that for local and see that everything works, then push it to your test domain and run through it again and then finally push live.
Might want to look at something like SpringLoops for doing your version control - this has the advantage of doing the deploy and then if it goes pear shaped you can revert it (free account gets 3 deploys a day).
I wouldn't worry about scaleable hosting just now, just focus on the site and the coding, you've only got a few users - wait till it starts becoming a problem before moving (however, I suggest looking into options) but don't try and get all cloud ready - might not ever be a problem.
ps, go with Linode over Slicehost.
I think use Aptana Studio ( http://www.aptana.org ). It is an Eclipse based IDE with all the tools you need integrated in it. It has integrated PHP development tools, GIT or SVN for version control.
I've used shared hosting as well. Once an other site on the same server had DoS atacks and my site became unreachable as well. Otherwise it could work in reasonable speed after some optimization. It served 1000-3000 users per day.
Dedicated servers are much better. Or you can use Amazon web services. I know they are more expensive.
1 - code writing tool
Zend Studio. I would recommend Linux as well if you are going to use linux servers.
2 - version control / management
SVN + phing (if you are going to build serious applications).
3 - scalable hosting
Amazon or RackSpace.
For your editor, just use what you are comfortable and productive with. You most definitely should have version control in place. You never know when you need to rollback a version or two.
I always keep at least 3 versions on the production server. I use symlinks to point the web server at the latest version. If there is a problem, you just need to recreate the symlink to point to an older version.
As for shared hosting, you'd be surprised out how much bandwidth you can get. I have a $10/month shared host that gets about 500K page views a month. Generally, it's not that your shared host can't handle the load, it's that the hosting provider puts too many "shares" on the same server. So it depends on how much resources everyone else on the same server is using. If you are having issues, you can always ask to be moved to a different server.

Run Apache / PHP / MySQL (CakePHP) application on a USB stick?

I have an existing CakePHP that runs on a LAMP environment and need to install it on a USB drive for mass public distribution.
There are a few requirements:
Protect the source code
No installation required
Windows support essential
MAC & Linux would be a bonus
Must run offline, without Internet connection
Ability to sync with server for data transfer and updates
I have conducted a large amount of research into the options and am keen to learn what other developers think.
Potential solutions:
- Flash / XML
- Adobe AIR app
- USB webserver (Server2Go, Portable Apps XAMPP)
Has anyone used any of the above, any comments would be greatly appreciated.
Thanks
Similar thread here :
Portable USB Webserver
If you ask me, XAMPP should do, because it offers a "plain unzip" version. There's lots of variety out there - Bitnami also offers a nice bunch of stacks, although they may not be good for this particular task.
To keep the same scripts in both Windows and Linux, you could consider using UnxUtils which is a port of all common Linux commands. This will be very handy if you are good at Linux bash shell scripting but not good at Windows batch files.
Protecting the source code is a bit troublesome. Do you really, really need to do so? Because there's a ton of great open source code out there which already does practically everything in most common business domains - sourceforge.net.
And if someone's taking your code and calling it their own, you can just name them on the internet if you can prove it. That itself will be bad publicity for them. That said, I obviously don't know your specific need. So that is just my opinion.
You will have problems with this, no matter how you go about it. Each step is a little more unusual it seems.
You'll need to use a source code obfuscator to protect your source. I recommend the one by Zend, not from experience, but because Zend makes awesome products. Never used a source protector myself.
You'll need three custom LAMP/MAMP/XAMP installs, one for each target OS. They should point to a directory that is shared on the USB drive. Make sure you configure them to use an unprotected port, otherwise the user will need admin privileges to run the server software. And getting the server stuff up and running will likely result in a few hiccups as well.
I would actually recommend finding something that will allow you to distribute a binary, or something like an AIR app that is intended for this type of distribution. You may have to rewrite lots of code, but it'll be easier to fix than all the niggling little install errors you'll see on the client end. To package scripts into binaries without rewriting stuff, check out http://www.scriptol.com/apollo.php and similar products.
But I'd suggest you make a standalone app in adobe air that will sync with your server (maybe even some google gears integration, to have it function offline). Don't try to force a PHP app into this distribution model, it'll create nightmarish problems.
This is what I used to run a CakePHP app from a DVD. Worked on USB too (while I was still developing it).
http://www.server2go-web.de/
Server2Go is a Webserver that runs out of the box without any installation and on write protected media. This means that web applications based on Server2Go can be used directly from cdrom, a usb stick or from any folder on a hard disk without the hassle of configuring Apache, PHP or MySQL.
Server2Go allows you to create a standalone working web site or PHP application on a CD-ROM.
It's really nice.
You can use MAMP for Mac, you'll just need to edit the config to properly point the sites directory.
however you would have the problem that the mysql db would not necessarily work with windows. if you switched the db to sqlite, you could sync the sqlite db file fairly easily.
XAMPP would work for the windows side
sorry dont know about the linux side.
Out there is a CakePHP InstaWeb Server
http://bakery.cakephp.org/articles/view/the-cakephp-instaweb-webserver
that runs on python and doesn't need an installation. This plus some additional goodies should get you already half the way.

Where can I find a good VCS written in PHP?

I have a web server which can run PHP and Ruby.
I would like to know if there is a PHP program which can do version control of my code similar to SVN?
I know there are already open source project hosting sites which provide this service already but I would like it to be installed on my own host.
I don't have the access to this server to install additional packages either
I'm not aware of any version-control system written in PHP. But even if there were one, I'd stay away from it. Version control isn't one of the things a scripting language is best used for.
Edit: I suggest installing Subversion on your local machine and develop all the code there, that way the SVN on your local computer can be used for version-control.
Edit 2: If you are collaborating with others and want them to have access to your repositry, I suggest getting subversion hosting somewhere for your project. There are some free hosts out there that support it, just google it and you should find some results.
For the same reasons - want to store the data on my own web site, which only supports PHP - I've created phpEasyVCS. It offers a web interface and WebDAV access.
http://sourceforge.net/projects/asvcs/ - Haven't tried this. But this sounds like what you are after.
For what I know WEBSVN is just a way to view your SVN repository
Regards
Why on earth would you care about the language of a tool that you use? That's like complaining that the builder of your house used a wooden ladder instead of a metal one.
Use Subversion or Git or anything you want, they'll all work fine.
Just use an online service such as http://unfuddle.com/ or http://cvsdude.com/
They have free basic plans and even their paid plans are cheap enough to make it worth it.
If you need VCS somewhere that is not your computer and the production site is not under your control either, I would agree with nandos that you should use online service.
Then in order to put changes in production you could make PHP script on production site that accesses the online service and downloads the newest version via HTTP (http should be generally available with CVS, and SVN uses it natively) rather than using specific VCS protocols.
You will have limited options, but that's not what generally is expected to be controlled from production anyway.
Ok I think nobody has really answered to my question.
I said that I don't want any hosting facilities like http://en.wikipedia.org/wiki/Comparison_of_free_software_hosting_facilities.
So I think I will use http://websvn.tigris.org/
Thanks.
Guillaume
Why must the VCS be written in PHP? You could use SVN as the VCS and serve the files using apache. I can't think of a single benefit of wrestling with yet another version control system. What you could do is get a virtual machine appliance for source code control and issue management like vmTrac and either run it directly or pick it apart and figure out how it was put together
I know this is old, but for reference, since you have FTP access, you could use Bazaar over FTP, and use something like Redmine as a webviewer. Using FTP would be slower than installing the Bazaar smart server on the server (FTP is known as a "dumb" transport), but it would meet all your requirements.
Hope that helps someone
-Scott

How to wean myself from FTP in favor of Version Control

I have heard that uploading your website with FTP is now for n00bs, but it's the only way I've known how for the 8 or so years I've been building websites. Apparently all the buzz now is using a version control system, like SVN or Git, and somehow using SSH to upload only the files that have changed (if I understand correctly). I'm wondering if someone could explain or point me to a "comprehensive" guide. What do I need to install, and will my shared host (Dreamhost) be compatible? I currently develop on a WAMP environment. I have never used version control and wouldn't know where to start. I usually develop with a framework such as CakePHP or Zend.
You've got things mixed up a bit. A version control system is used internally to keep track of your code during development. With centralized systems like SVN, you regularly upload your code to a SVN server, which keeps track of what has changed, makes sure conflicting changes are merged correctly, and keeps a history so you can roll back changes.
Decentralized or distributed version control systems eliminate the one central server, instead allowing every single copy of the code to track its own change history, and then letting you merge and combine these separate branches at will.
But once you have a complete product, you push it out to the production server any way you like. FTP is certainly one option for doing that.
For the file uploads, what you are looking for is rsync. There is a Windows wrapper for this called DeltaCopy and the DreamHost wiki has instructions.
First you'll want to decide what you want to use for version control. I hear great things about Git, but am still an SVN user myself.
Dreamhost actually lets you create SVN repositories with their webpanel, very keen there and I can't remember but I thought they had some additional really nice features to help.
I would suggest reading or skimming through at best: http://www.svnbook.org it is very comprehensive if you plan to actually use SVN over Git.
Everyone is completely missing the point. Development using a version control system is a great thing and has massive upside even for developers working on their own. The question here is about deployment using version control systems.
This is a newer and great idea, consider something like Magento which has 6,744 files in the base install, not mentioning when you start adding your own skins which usally run to around 500 files. Using version control to DEPLOY something like this saves major time uploading this many tiny files via FTP as only the modified ones are sent.
Asside from this, I've never actually tried deploying like this so I can't offer any real world experience, however there are several good articles on how to get this setup, a good one can be seen here.
Here's an wiki that should give you all the information you need on adding Subversion to Dreamhost.
http://wiki.dreamhost.com/index.php/Subversion
I've used Subversion now for my sites, and it does make it much easier. I use Aptana on my Windows machine and upload everything through that program. It allows me to compare old versions, revert to them, branch off new versions, etc...
It's a huge timesaver!
Eric Sink's articles about source control are a great place to learn about the basic concepts.
http://www.ericsink.com/scm/source_control.html
I also develop with Zend Framework and here is how I use FTP and Version control.
On my local machine I have Subversion and TortoiseSVN installed.
If I start a new project, I set up an SVN repository the way I like it (I use the trunk/branches/tags system).
I checkout an initial working copy from the trunk to a project folder in my local webroot.
I create a new project in Aptana and set the project path to my project folder on the localhost.
Aptana understands that this project is versioned and shows appropriate icons on each file. I can do many of the version control functions directly in my file tree in Aptana, no need for any shell or even Tortoise.
Once I have a stable, deployable version of my app, I create a version control tag. Then I do an export of that (unversioning it).
The exported app is then uploaded via FTP.
That's how I do it at the moment anyways, maybe it clarifies somethings. Tips on improving the procedure are welcome!
As others have said, you can set up version control locally ... or on your host. I recommend you do whatever works best for you.
You mention using Dreamhost. I support one small site there, and know that they do allow uploading via scp and sftp. This would allow you to upload your files with your password encrypted. (And you don't have to adopt a version control method if you don't want to! ;-) Scroll down the sftp page I linked to and you'll find some suggestions for scp & sftp clients.
FWIW, if you're using Windows, I've used WinSCP for years and liked it. Also, if you want full login access, I suggest PuTTY; its full download also includes command line based clients for sftp and scp.
There is no problem using ftp to upload. The only disadvantage is that the password is transferred as plain text.
It would be good to have a local version control system, that would allow you to easily see changes between versions, and quickly revert to an older version, and much more...
I don't think there is a need to install a version control system on your shared host. Only if you want to access the version control system from different sites (at home, at work, while traveling), it can be handy.
There is an awesome plugin for bzr called bzr-upload, designed exactly for your kind of use-case. bzr is very light-weight (no need to set up any repository) and super easy to start using, even if you haven't used any kind of source control before. It's a plugin for bzr and every time you make a commit on your local machine, it will s/ftp the changed files up to your web host. It doesn't push up all the version control info, just the files themselves.

Development and production environment in PHP

I would like to setup two environments for my new website written in PHP. One - to develop new versions and test them. And second production where my actual stable version of website will be available.
Website in PHP will consist of many PHP and other files (JS, images, and so on). So I think how to prepare this environment in best way to make it easy to do source control, fast copy website from development environment to production environment and to make development version available for people on the web so they will be able to see actual work progress and suggest changes or report bugs.
Could you please give me some advice where to go from this starting point? Are there books about this (from practical point of view?) or do you have experience or tips what to watch out and what is important to make this process easy and good for me and other people involved in developing new project?
For starters use the following three:
SVN - this will give you source control and allow you to track changes. You may want to get GUIs on top of this (Tortoise is a popular one) to ease the learning curve.
RSYNC - this will allow you to streamline your syncing between local and remote site with a single command. RSYNC uses a diff engine to sync which means that incremental syncs happen in a matter of seconds. During intense programming, I will sometimes sync 4-5 times in one hour pushing out little changes real fast just because I can so easily.
MySQLDump - This will allow you to import/export data from your production site. I usually do this once a week to get production data on my local servers which not only gives me a local backup but also lets me toy around with production data on a local test environment.
Those three alone will save you a lot of time in the long run and allow you to scale. Later on you can look into an automated build tools, unit testing frameworks, xml documentation framework and the like to build some serious products.
I work with a setup like this, so I can give you some tips on how to do this. I've been doing this for a while now, working out the kinks here and there, and feel like this is a setup I can honestly say is pretty darn productive.
Small note: I work on OSX, so the specific applications used might be a bit different from you if you're a linux/windows user.
I run a production 'server' on my Mac, using MAMP (www.mamp.info) to easily supply me with an Apache server with PHP and MySQL. You could use a similar tool such as XAMPP or install everything manually, it's really up to you.
Then I have my live servers, where my websites and customer websites are hosted. For each new website project (let's take abc.com as an example) I create a subdomain called staging.abc.com, on which I do my testing. It's always a good thing to test things on the exact same hard- and software before actually going live.
I use Subversion (or in short, SVN) for my versioning needs, with the added bonus that I can easily add 'hooks' to automatically update my online production server whenever I send my newly updated version to the SVN server. SVN also allows you to easily work with more than one person on the same project. For more information on SVN and how to use it, I suggest the great (and free) online book found here: http://svnbook.red-bean.com/
So in short: I work locally with MAMP providing me with a local 'working' server. After that, I test online on a staging.abc.com location to see if everything works well, and to possibly allow others to see the project (in case you want your client to see what's going on, for example), and after that I actually publish the project by putting it on the actual domain.
There are many more things that can be done to optimize your workflow, but this should get you started.
Hope this helps!
-Dave
I prefer to have development occur on the developers local box if possible. If other developers are involved, you probably want to setup your version control such that both the database schema, javascript, css, and the php code can be checked out and setup on a developer's personal box pretty easily (assuming they have the correct LAMP/WAMP setup)
I've also seen it where people maintain a test website on a server where active development occurs. I would avoid this for active development, but use this for black-box testing of the latest checked in code (the latest build).
Once your test website checks out, then its a matter of exporting the code from your version control to the location the live website is. With svn, you can really just do an update of the live code with svn update specifying a revision or tag that indicates the current live version.
I would further recommend keeping some settings, like db access/username/pass, in a separate included file that is not version controlled. Keep this elsewhere, let developers plug in the access rights to their local database on their PC. On your server, plug in everything you need to access the database there. This should be really trivial code (defining a few variables) so not having it version controlled shouldn't be a big deal. If you like, you could version control a templated version, but I wouldn't put the real database info into version control.
Here is a pretty good starting place if you want to use MAMP or WAMP to develop locally and then push that to github and then update your live site from github:
http://www.mybringback.com/bringers/14509/git-local-and-shared-server-development-environment-with-ssh-setup/
Hope that helps.

Categories