CyberHosting

Option to clone web application to other domain or subdomain

Hi Support,

I would like to know if their is an option to clone a website to another website domain / sub-domain hosted on same cyberpanel vps.

I am asking this as currently their is not staging environment to live production sync option available in cyberpanel so is it possible to clone a website to other domain or sub-domain .

I use this approach with other server panel provider Runcloud as to test new updates on my WordPress installations & then move them from one vps to other.

Thanks for the service.
«1

Comments

  • Noted as feature request.
  • Noted as feature request.

    Thanks for taking it as feature request, if their can be staging environment to live production push/sync functionality it will be icing on the cake.
  • Noted as feature request.

    Thanks for implementing the feature in the latest update 1.8.8, I tried it & found some issues listed below:

    1. After setting up the staging site the backend was functioning well but frontend was not opening correctly until I disabled LScache plugin, I tried purging cache before disabling the plugin but it didn't worked so after disabling the staging site was opening correctly on frontend.

    2. To update plugins & theme I had to access it via FTP using filezilla but the issue here was my "domain.com" was using cloudflare dns & for staging site I used "test.domain.com" without using cloudlfare DNS IP but as the ftp account was for the main site it constantly tried to connect to cloudflare ip through FTP at port 21.

    So I had to disable cloudflare dns ip for main site as well, if I can create a separate FTP account for staging site like "test.domain.com" it will be great.

    3. When I visit a page or create a new page in staging site & view the page it shows "404
    Not Found " error I tried to update permalink several time but it only works when I enable the plain permalinks setting, when I use " /%postname%/ " it starts to show 404 error.

    I don't know why it's happening but noticed this issue on fresh WordPress installation using cyberpanel as well. Might be some settings for LScache plugin causing it I tried to purge cache but it didn't solve the issue.

    Clone/Sync function it working great, hope these are some minor issue which your team can help us resolve.

    Once again thanks for the update.

  • 1. So cache purge fixed it, may need to purge cache or remove cache folder for the site.

    2. On my end I did not need to do this, I was able to update plugins, install themes. I tested with astra theme and then synced site to master. May require more details regarding this.

    3. You was using OLS or LSWS Ent?
  • Hi,

    1. I will check to remove cache folder.

    2. I was using cloudflare dns ip that masks the real ip of my server, I guess when we launch the staging site from list of domains at their we can create a FTP account for staging site.

    3. I am using OLS.
  • 1. I think I can remove cache plugin from the staging site?

    2. I think not related, you can even use the FTP of master site, because the folder of child-domain is created inside master document root, you can even manage the staging site like any other child-domain.

    3. 404 could be due to rewrite rules not being copied?
  • 1. Yes we can remove the plugin but I disabled it so can check the updates with caching before pushing to production.

    2. I saw that also, I guess it will work similar to wp-multisite but with a separate sub-domain & database.

    3. I also believe it is something to do with rewrite rules or .htacess file.

    I will test again with fresh server & clean install of CyberPanel.
  • @cloudrider

    There are still few gimmicks with WP Staging, thanks for finding them out, will further check and see if I can fix something,
  • Thanks for the efforts, it's great to see such quick response from the team.
  • The WP staging site function is a great addition, but it does feel a bit buggy at this stage.

    I have tried it with a couple of sites and it seems that not plugin and theme data are copied across, for example forms made in Happy Forms or Caldera are not in the copied staging sites.
  • The WP staging site function is a great addition, but it does feel a bit buggy at this stage.

    I have tried it with a couple of sites and it seems that not plugin and theme data are copied across, for example forms made in Happy Forms or Caldera are not in the copied staging sites.

    Yes but it will improve with new updates, as for the first time it's a great start.
  • I've made some changes, cache plugin will not be copied to staging site now. For production site cache plugin will still be there and need to purge cache manually, these changes will come in v1.8.9.
  • @CyberPanel can I also join the slack channel, please?

    I've just created a clone and I can't seem to access it.

    - Created DNS A in CloudFlare for staging.example.com [Bypass CF Net at this stage]
    - Used CP tool for creating staging.example.com
    - Added SSL/PHP7.3/Open_Base

    I do have an alias also set for example.co.uk -> example.com don't know if this would have any bearing?

    All seems fine, however, when I attempt to go to staging.example.com it redirects the browser to example.com. I can't see anything in the rewrite rules that would cause this. Also, I don't see anything in the OLS conf file that would reference the staging site.

    When I look at the access logs under the website management page I get:

    "Could not fetch logs, see the logs file through command line. Error message: Not able to fetch logs, see CyberPanel main log file!fetch logs, see CyberPanel main log file!"

    When I attempt to access the error logs from the same management page, it refreshes the page and doesn't even show an error message.

    The access logs from main page sidebar don't show anything for that site.
  • Just to follow up I've found the button that opens the separate management panel for the staging site. Clicking preview still performs the redirect from staging.example.com -> example.com.
  • @Richard Do you see staging.example.com created as child-domain to your master site?
  • So the preview button uses the following styled link:

    https://ai.myhosting.co.uk:8090/preview/staging.example.com/

    This also just redirects to https://example.com
  • Under the child domain, there are no rewrite rules and the vhost conf for OLS looks almost identicle to the parent with slight differences:

    docRoot /home/example.com/public_html/staging.example.com
    vhDomain $VH_NAME
    vhAliases www.$VH_NAME

    &

    SSL keys path being correct for child.

    I just remembered, so prior to the SSL for child being created, accessing staging.example.com would throw a security error in browser (understandable) after SSL installed it just instantly redirects. So redirect is happening post 443 OLS listener engaging.
  • @Richard

    I fixed the rewrite rule copying issue, but it will come in v1.8.9. About the preview feature, it is better to temporarily edit your computer/laptop A record or add DNS record for staging site rather then using the preview feature. Because applications are configured on diffrent URLs, so better is to use actual DNS record.
  • I personally use DNS records, I simply didn't know if the preview method was the intended method of access of the clone. Thank you for confirming it is a rewrite rule issue.

    Look forward to v1.8.9, for now, I'll just pull a clone to local development for continued testing.

    Thank you for the continued responses and for making CyberPanel ever greater!
  • @CyberPanel

    FYI: I deleted the staging site from the main website as a child. I just went to take a WP clone (Duplicator plugin) and found that the staging site still has files present. Therefore it's not removed the files.

    It's also created a number of duplications i.e:

    public_html > parent_wp > child_wp > child_wp (the second child doesn't have all WP files just some html files)

    Also, if there is more than one clone created, the second clone creates a copy of the first clones wp files into it as well, including the second child version of its self. This is creating a serious amount of bloat within the system.

    With regards to the database, I am not sure if it's cloned the database, but the wp-config file for the clones has the parent DB + credentials. Although it has created I assume a clone as it has random db name + user listed under parent websites DB.

    Sidenote: the random database name is a bit annoying as it's difficult to determine which site it's for. i.e. if I had created staging & dev as child clones, I wouldn't easily know which DB the site is for.
  • @Richard

    Thanks for digging in a little deeper, I also feel their needs to be an option to name DB & User while creating staging or even main WordPress installation for easy identification instead of some random characters.
  • Hi @CyberPanel

    I recently tested the staging function with latest v 1.8.9

    On the staging site in admin I getting this error line in header:

    Can NOT find LSCWP path for object cache initialization in /home/domain.com/public_html/stage.domain.com/wp-content/object-cache.php

    While the LScache plugin is not copied in the staging site the changes made in theme customizer were also not copied. Can you check if this is happening at your end.
  • I get the same error line on some staging sites but not all of them. You can fix it by just deleting the object-cache.php file that it references.

    The theme customiser settings are not copied and neither are setting for some plugins.
  • @Mysterious_Beans @cloudrider

    Where does WordPress store customiser settings and settings for plugins?

    What we basically do now:

    1. Create dump of main site.
    2. Replace urls of database dump of main site.
    3. Create new database and restore dump.
    4. Then copy all the files from master to child.

    In between we don't copy lscache wp plugin to child-site.

    Did I miss something?
  • edited August 15
    @CyberPanel

    Not tested v1.8.9 yet, but to be honest I am a little weary after last update so giving time for bugs to be reported if any.

    On the MySQL dump are you doing a sed replace like this before reimporting?

    sed -i -e 's/oldurl.tld/newurl.tld/g' wp.sql

    Or are you being a little more selective with DB URL changes?

    Sed replace should catch everything in sql file. I find it works well on 3GB multipress network DB too.

    Using subdomains on multipress DB I use:

    sed -i -e 's/.oldurl.tld/.newurl.tld/g' wp.sql

    It's a very efficient method. It could also be used to loop through theme folders and catch hardcoded URL's in html/php/css/js files. Maybe a 3rd party theme customizer (not WP customizer) is storing options in a file rather than in a database?

Sign In or Register to comment.
CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!