Reinitialize Orchard

Topics: Administration, Installing Orchard, Writing modules
Aug 30, 2011 at 3:28 PM

I downloaded Orchard source, opened it in Visual Studio, built and ran Orchard.

I since dropped/deleted the database and recreated a blank database, how do I force Orchard to reinitialize? What file or setting must I delete for Orchard to go through the setup?

Thanks,

Mario

Aug 30, 2011 at 6:09 PM

In the Orchard.Web folder there is an App_Data folder.  Inside of that folder is a Sites folder and in that should be a Default folder.  You can delete/rename that and it will start from scratch next time you hit the site.

-Vinnie

Aug 30, 2011 at 6:13 PM
MarioRosario wrote:

I downloaded Orchard source, opened it in Visual Studio, built and ran Orchard.

I since dropped/deleted the database and recreated a blank database, how do I force Orchard to reinitialize? What file or setting must I delete for Orchard to go through the setup?

Thanks,

Mario


For now, I got around this by redeploying the website. I am sure there is an easier way to re-initiate this. The reason why I had to delete the database and recreate it is becayse everytime Ochard starts up it creates another Admin account in the database. I had up to three Admin logins in the Users page and it is confusing.

Should Orchard create another Admin account each time?

Coordinator
Aug 30, 2011 at 6:15 PM

Each time you do what?

Aug 30, 2011 at 6:23 PM
Edited Aug 30, 2011 at 6:26 PM

Each time I redeploy or test a new download, because Site/Default does not exists. By default it creates an admin account, I did not change the admin value. Then I had 3 admins, and deleted the wrong admin and so I had to start over.

Coordinator
Aug 30, 2011 at 6:28 PM

Oh, so you delete app_data but leave the database in place? Then yes, in that case anything could happen, but why would you not delete the database?

Aug 30, 2011 at 6:34 PM
Edited Aug 30, 2011 at 6:40 PM
bertrandleroy wrote:

Oh, so you delete app_data but leave the database in place? Then yes, in that case anything could happen, but why would you not delete the database?


Laughs, let me try to explain.

I downloaded the latest release, unzipped it and built it in Visual Studio, then when I ran it, Orchard ran the initialization and created the database tables. Because the release did not include ClickToBuild, I got it from a downloading the development source. I ran it to see what happens, and it created another admin. Then I invoked ClickToBuild and deployed the site from the staging area and once again I created another admin.

That's when I deleted the wrong admin. So I dropped the database to start over. So I did delete the database. But I needed to know who to reinitiaze Orchard.

Coordinator
Aug 30, 2011 at 6:45 PM

Oh, so ClickToBuild created the user? That is weird, and sounds like a bug.

In any case, clicktobuild is not necessarily what you want to use to build a clean deployable version. In particular, running the tests is not necessarily a good use of your time (and might be what's creating those users). All that clicktobuild does is call build orchard.proj with the "Build" target. That project has other targets, such as FastPackage, that might work better for you.

Aug 30, 2011 at 6:58 PM
Edited Aug 30, 2011 at 7:00 PM
bertrandleroy wrote:

Oh, so ClickToBuild created the user? That is weird, and sounds like a bug.

In any case, clicktobuild is not necessarily what you want to use to build a clean deployable version. In particular, running the tests is not necessarily a good use of your time (and might be what's creating those users). All that clicktobuild does is call build orchard.proj with the "Build" target. That project has other targets, such as FastPackage, that might work better for you.

I am not sure I'm explaining myself correctly. I am referencing the post "Build and Publish in VS2010" in the Install Topic. When I say deploy, I mean publish to my dedicated web server. I did not run any tests, and ClickToBuild did not create those users. But I think I know how to publish Orchard and write modules now. To deploy, I just copied everthing from the build/Stage to my web server.

Coordinator
Aug 30, 2011 at 7:01 PM
Edited Aug 30, 2011 at 7:01 PM

Still not clear what you are doing. Why do you want to go through setup again?

Aug 30, 2011 at 7:33 PM
bertrandleroy wrote:

Still not clear what you are doing. Why do you want to go through setup again?

No, I didn't want to go through setup again.

I think it is unique to my environment that setup ran three times. The first time setup ran was when I downloaded and built and ran Orchard, the second time setup ran was when I downloaded the latest development source and built it and ran it. The third time setup ran was after I published it to my web server, each time Sites/Default did not exist, so setup ran and I gave it the same database all three times. It was after the third time that I decided to delete the database to start over.

I had assumed that setup would reuse the admin user and not create a new user with the same name.

Is this better?

Coordinator
Aug 30, 2011 at 7:41 PM

But you said "What file or setting must I delete for Orchard to go through the setup?" Oh well. So yes, I can confirm that if you want to deploy and continue to use the same database, you need to also deploy part of app_data. In particular, the settings.txt file in the default tenant is what will point Orchard to the database and allow it to skip setup.

Aug 30, 2011 at 7:45 PM
bertrandleroy wrote:

But you said "What file or setting must I delete for Orchard to go through the setup?" <stuff deleted>


When I did delete the database and created a new blank database, I had to force Orchard to reinitialize. It's all good, I have it running now.

Aug 30, 2011 at 7:50 PM
vrossi wrote:

In the Orchard.Web folder there is an App_Data folder.  Inside of that folder is a Sites folder and in that should be a Default folder.  You can delete/rename that and it will start from scratch next time you hit the site.

-Vinnie


Thanks, this was the answer I was looking for, I didn't mean to write a blog about my 1st time experience, lol.