wiki:MolgenisDeployUnderOtherName

Version 2 (modified by jvelde, 14 years ago) (diff)

--

How to deploy a MOLGENIS project under a different name

This manual explains how you can succesfully deploy a MOLGENIS project under a different name and database. For example, 'animaldb' instead of 'xgap_1_4_distro'. This means you do not have to copy your project in order to set up a new instance with another name.

There are two solution flavours, depending on the situation you can make a choice:

  • Permanent solution: This change persists, but will only take place when you re-generate your project.
  • Temporary solution: This change takes effect immediatly, but will be overwritten the next time you re-generate your project.

Project name

Permanent solution: Change the property 'molgenis name' in the last MOLGENIS XML file that is loaded by the parser. For example: molgenis name="animaldb" and run MolgenisGenerator.java.
Temporary solution:
Change 'getMolgenisVariantID()' in MolgenisServlet. For example: return "animaldb";

Database name

Permanent solution: Change database name in 'molgenis.properties'. For example: db_uri = jdbc:mysql://localhost/animaldb?innodb_autoinc_lock_mode=2 and run MolgenisGenerator.java.
Temporary solution:
Change 'url' in META-INF/context.xml. For example: url="jdbc:mysql://localhost/animaldb?innodb_autoinc_lock_mode=2"

Deploy name

Now deploy as animaldb.war so the URL will be: http://myserver.somewhere.com:8080/animaldb

Optional: add or remove security

Add or enable to WEB-INF/web.xml the properties <security-constraint>, <login-config>, <security-role>. For example:

<!--security-constraint>
<web-resource-collection>
<web-resource-name>MolgenisServlet</web-resource-name>
<url-pattern>*.do</url-pattern>
</web-resource-collection>
<auth-constraint><role-name>animaldb</role-name></auth-constraint>
</security-constraint>

<login-config>
<auth-method>BASIC</auth-method>
<realm-name>MOLGENIS</realm-name>
</login-config>

<security-role>
<description>
The role that is required to log in to the application.
</description>
<role-name>animaldb</role-name>
</security-role-->

Final note

My personal convention is to have the SAME (simple, lowercased) name everywhere. So as molgenis name, database name, deploy name, role name. This will save you a lot of trouble for (hopefully) obvious reasons. The actual name of your base project (from which you can spawn instances) doesn't matter then.