#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    11
    Rep Power
    0

    How do you manage development and production version of projects?


    For years I've had the site files setup in dreamweaver and stored locally on my computer, as I edit and change things I upload the files to my own VPS which I use for most of my development. My clients can see their site and once everything is approved I then upload (via FTP) their site to their live hosting account.

    For most of my projects, that's it, I may never work on them again after making them live.

    I have a couple that are always ongoing though, and it's a pain every few month when they need some major changes doing I have to setup a new (current) version of the site on my development server to work with. As before, I use my VPS to make changes to the site and once the client is happy, I copy the changes to the LIVE hosting account.

    The problem now is I'm trying to move from using Dreamweaver and into something like Aptana, PHPStorm or Netbeans. These have debugging and Unit testing built into them, which from what I gather runs on a server installed on your local machine.

    So my question is, in this situation, would I develop the site locally, upload to my VPS for my clients to see at incremental stages, and then finally move them to the live server once approved?

    It seems a very long winded way of doing it.

    I'm sure some are going to mention using SVN to help publish a site to development or production environments, but it's such a pain to setup in my opinion, and most of the stuff I'm doing lately is integrating HTML into my own CMS and passing this to the client. They're fairly small projects which take 1-2 days to complete and require very little ongoing maintenance. If I had a repository for every project I'd have literally hundred and hundreds of them, 90% of them would be dormant.

    How does everyone manage this? I keep hearing that FTP is so old skool theses days?
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    We use version control. SVN it old school these days, all the cool kids are using GIT.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    GIT is a lot easier to use and a lot more powerful, it's just a massive pain to learn how to use it because the commands are so cryptic they may as well be in a different language. Once you learn GIT though you will never want to go back to SVN and will find yourself cursing it every time SVN fails to perform what should have been a very simple merge.

    But seriously, version control is how you synchronize code that is stored in multiple locations. That's pretty much all there is to it.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  6. #4
  7. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    I've tried to switch to git 3 times (twice by force of management) and never got it. I used cheat sheets, I read the for dummies books, I just never found it to be better than SVN. I get merge conflicts maybe once every few months anyway. We use symfony so everything is really self-contained. Maybe that's it.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2004
    Posts
    11
    Rep Power
    0
    Originally Posted by E-Oreo
    GIT is a lot easier to use and a lot more powerful, it's just a massive pain to learn how to use it because the commands are so cryptic they may as well be in a different language. Once you learn GIT though you will never want to go back to SVN and will find yourself cursing it every time SVN fails to perform what should have been a very simple merge.

    But seriously, version control is how you synchronize code that is stored in multiple locations. That's pretty much all there is to it.
    Would you use version control for all projects? or just larger onces?

    Like I say, my main issue is many of the projects we work on are fairly small 1-2 day projects which don't really require a development and live version.
  10. #6
  11. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Why do you believe version control is linked to the distinction between dev and prod? What do you think it does?

    And what problem are you actually trying to solve? This is the problem I got from your initial post:

    You're trying to use PHPUnit, but don't know how that would work with a local server, and are wondering if version control can help.

    I have good news: PHPunit works wherever you install it, including your VPS. "localhost" doesn't necessarily mean "the computer you're sitting at." SSH into the VPS.

    You should still use version control anyway, it's just good practice, but it has nothing to do with dividing your environments or testing or anything.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  12. #7
  13. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    Like I say, my main issue is many of the projects we work on are fairly small 1-2 day projects which don't really require a development and live version.
    Hm, well the title of your thread is "How do you manage development and production version of projects?", so that's the question I answered. But actually, I would use version control for everything, there are pretty much no disadvantages to having something in version control.

    So my question is, in this situation, would I develop the site locally, upload to my VPS for my clients to see at incremental stages, and then finally move them to the live server once approved?
    Yes exactly, that is the normal workflow for web development, primarily because working locally is a lot faster than working remotely and allows you to better control your testing environment.

    With version control you could configure a hook so that after committing any changes they are automatically deployed to your VPS. Transferring changes from one system to another is extremely easy with version control even if you do it manually.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  14. #8
  15. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Yes exactly, that is the normal workflow for web development, primarily because working locally is a lot faster than working remotely and allows you to better control your testing environment.
    I never work locally, I always do all my work on a remote dev server that I share with other devs.

    However, I also mount that remote server as a drive on my computer, ssh to it at the start of my day, and set it as my home page on my browser. The latency isn't an issue, so it feels like it's local, but other people can hit it and have access to my files if need be.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  16. #9
  17. Confused badger
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2009
    Location
    West Yorkshire
    Posts
    1,112
    Rep Power
    487
    My 2c ...

    We don't have the luxury/resources for live and dev environments so the way I deal with VC is my files are named abc_v1.php so if I need to make a change to it, I copy the file to abc_v2.php, make the changes in v2 accordingly and save to the live site. In my menu, I add a few small but simple lines to check if the currently logged on user is me (e.g. with my $_SESSION['user_id']) and if it is, then instead of sending the user to abc_v1.php, I'm sent to abc_v2.php. I can add some extra clauses to the IF statement (i.e. "if the logged on user is me or if the logged on user is the person who needed the changes) so that the customer can see the changes (or if there's just the one user then I just change the include line to abc_v2.php).

    Once they're happy with the changes then I can remove the if statements and ensure that abc_v2.php is being included/referenced instead.

    abc_v1.php is then moved into a temp or 'old_files' folder where it can be moved back in case changes need to be rolled back.

    Of course, comments in the PHP files at the top of the page allow me to track version changes: for example:

    PHP Code:
    <?php
    //----------------------------------------------------------------------------------------------------------
    // Changelog
    //    v1    Original
    //    v2    Integration of flexible markup rates
    //        - Decrease col width of "Destination" from 40% to 30%
    //        - Insertion of new 10% col width field "markup rate" (default value set by previous page)
    //        - Amendment of the daily-total colspan from 3 to 4 columns
    //        - Amendment of the grand-total colspan from 3 to 4 columns
    //        - Removal of 'width' declarations for all columns outside of THEAD (they will inherit)
    //    v3    Reorganisation of "step 2"; up to and including version 2, the system would display all 
    //        the selected customer bills at once, unfortunately, when trying to submit the markup rates 
    //        to the database, the $_POST variable could not handle all of the entries and data was not 
    //        being sent sucessfully (the observed behaviour was the system would return to the 
    //        customer selection screen instead of proceeding to 'Step 3').  In this version we will 
    //        store the customer IDs in a temporary session variable and then loop through each one in 
    //        turn.  The system can also be programmed to check the DB to see if the markup rate has 
    //        already been entered and if so, use that instead of the value sent from step 1.
    //----------------------------------------------------------------------------------------------------------
    Regards
    "For if leisure and security were enjoyed by all alike, the great mass of human beings who are normally stupefied by poverty would become literate and would learn to think for themselves; and when once they had done this, they would sooner or later realise that the privileged minority had no function and they would sweep it away"
    - George Orwell, 1984
  18. #10
  19. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170

    Comments on this post

    • kicken agrees : love it
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo