/glassfish-clickstart

Basic glassfish clickstart - gets you going with the basics

Primary LanguageJava

GlassFish clickstart

This clickstart sets up a build service, repository and a basic GlassFish app with continuous deployment. All built by maven.

Launch this clickstart and glory could be yours too ! Use it as a building block if you like. You can launch this on Cloudbees via a clickstart automatically, or follow the instructions below.

This is based on the GlassFish stack that you can read more about here.

Deploying manually:

Create a Glassfish3 container

bees app:create -a my-glassfish3-app -t glassfish3

Create a MySQL Database

bees db:create my-glassfish3-db

Bind the MySQL Database to the Glassfish container

bees app:bind -a my-glassfish3-app -db my-glassfish3-db -as mydb

Supported JNDI names:

  • jdbc/mydb : unqualified relative JNDI name is supported / OK
  • java:comp/env/jdbc/mydb: qualified private name is supported / OK
  • java:jdbc/mydb and java:/jdbc/mydb: qualified relative names are not supported by Glassfish / KO
  • java:global/env/jdbc/mydb: qualified global name is not supported by Glassfish / KO

Samples:

Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/mydb");
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/mydb");

Configure Jdbc Realm

bees config:set -a my-glassfish3-app -R glassfish3.auth-realm.database=mydb

Deploy Application

bees app:deploy -a my-glassfish3-app path/to/my/app.war

Jenkins Job

Create a new Maven project in Jenkins, changing the following:

  • Add this git repository (or yours, with this code) on Jenkins

  • Also check "Deploy to CloudBees" with those parameters:

      Applications: First Match
      Application Id: MYAPP_ID
      Filename Pattern: target/*.war
    

where MYAPP_IDis the name of your application.