Jump to content

Create dev environment from existing live


thisismatt

Recommended Posts

Howdy!

In a previous thread I started a while back, @brian! was good enough to touch on creating a dev environment from a live instance, but I thought I'd start a new thread so that this can stay very much on-topic, away from the previous email discusion.

My live and dev environments are in very different states; I really haven't been very good at keeping dev up with live, so any testing I have done has been almost pointless - and I want to correct that.

So, my question is - what's the best/correct/easiest/most thorough way to create a dev instance?

Then, how do you use your dev? Do you make every change in dev, test it to-death, and only then replicate that change in live? And how do you replicate that change, do you simply re-type whatever you did in dev into live, or do you do something more automated/clever?

So many questions in my head, but it's one of those 'I don't know what I don't know' scenarios, so simply don't know where to start.

Thanks in advance everyone.
Matt

Link to comment
Share on other sites

Copying the live's files to the dev's location and change the configuration.php file to use a dev database -- never dev with a production database.    Then run the installer to get the database created and setup.  Once done, setup any modules in their test modes.   I don't think copying a production database to dev is wise and so setting everything from scratch is needed.   Mirroring settings as best you can, but I suppose you could do a selective table copy and leave client specific tables in place. 

Once item is dev'd, tested, tested some more, and then deploy to production.  I use git for version control and a self hosted git repo that can be accessed by dev and production.  If you are not using version control, save yourself the hassle and use it.  Git has saved me several times and the comparing alone is worth it.   Since I use git, once the module is ready for production I will pull the module via git on the production install.  Branching and selecting the new branch may be done depending on reasons. 

Link to comment
Share on other sites

Thanks for this @steven99; I've successfully got a fully-working test instance now.

I've never used git, or any version controlling before, but I'm aware I probably should. I just "don't know what I don't know" nor where to start. Can you offer any pointers on how to get started - specifically for customising WHMCS and using git/etc to push these changes live?

Thanks
Matt

Link to comment
Share on other sites

Take a clean install of WHMCS and place it on a dev.example.com where example.com is your real domain and ensure you block public access.  Or if you have a dev environment setup for PHP locally, set it up there.   Deploying a module to whmcs can be done in two methods and depends on how WHMCS is setup - locally or remotely.  For locally, you could just setup the module folder within the install and setup git within that folder.  For remotely setup dev of WHMCS, the method I use is pushing to remote git repo and then cloning the repo in the addons / servers folders.  Then when needed, I'll do a git pull using SSH within that module's folder.   Plesk has a git support built-in with git repo hosting and will use that for now.   But a git repo hosting can be setup on a VPS and isn't to hard if you know Linux and apache or nginx.  Or you can simply use FTP and upload the files but it makes it harder to track the files on the server then -- are you sure you uploaded that one file?  Git ensures it and if a file is different, it wont pull changes down and will complain.

I use phpStorm and it handles most of the git actions.   If your IDE has git support, great.  If not, total bummer and you'll need to do commits, pushes, etc from command line.   I would suggest using an IDE that has built-in git support as it just makes it so much easier.   

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated