HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


How to clone your ocPortal site

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#72937 (In Topic #15285)
Avatar

Community saint

I've had several request to provide info on how I cloned my site on the same server and use the clone for testing, so here it is.

While the steps may seem a bit long-winded and fiddly, they should be straight forward enough. Please read the instruction completely first as you will need place your specific details in place of the following place holders:

   MAIN_DB_USERNAME
   MAIN_DB_NAME
   MAIN_DB_PASSWORD
   MAIN_SITE_DIR      ←The director where you installed your main site

   CLONE_DB_USERNAME
   CLONE_DB_NAME
   CLONE_DB_PASSWORD
   CLONE_SITE_DIR      ←The director where you installed your clone site
   CLONE_SITE_DIR_OLD

STEP 1: Install a fresh copy of ocPortal. This will be your clone site. If you already have another ocPortal site installed that you want to re-use and make your clone site then ignore this step.

STEP 2: Use the ocPortal upgrader tool (yoursite.com/upgrader.php) to flush the caches of your master site. There is no need to close the site.

STEP 3: Backup the database of your main site by executing the following command in a shell (ssh) window, taking care to first replace the place holders with your specific details:

Code

mysqldump -u MAIN_DB_USERNAME -p MAIN_DB_NAME --password=MAIN_DB_PASSWORD > main_db_backup.sql

STEP 4: Prepare the clone site's database to accept main site's database using the following ssh command (change place holders as required):

Code

mysql --user=CLONE_DB_USERNAME --password=CLONE_DB_PASSWORD -BNe "show tables" CLONE_DB_NAME | tr '\n' ',' | sed -e 's/,$//' | awk '{print "SET FOREIGN_KEY_CHECKS = 0;DROP TABLE IF EXISTS " $1 ";SET FOREIGN_KEY_CHECKS = 1;"}' | mysql --user=CLONE_DB_USERNAME --password=CLONE_DB_PASSWORD CLONE_DB_NAME

STEP 5: Replace the clone site's database with that of the main site using the following ssh command (change place holders as required):

Code

mysql -u CLONE_DB_USERNAME -p CLONE_DB_NAME --password=CLONE_DB_PASSWORD < main_db_backup.sql

At this point you can delete main_db_backup.sql if you wish (by executing the rm main_db_backup.sql command in the ssh window). I sometimes don't if I'm going to be playing around with the tables of my clone site directly. So if I stuff something up I can just do steps 4 and 5 and I'm good to go.

STEP 6: Now, to clone the rest of the site. In cPanel do the following:

   a) rename CLONE_SITE_DIR directory to CLONE_SITE_DIR_OLD. The main reason for this is to protect the .htaccess and info.php. If you are short on space then you can delete all files except those two.
Note: The first time you set up a clone site you might actually need to copy .htaccess from MAIN_SITE_DIR to CLONE_SITE_DIR_OLD and check if there are any site specific paths that need changing.

In my case there are two entries that have site specific paths The first is the ErrorDocument line, which ensures that 404 pages are displayed properly, and the second is a AuthUserFile line to ensure password protected directories work (I password protected my main site while it was in development).

Also, if your main site is based on recommended.htaccess then .htaccess should be copied otherwise you will most likely get Not Found errors when trying to access the cloned site.

   b) navigate to MAIN_SITE_DIR folder and select all files and folders in that folder.

   c) select copy function and change destination path from "/public_html/mydomain.com/MAIN_SITE_DIR" to "/public_html/mydomain.com/CLONE_SITE_DIR"

   d) copy the following files from "CLONE_SITE_DIR_OLD" to "CLONE_SITE_DIR" to ensure that the cloned site will work correctly:
      .htaccess
      info.php

   e) delete CLONE_SITE_DIR_OLD directory

Congratulations!!!, you should now have a working clone of your main site!

A few things to note about the cloned site.

1) Its live, so anyone who has access to your main site has access to your clone site. If you don't want them to see the clone and the things under development you can either close the clone site (so only admins will be able to log in) or password protect the CLONE_SITE_DIR directory using cpanels Password Protect Directories feature.

2) Although the bulk of the clone site uses dynamically generated URLs which will automatically adjust to the new location and URLs, any URLs you have hard coded or that appear in content will still point to the main site. The classic examples of this are the URLs in spacer posts. This has never been an issue for me.

3) Because the clone looks identical to the main site you might want to consider making some small but obvious change to the look of the clone so that it is easily distinguishable from your main site.

