4

I'am just starting with magnolia and at the very beginning it surprised me that Magnolia needs to be installed after each .war deploy to tomcat. I do some changes in my project, deploy it with mvn tomcat7:deploy/redeploy. Tomcat automatically recognise that ROOT.war has changed so it unpack it automatically and after that when I'm entering localhost:8080 it wants me to install Magnolia modules again. Is it really necessary to install all modules again and again after every single changes in my project and deploy? Maybe the way how I'm making changes in my project and deploying it is wrong? If I'am not mistaken in that way my content changes also will be overwritten/deleted?

mickiewicz
  • 279
  • 2
  • 13

2 Answers2

3

You have to re-install Magnolia every time because I think that you delete your repository (database) every time that you deploy a new version.
Probably you are saving your data in a folder inside webapps and every time that you deploy a new .war it is deleted.
If you want to keep your website and modules between deployments, I need to change the repository location to a different folder in the file system, or set a db connection.
You can do that by modifying the repositories.xml file or adding a custom jackrabbit conf file, in this article you will find a lot of useful info, and I suggest you to have a look into the paragraph 'Custom Jackrabbit configuration file'

cloudy_weather
  • 2,837
  • 12
  • 38
  • 63
3

Have a look at documentation on how to configure your Magnolia for details, but in essence it's enough if you open /WEB-INF/config/default/magnolia.properties and change magnolia.home= to point to the directory OUTSIDE of your webapp. By default it is set to be inside of the war file so you can wipe and reinstall Magnolia easily. In your case you want your data to be permanent, so you set it out. You should still read the article linked by Daniele about how to setup your devenv and you might still want to configure different database than derby for your production use, but you should keep all your data outside of the webapp too.

HTH,
Jan

Jan
  • 4,369
  • 14
  • 25
  • I will surely read the documentation that you have mentioned. Article linked by Daniele is rly awesome and very useful. The other two: [building](http://dev.magnolia-cms.com/~gjoseph/dont-build-magnolia-build-your-projects) and [configuring](http://dev.magnolia-cms.com/~gjoseph/dont-configure-magnolia-let-your-projects-configure-it) are also worth to read. All of them has been very useful in my case. – mickiewicz Mar 26 '15 at 12:42