Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How do I make a test instance of an existing working Q&A site, database included?

+3 votes
154 views
asked Mar 3, 2017 in Q2A Core by Nip351
I wanted to make a test instance to try new plugins, DB changes as well as code changes.  However, doing this on the production environment is far worse than saying "He who shall remain anonymous" name.

I'd assume I can...
1.  Copy my QA folder, rename it
2.  Export the DB, import it as a new name.  
3.  Create a new (unique) user via SQL
4.  Edit my TEST instance qa-config.php to reflect the new DB and user
5.  (Extra) replace logo.jpg in root with my picture to keep others scared off. (and to see ensure I'm in the correct instance)

Is there anything else I may be missing?  It will be on the same domain, unique subfolders.

One thing I thought of when getting this far down, is how do I change the directory (Admin -->  General  --> Preferred Site URL) of the new QA instance without being able to access it, a SQL statement?  Or will just launching it from its location work?

I'd like to try this tonight, or tomorrow at the latest.

Thanks!
Q2A version: 1.7.4

2 Answers

+3 votes
answered Mar 3, 2017 by pupi1985
selected Mar 6, 2017 by Nip351
 
Best answer

Obviously, don't go for the production environment. But I'm not sure why should that be on the cloud. I mean, if the idea is to try DB and code changes then I'd rather have a local development environment. Anyway, it is just a matter of taste I guess.

The process you mention seems relatively OK to me, assuming you're not using any fancy users integration and using the default Q2A-managed users:

  • Step 1 seems OK. Bear in mind you won't be using a clean v1.7.4 but rather the one you were already using (if you have installed any plugin or made any core hack it will be there too).
  • Step 2 seems also OK. Just a backup and restore should be fine.
  • Step 3 seems unnecessary to me. You already have a productive site and a backup of that. You should be full of users and posts. If you want to start from scratch then this step is unnecessary (because the first user can be created as in the normal installation process) and also step 2 would be unnecessary.
  • Step 4 seems OK. However, bear in mind you not only need to change the DB data but also any other configuration that you have made. Note you could have (directory) paths configured in that file pointing to the same location now. If that is the case, after you change them you'll also have to create them.

Or will just launching it from its location work?

It should work. The preferred site URL is only used for generating absolute URLs in Q2A. Nothing else. So most of the site will work even if that is not configured. Note, however, that some plugins actually use that setting for generating their URLs, which is inappropriate so those will surely point to your older instance.

commented Mar 6, 2017 by Nip351
We are a super small site.  We simply run it locally, to the super-novice users, it's a web page... they can access and for all intended purposes.  With users, I mean three.  Not to mention there is only a single machine on site.

Overall anyone might perform any procedure/process, so instead of everyone taking notes or explaining the same steps, I thought I'd just document it in Q&A.  

I wanted to try "things" and didn't want to break this, so I setup a test instance on a Raspberry Pi, to which I successfully completed over the weekend without any issues.  There are a couple of plugins, Email Formatting and Donut Theme.

I just wanted to mention that since I copied prod (qa folder) to test, it was a true copy, so no changes were made or had to be made (referring to Step 4 comment).  Also, it did launch immediately after DB import with no changes to the preferred URL as that makes sense as explained.

From previous experiences a major visualization change form test to prod, such as a logo or color scheme was part of the process to show an visual change of instances.  I don't want to mention names because I like Paul, but someone might install a database over a production database over a taking the system down for hours...just saying. Paul now favors colors.

Thanks a ton for your reply, I really appreciate your input.
+2 votes
answered Mar 3, 2017 by ProThoughts
I did this many time.....as pupi1985 mentioned, I follow all those things.

There is one more easy way, I do run sites on dedicated server so I just make a copy of server and then do my experiment. This way you will save lot of time.
...