Upgrading from blojsom 2 to blojsom 3
- Stop the current blojsom 2 web application on your server.
- Backup your blojsom 2 web application and your blog data! Although the upgrade utility only reads your blojsom 2 configuration information and blog data, you should take precautions to backup this valuable information.
- Move the blojsom 2 web application from your application server to a directory outside of the application server
- Proceed with installation of blojsom 3. When you get to the step of configuring the "dbloader" bean, come back to these instructions.
- You should use the database creation script in the "dbloader" bean that does not create any initial data in the database. This is controlled by the "dbScript" property of this bean. The "dbloader" bean can be found in /WEB-INF/classes/blojsom.xml. For example with MySQL DB (for other DBs you need to adjust the "dbScript" and the "detectBlojsomSQL":
<bean id="dbloader" class="org.blojsom.util.database.DatabaseLoader" init-method="init">
<property name="sessionFactory">
<ref bean="hibernateSessionFactory"/>
</property>
<property name="dbScript" value="/WEB-INF/classes/blojsom-mysql.sql"/>
<property name="upgrading" value="false"/>
<property name="servletConfig">
<ref bean="servletConfigFactoryBean"/>
</property>
<property name="detectBlojsomSQL">
<value>show tables;</value>
</property>
</bean>
- Uncomment the blojsom 2 upgrade bean in /WEB-INF/classes/blojsom.xml. The bean definition is as follows:
<bean id="blojsom2toblojsom3upgrade" class="org.blojsom.upgrade.Blojsom2ToBlojsom3Utility" init-method="upgrade">
<property name="fetcher">
<ref bean="fetcher"/>
</property>
<property name="servletConfig">
<ref bean="servletConfigFactoryBean"/>
</property>
<property name="blojsom2Path">
<value>/path/to/blojsom2</value>
</property>
<property name="blojsom3Path">
<value>/path/to/blojsom3/</value>
</property>
</bean>
- You will need to configure the blojsom2Path and blojsom3Path values for the bean.
- blojsom2Path should be set to the location where you moved the blojsom 2 web application.
- blojsom3Path should be set to the location where you installed the blojsom 3 web application.
- Edit the blojsom 2 blojsom.properties file. This is located in the blojsom 2 web application at /WEB-INF/blojsom.properties.
- Add the blojsom-installation-directory property and set its value to the location where you moved your blojsom 2 installation.
- Change the package names on the blojsom classes to use blojsom2.
- A sample, updated configuration file is would be as follows:
#
# blojsom2 main configuration file
#
blojsom-installation-directory=/path/to/blojsom2/
blojsom-users=default
blojsom-default-user=default
blojsom-configuration-base-directory=/WEB-INF/
blojsom-fetcher=org.blojsom2.fetcher.StandardFetcher
ignore-flavors=admin, rsd, text
blojsom-templates-directory=/templates/
blojsom-resource-manager=org.blojsom2.util.resources.ResourceBundleResourceManager
blojsom-resource-manager-bundles=org.blojsom2.plugin.admin.resources.messages
blojsom-resource-directory=/resources/
blojsom-authorization-provider=org.blojsom2.authorization.PropertiesAuthorizationProvider
blojsom-broadcaster=org.blojsom2.event.SimpleBlojsomEventBroadcaster
blojsom-blog-home=
blojsom-installed-locales=en, de, fr, ko, sv, pt_BR
- If you had to move the blog data! or your new blog URL of Blojsom 3 will be different then you need to go to every blog in WEB-INF/<blog id> and adjust the blog.properties file. Properties of interest are "blog-home" and "blog*-url".
- Download the blojsom 2 to blojsom 2 upgrade utility
and unzip the contents of this file into the blojsom 3 web application's library directory, /WEB-INF/lib.
- You may now start your application server.
- On startup, blojsom should create the database tables for you and migrate the blog data and templates for each blog from the blojsom 2 web application.
- The migration utility should run after the database loader and you will see debug information such as the following:
Sep 29 14:43:27 INFO [main] database.DatabaseLoader - About to create blojsom database
Sep 29 14:43:27 INFO [main] database.DatabaseLoader - Read in sql script
Sep 29 14:43:28 INFO [main] database.DatabaseLoader - Finised blojsom database creation
Sep 29 14:43:28 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - blojsom 2 path: /path/to/blojsom2/
Sep 29 14:43:28 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - blojsom 3 path: /path/to/blojsom3/
Sep 29 14:43:29 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - Creating new blog: default
Sep 29 14:43:30 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - Loaded permissions for blojsom 2 blog: default
Sep 29 14:43:30 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - Migrating blojsom 2 user: default
Sep 29 14:43:32 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - Created blojsom 3 category: /
Sep 29 14:43:34 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - Migrating 6 entries from blojsom 2 category: /
Sep 29 14:51:16 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - Copied blojsom 2 blog resources from: /path/to/blojsom2/resources/default to: /path/to/blojsom3/resources/default
Sep 29 14:51:16 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - Copied blojsom 2 blog data from: /path/to/blojsom2/WEB-INF/default to: /path/to/blojsom3/WEB-INF/blogs/default
Sep 29 14:51:16 DEBUG [main] upgrade.Blojsom2ToBlojsom3Utility - Finished upgrading blojsom 2 instance to blojsom 3!
Sep 29 14:51:16 DEBUG [main] servlet.BlojsomServlet - blojsom: All Your Blog Are Belong To Us
- After blojsom has successfully started and you have verified you can login to your blog, comment out or remove the "blojsom2toblojsom3upgrade" bean definition from /WEB-INF/classes/blojsom.xml.
- Enjoy blojsom 3!
Notes
The following sections highlight some aspects of blojsom 3 upgrade or the possible tasks afterwards.
Configuring the "default" blog
In blojsom 2, there was the notion of a default blog. This was the blog that would be loaded if no blog was specifically requested. The same functionality exists in blojsom 3. However, you may have called your default blog something other than "default". You can change this setting in /WEB-INF/classes/blojsom.xml.
<bean id="defaultProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="default-blog">default</prop>
<prop key="ignore-flavors">admin, rsd</prop>
<prop key="installed-locales">de, en, fr, jp, ko, pt_BR, sv</prop>
<prop key="resources-directory">/resources/</prop>
<prop key="templates-directory">/templates/</prop>
<prop key="themes-directory">/themes/</prop>
<prop key="blogs-directory">/blogs/</prop>
<prop key="bootstrap-directory">/bootstrap/</prop>
</props>
</property>
</bean>
Simply change the name of the default-blog property to the name of the blog you want to load if no blog is specifically requested.
DB Creation Fails
If the "dbloader" fails to create the DB or to identify the DB then you can avoid the problem with:
- Open the DB Creation script in WEB-INF/classes and copy the content
- Open your DB's SQL program and paste in the content and execute it
- If that fails you may need to load the file instead
Upgrade and Ecto
If you are using Ecto as blogging client software you may need to open the account(s) and refresh the account by click on "edit" and then on the "save" button. This is mandatory if you are moving the Blojsom to another server. If Ecto is not working properly then just check if the account refresh is doing the trick.