Actually, it is possible to configure Bamboo Standalone to use GMail for mail notifications.
Bamboo standalone is running on top of Jetty, which can be configured with the
jetty.xml file.
If starting from the
bamboo.sh script, then what needs to be done is a change of the run command.
RUN_CMD="$JAVA_HOME/bin/java -server -Xms256m -Xmx512m -XX:MaxPermSize=256m -Djava.awt.headless=true -classpath $CLASSPATH -Dorg.eclipse.jetty.xml.XmlParser.NotValidating=true com.atlassian.bamboo.server.Server webapp/WEB-INF/classes/jetty.xml"
Then edit the
webapp/WEB-INF/classes/jetty.xml within the
<Configure id="Server" class="org.eclipse.jetty.server.Server"> as follows:
1) Add the plusConfig to enable JNDI
<!-- =========================================================== -->
<!-- Configurations for WebAppContexts -->
<!-- Sequence of configurations to enable Plus features. -->
<!-- =========================================================== -->
<Array id="plusConfig" type="java.lang.String">
<Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>
<Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
<Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
<Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
<Item>org.eclipse.jetty.webapp.TagLibConfiguration</Item>
</Array>
2) In the web application context for Bamboo
<Call name="setHandler">
<Arg>
<New class="org.eclipse.jetty.webapp.WebAppContext">
Add the plusConfig Set:
<Set name="configurationClasses"><Ref id="plusConfig"/></Set>
3) Finally, in the section for JNDI resources
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Add Any JNDI Resources -->
<!-- The default location can be changed using: java -Dbamboo.webapp= -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
Add the Resource for your GMail Account:
<New id="mail" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>mail/Session</Arg>
<Arg>
<New class="org.eclipse.jetty.jndi.factories.MailSessionReference">
<Set name="user">[GMail User]</Set>
<Set name="password">[Password]</Set>
<Set name="properties">
<New class="java.util.Properties">
<Put name="mail.smtp.host">smtp.gmail.com</Put>
<Put name="mail.smtp.auth">true</Put>
<Put name="mail.smtp.port">465</Put>
<Put name="mail.smtp.user">[GMail User]</Put>
<Put name="mail.smtp.starttls.enable">true</Put>
<Put name="mail.from">[From Address]</Put>
<Put name="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</Put>
</New>
</Set>
</New>
</Arg>
</New>
Side note:
You may also add a JDBC Resource here; here as an example a simple PostgreSQL Resource:
<New id="datasource" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg></Arg>
<Arg>jdbc/BambooDS</Arg>
<Arg>
<New class="org.postgresql.ds.PGSimpleDataSource">
<Set name="User">[Username]</Set>
<Set name="Password">[Password]</Set>
<Set name="DatabaseName">bamboo</Set>
<Set name="ServerName">localhost</Set>
<Set name="PortNumber">5432</Set>
</New>
</Arg>
</New>
That's it, with this Jetty configuration, it's now possible to configure Bamboo to use the corresponding JNDI resource for the Mail configuration.
Enjoy.
Note for older versions:
It's also possible to make the same configuration in older Bamboo standalone versions. Mostly all that needs to be done is explained above, except that the class names have to be changed to match the ones from the older Jetty version.
Note for the wrapper:
It should be possible to configure the wrapper to start with the
jetty.xml configuration, using the file as second parameter and uncommenting the rest:
wrapper.app.parameter.2=../webapp/WEB-INF/classes/jetty.xml.