While developing a site I would like to duplicate my site as I advance.
I'm using user instance db, so my sql express files are in the App_Data folder.
I copied my site to a new folder, published on IIS.
I attached the database, renamed files and database name, and dettached.
Then changed the web.config to use the renamed mdf.
I deleted all content from App_Data\ClientDependency.
I could login and republish all nodes, and can see the site fine. But the backend is missing almost all images. And I keep seeing requests to the original site.
So, does anyone know what else do I have to do to duplicate an umbraco site, using a user instance database?
Well, first of all, I am suspecting you want to do this so that you can roll back changes. That is what source control is for, I would suggest you look at that and regular database backups for making sure your changes are reversible.
That being said: odd behaviour! You are using a new site in IIS? Did you assign hostnames to nodes in the umbraco backend (also see the umbracoDomains table). Are you sure the second database gets attached under a different name? Usually when you take an mdf file I think the database name is hardcoded in the file. As a workaround you can create a proper backup and restore your database to a newly named database so that it doesn't conflict with your first instance.
It's not only to roll back changes, it's also because this way it's very easy to show alternative configurations to your clients. And it's very portable. If it works that is... ;)
When I load the login page I can see images being pulled from the original site from umbraco_client folder. And the original site is down. So that's maybe why they don't show.
I did not understand what you said about assigning hostnames to nodes, and the umbracoDomains table.
Regarding the db name, I attached the copied mdf file to SQL Server, and renamed the file and the db name. I then edited web.config's umbracoDbDSN to point to this new mdf file. I also made sure the original database is not available, so I'm pretty sure the copied site is using this new mdf.
The trouble seems to be Umbraco is holding absolute references to assets, like images in the backend, and I can't figure out how to reset these...
Did you re-publish all nodes after copying the site over? You can also just delete the /App_Data/umbraco.config file to achieve this.
There are no absolute paths stored in the db to my knowledge, so that can't be it. I've duplicated Umbraco sites quite a couple of times by now and never had any problems with items linking to the old address, apart from the one time I forgot to republish the nodes...
I tried running IE inside my vm box and it worked fine. So I deleted my IE cache and now it works... I'm convinced I did this already, but can't argue with facts. It's working now.
So apparently this workflow works:
1) user instance (mdf in App_Data) 2) copy site to new site 3) change mdf with SQL Server Management Studio, to change db name and files (still not very sure if this is necessary) - use attach/change/detach 4) edit web.config to point to new db name and files 5) enter umbraco backend and republish site, or delete App_Data\umbraco.config 6) view site and backend to check everything's fine
Voila a duplicated site.
The only difficult thing here is to do the initial setup with an user instance. I had to use a "normal" instance, then later detach it, put files in App_Data, and change web.config to point to the mdf file. I just couldn't convince umbraco setup to use an user instance connection string.
duplicating an umbraco installation
While developing a site I would like to duplicate my site as I advance.
I'm using user instance db, so my sql express files are in the App_Data folder.
I copied my site to a new folder, published on IIS.
I attached the database, renamed files and database name, and dettached.
Then changed the web.config to use the renamed mdf.
I deleted all content from App_Data\ClientDependency.
I could login and republish all nodes, and can see the site fine. But the backend is missing almost all images. And I keep seeing requests to the original site.
So, does anyone know what else do I have to do to duplicate an umbraco site, using a user instance database?
Thanks,
Duarte
Well, first of all, I am suspecting you want to do this so that you can roll back changes. That is what source control is for, I would suggest you look at that and regular database backups for making sure your changes are reversible.
That being said: odd behaviour! You are using a new site in IIS? Did you assign hostnames to nodes in the umbraco backend (also see the umbracoDomains table). Are you sure the second database gets attached under a different name? Usually when you take an mdf file I think the database name is hardcoded in the file. As a workaround you can create a proper backup and restore your database to a newly named database so that it doesn't conflict with your first instance.
Sebastian, thanks for your help.
It's not only to roll back changes, it's also because this way it's very easy to show alternative configurations to your clients. And it's very portable. If it works that is... ;)
When I load the login page I can see images being pulled from the original site from umbraco_client folder. And the original site is down. So that's maybe why they don't show.
I did not understand what you said about assigning hostnames to nodes, and the umbracoDomains table.
Regarding the db name, I attached the copied mdf file to SQL Server, and renamed the file and the db name. I then edited web.config's umbracoDbDSN to point to this new mdf file. I also made sure the original database is not available, so I'm pretty sure the copied site is using this new mdf.
The trouble seems to be Umbraco is holding absolute references to assets, like images in the backend, and I can't figure out how to reset these...
Duarte
Hm, that is rather odd indeed.
Did you re-publish all nodes after copying the site over? You can also just delete the /App_Data/umbraco.config file to achieve this.
There are no absolute paths stored in the db to my knowledge, so that can't be it. I've duplicated Umbraco sites quite a couple of times by now and never had any problems with items linking to the old address, apart from the one time I forgot to republish the nodes...
Hope that helps,
Sascha
Well, it's solved...
I tried running IE inside my vm box and it worked fine. So I deleted my IE cache and now it works... I'm convinced I did this already, but can't argue with facts. It's working now.
So apparently this workflow works:
1) user instance (mdf in App_Data)
2) copy site to new site
3) change mdf with SQL Server Management Studio, to change db name and files (still not very sure if this is necessary) - use attach/change/detach
4) edit web.config to point to new db name and files
5) enter umbraco backend and republish site, or delete App_Data\umbraco.config
6) view site and backend to check everything's fine
Voila a duplicated site.
The only difficult thing here is to do the initial setup with an user instance. I had to use a "normal" instance, then later detach it, put files in App_Data, and change web.config to point to the mdf file. I just couldn't convince umbraco setup to use an user instance connection string.
Duarte
is working on a reply...