docmattman Posted March 13, 2009 Share Posted March 13, 2009 I've been working on a project for another couple for a while now. Currently, they have a testing server and a "live" server. They like to see the progress as it's made, so I work with PHP files directly on the testing server via FTP. Also, they run a Mac server and some of the code is Mac specific, so I wouldn't be able to run/test a local version of the code and then incrementally apply it to the test site. This has been working out fine so far, but they recently hired another developer. So now I would like to setup some sort of SVN system. I actually got SVN installed on the server and working, but I need advice as to how to go about this. Ideally, I'd like to keep using FTP to build the PHP app on the test server, however, I don't know how this would be done with an SVN system. It seems like with SVN, I'd have to do all my coding locally, then commit changes in waves to the test site for review. If this is how it has to be done, I can try to run the system locally and update it in waves with SVN. But how folder permissions work in this case? In this particular PHP app, some folders need to be writable. So when changes are committed, or when checking out through SVN, do the folder permissions need to be manually set? One other thing is that the SVN is installed on the server, but I'd like the test site to automatically update itself to the latest revision of code, rather than manually updating it everytime I make changes (which is quite a lot). Is there a way to do this? Can someone give me some advice on the best way to go about this. I have all the tools I need, but I don't know the best way to use them. Any suggestions would be appreciated. Thanks! ??? Quote Link to comment Share on other sites More sharing options...
rhodesa Posted March 13, 2009 Share Posted March 13, 2009 Oh man...where to begin. I run a VERY similar setup. I have 3 different stages: Local Dev Environment - Locally, on my development system, I run Windows with a basic Apache/PHP/MySQL setup. When working on a project, I create a new folder in my SVN repository (which is on a server described later) and checkout that folder. I develop in that folder, and check in anything I want for testing. Test Server - This is a Mac I have in my house. I have Apache/PHP/MySQL installed as well as Subversion running with Apache Module. So, access to the subversion server is through http://servername/svn/repoName/projectName/. This way, all files checked in are created by the web process. Then, I have a folder on the server where I checked out main repository. Running an SVN UPDATE on this folder will pull down the latest HEAD for every project in that repository. Once I had this setup, I added a post-commit hook to the repository to automatically run the SVN UPDATE for me. Finally, I edited my apache conf to alias /projects on the webserver to point to this directory and blocked all access to the .svn folders. That means when I go to http://servername/projects it will always be the latest checked in code. Production - Finally, I have a Production server with a hosting company that runs Linux. All information that is here I manually updated by me via FTP. So, once I get to a 'release' that has been thoroughly tested, I will export the project, and upload it via FTP. When it comes to MySQL databases, the production server always has it's own (obviously) and the test server always has one too. Sometimes my local environment will just connect to the test server's db directly, sometimes I will have a local version of the DB....depends on the project. Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted March 13, 2009 Share Posted March 13, 2009 You can write an SVN post-hook script to update the version on the staging server. It's even simpler if the Subversion server is on that server as well. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.