4) User notifications will still be active, so if you reply to a members post (say for example you are testing that post reply still works), and they have email notifications turned on, they will receive the email notification.

I think that's all. Enjoy!


Last edit: by temp1024

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#72953
Avatar

Community saint

Much to digest, so will take it one mouthful at a time to eat this elephant …

thanks


Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#72954
Avatar

Community saint

Or if you are not hungry, don't eat at all :lol:

It looked a lot more appetising in my notes, but once I added the clarifications and the notes it become a bit of a mouth full.

But remember Fletch, you did ask for it ;)

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#72957
Avatar

Community saint

Thanks temp1024 I've wondered about this for a while-thanks for making the effort to put it on the forum for others who, like me, wondered but haven't asked the question 'How do I make a clone of my site?' :thumbs::thumbs:


Art and Imagination
of David L Friend

http://davidlfriend.com

  My Art Gallery
powered by ocPortal
Back to the top
 
Posted
Rating:
#72963
Avatar

Community saint

temp1024 said

But remember Fletch, you did ask for it ;)
You betcha! And I am suitably grateful (adj: warmly or deeply appreciative) for the effort.

I am certain to attempt to use it in the (very) near future, especially when I take a stab at producing 'themes' and ' templates'. It would be good to see how it would 'change' (read as 'screw-uo') a layout before deciding to offer it to other users.

Once again, thanks

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#72967
Avatar

Well-settled

Wow! Thanx temp1024,
You out did yourself on this and I very much appreciate it.
I'd give you a thousand points but I don't have that much to give :(
Again thanx for putting the effort into this so that we may all benefit from it.
I love this community :thumbs:

Making games is fun…having people play them is the reward!
Back to the top
 
Posted
Rating:
#73025
Avatar

Community saint

I followed the above procedure and everything went fine but when I log into my clone site, I have no access to the Admin Zone (not listed in the zone menu) and I get the 404 page.  If you go directly to the zone edit menu (xxxxx.com: The Leading XXX Site on the Net), the admin zone is not listed. What could have caused this.

All other zones are fine and I can navigate to many (maybe most) pages in the adminzone form the 404 page.

Thanks for any clues.

Bob

PS - Just checked to SQL dump and the adminzone is included in the data for ocp6_zones. So it appears to maybe be a glitch during the import. I will empty the DB and try the import again.


Last edit: by BobS
Back to the top
 
Posted
Rating:
#73030
Avatar

Community saint

Well, this get curiouser.

Before re-importing the database, I decided to check the ocp6_zones table in the clone DB. Sure enough, the adminzone is there and is set to display in the zone menu but it doesn't.

So what else would explain the Admin zone not being included in the zone menu and getting a 404 error when accessing the start page of the admin area?

EDIT: I should clarify this: The Admin menu appears in the zone menu when an admin first logs in but clicking on it causes the 4040 and the removal from the zone menu. I can access any of the adminzone links from the 404 screen - it's just the adminzone start page which has gone missing.

Any ideas?

Bob


Last edit: by BobS
Back to the top
 
Posted
Rating:
#73034
Avatar

Community saint

This is resolved. The whole adminzone directory went missing when I copied it from the main site to the clone site. Just adding urgency for me to switch hosts.

Bob
Back to the top
 
Posted
Rating:
#73035
Avatar

Community saint

Was your clone site a fresh install or did you re-use an existing one?

EDIT: I think the problem might be with .htaccess . I forgot that I had updated it ages ago with the contents of recommended.htaccess, and I made the same changes to clone site, so a fresh/different install is not going to have the original .htaccess file any more.

To fix this, copy .htaccess from main site to clone site, and check if there are any site specific paths that need changing.

The reason my instructions say not to copy the .htaccess is because in my case there are two entries that have site specific paths The first is the ErrorDocument line, which ensures that 404 pages are displayed properly, and the second is a AuthUserFile line to ensure password protected directories work (I password protected my main site while it was in development).

You should only need to do this the first time.

Sorry about that BobS, I'll update the instructions accordingly.


Last edit: by temp1024

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#73038
Avatar

Community saint

I re-used an existing install. I've always done basically the same thing but your approach was more streamlined so I went with it.

I'm guessing it was a fluke because I remember specifically choosing "Select all" in the cPanel file manager before choosing copy.

I just panicked a bit because I was anxious to get this done so I could test the upgrade to 7.1.3 and work out any issues I would have in upgrading.

Now onto upgrading the main site and then to finish those bits and bobs of coding. I want to get this site launched.

Your instructions were great and I really appreciate you sharing them - they probably would have shaved off 10-15 minutes had I not had the glitch.

Bob
Back to the top
 
Posted
Rating:
#89206
Avatar

Fan in action

Hi guys,
temp104: Thanks for all o'that. It did convince me that here is a "no go zone" for me!  :o

Just realised the age of these posts - surely since those dark ages (webtime) all should have been made more like a Softaculous deal?  HINT:  :cool:

Cheers!
Himagain - BSOD (Black Screen Of Death) avoider, (Remembers lower-than-animals jokes on BBS's saying just add ( or hiding) this line del *.* ……..
 

____________________________________________
CENSORSHIP??? They can't stop m
:offtopic:
Back to the top
 
Posted
Rating:
#89628
Avatar

Community saint

@temp

Can you seriously consider copying the instructions to the Community Docs so that there is a ready-reference for those that wish to use it?

It occurs to me that it would also make a good reference point for the 'Book'!

thanks


Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#89663
Avatar

Community saint

Fletch said

@temp

Can you seriously consider copying the instructions to the Community Docs so that there is a ready-reference for those that wish to use it?
Will Do.

Fletch said

It occurs to me that it would also make a good reference point for the 'Book'!
Mmmm. I'm not sure that it really belongs in the 'Book'.


Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#89669
Avatar

Community saint

Will Do.
Crackin' Cheese Gromit

Mmmm. I'm not sure that it really belongs in the 'Book'.
Disagree. It's almost a 'work of art' - but seriously - the flip-flop discussions as to whether there should be a 'demo' site to illustrate progress of a site build (the work in progress) appears to be leaning towards encouraging a user to build their own demo site.

A 'cloned' site of one they've already built, on which to work along with the examples in the 'Book', might be more beneficial to the prospective user.

But that's only my 2 worth …

 :thumbs:

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Item has a rating of 5 (Liked by Robbie Goacher)  
Rating:
#89709
Avatar

Community saint

Fletch said

A 'cloned' site of one they've already built, on which to work along with the examples in the 'Book', might be more beneficial to the prospective user.
The last thing you want to do though when introducing someone the ocp is to freak them out.

The cloning instruction can freak people out by overwhelming them with its low level technical nature, and by giving the 'impression' that ocp may be fragile.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Item has a rating of 5 (Liked by Guest)  
Rating:
#89712
Avatar

Community saint

I don't think we're on the same page, but that isn't necessarily a bad thing, just so long as it doesn't degenerate into teddy's being chucked out of the pram!
  • I agree about the 'freaking out', but if they've got this far, and felt the need to consult a 'Book' or PDF, then they are probably doing a good impression of a duck treading water. I know I did (still do!), but the tenor of this Forum, the friendliness and the quick and helpful responses, soon cured me of my abject horror of asking for help in an open forum!
  • Perhaps I need to reassess my idea about a 'cloned' site. By its nature it is specific and a mirror of one's 'live' site, so tinkering with elements of the cloned site by trying to follow instructions in a written document isn't necessarily going to cut it.
  • But, I am still partial to having that facility available rather than inadvertently inviting a reader/user to tinker with their live site, and the pitfalls that could open up for the unwary.

I'll go away and chew on it some more …

 :(

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Item has a rating of 5 (Liked by FletchLiked by JeanLiked by BobSLiked by Guest)  
Rating:
#89816
Avatar

Community saint

Fletch said

@temp

Can you seriously consider copying the instructions to the Community Docs so that there is a ready-reference for those that wish to use it?
Done: How to clone your ocPortal site - ocPortal.com

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#89839
Avatar

Community saint


Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#93479
Avatar

Community saint

Tom McMasters said

I have set up the ocPortal with an orginal URL of tfmpublishing.org and now I want to use huberresidents.org – the webhosting company has set up the server so I can do this. How do I point the site so it use huberresidents.org instead of the original?

Currently if you type huberresidents.org into the URL window it changes and uses the parked domain tfmpublishing.org.  It looks almost as if huberresidents.org was redirected to the other domain.  However  tfmsview: does not change the front part of the URL so it is not a redirect.  The webhosting company tells me there should be a setting in the CMS I can change?
Looks like you got it working!

Just make sure that you update info.php so that it uses the new domain, i.e:

Code

$SITE_INFO['domain']='huberresidents.org';
$SITE_INFO['base_url']='http://huberresidents.org';

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: