Token Vending Machine ClickStarts and How to Build Them

Written by: Hannah Inman
6 min read
Stay connected

To accompany the recent series of blogs on Amazon Web Services and PaaS, I put together a couple of ClickStarts to make it easy to try out the Token Vending Machine examples. If you haven't come across ClickStarts before, they are a great way to get started with a whole range of new technologies or languages: they are like a "project in a box" that you can launch with just a couple of clicks. Harpreet Singh did an excellent blog about the technology behind them that's well worth reading. Just sign up for a free CloudBees account using the links at the bottom of the page (it's free - no credit card required) and when you log in, look for the ClickStarts tab in the black toolbar (top left) and when you click on it, you'll see a collection of ClickStarts for many different languages, frameworks and applications. Look for these two, which will create a repository, Jenkins build job and web app deployment for both the Anonymous and Identity TVM services:​

Just click on the tile for whichever one you want to build - you should see a screen like this one, where you can choose what name you want to give your repository, Jenkins build job and application:

Click "Create App" and after a few seconds, you should see the following screen, which gives details of the Git source code repository that has been created on the CloudBees Forge (with the URL to use for access) and the Jenkins build job that is running to build the TVM web application:

Click on "Open Application" and you'll be taken to the Jenkins build job which will compile and deploy your TVM web application. The Jenkins job will build from the cloned Git repository that was created for you in the CloudBees Forge: if you later want to modify the application, just go to the URL for the repository (or navigate there via GrandCentral) and follow the instructions there to create a local clone that you can use for development. You'll need to set up an ssh key pair. The Jenkins job may be waiting for an executor or it may already be building the application: either way, you can click on the striped progress bar for the build or on "Console Output" from the dashboard menu on the left to view the build in action:

The build should only take a few seconds. When it's completed, you should see the following messages from the CloudBees Deployer Plugin , with the link to the deployed web application running on the CloudBees PaaS:

Click on the link at the bottom and you'll be taken straight to the application, which should look like this (remember that you still need to use the Bees SDK config:set command to configure your AWS access credentials and (for the Identity TVM) the application name). You can follow the link back to my earlier blog for details of the configuration:

And that's all there is to it - easy, wasn't it? However, if you're interested, let me quickly show you how I created the ClickStarts - and you can do exactly the same thing with your own applications or samples. Take a look in the Git repository that was created when you ran the ClickStart; there are two files there, called clickstart.json and jenkins-config.xml, and these configure the ClickStart.

The clickstart.json file defines the various components of the ClickStart and how they relate to each other. You can have more than just a repository and build job, as we do here: you could also have a pre-built application deployment (to make the application instantly available, without having to wait for the Jenkins build to complete) and other resources, such as database instances. Here's the json file I use for the Identity TVM ClickStart:

{

    "id": "cb-tvm-identity",

    "name": "AWS Identity Token Vending Machine (TVM)",

    "source": "github",

    "description" : "The Amazon Web Services Identity Token Vending Machine (TVM) sample application for the CloudBees PaaS",

    "doc-url" : "https://github.com/mqprichard/cb-tvm-identity/blob/master/README.md",

    "icon" : "https://d3ko533tu1ozfq.cloudfront.net/clickstart/sencha_icon.png",


    "build-with-jenkins": {

        "plugins" : ["git"],

        "template": {

            "type": "https://raw.github.com/mqprichard/cb-tvm-identity/master/jenkins-config.xml",

            "options": {

            }

        }

    }

}

Most of this is self-explanatory: note that "source":"github" specifies that the Forge repository should be cloned from the GitHub repository from which the ClickStart is launched. Look at the navigation bar in your browser when launching the ClickStart and you'll see something like this (with your domain name instead of mine, of course):

https://mqprichard.ci.cloudbees.com/#CB_clickstart=https://raw.github.com/CloudBees-community/cb-tvm-identity/controller/clickstart.json

Note that the source files for the application and the ClickStart configuration both come from a GitHub repository owned by the CloudBees-community organization; that's the normal place for all ClickStarts built by either CloudBees, our partners or anyone who wants to make their application or technology available on the PaaS. In this case, I have also specified a Jenkins build to run. You need to declare any plugins that are needed for the build and the PaaS will ensure the plugins are loaded; just make sure that you limit yourself to the plugins on the Essentials List if you want your ClickStart to be available to all users. To copy the config.xml from an existing Jenkins job, just add /config.xml to the URL for the project dashboard in your browser. You may need to modify it slightly: remember that any plugins you want to include in the Jenkins build should be declared in clickstart.json. You can see the configuration I used for the Anonymous TVM ClickStart on GitHub - the other is almost identical. Look out for the three ${env} variables that replace the account name, application name and repository URL in the original Jenkins configuration: the correct values will be substituted at run-time.

ClickStarts are a great way to share applications and builds with others. Just send them the ClickStart link - many ClickStarts include a launch button that allows the user to signup or login beforehand - and they can be up running in a couple of clicks. It's also a great way to get started with new frameworks or languages. Be sure to take a look.

Mark Prichard, Senior Director of Product Management

CloudBees

Mark Prichard speaks and blogs regularly as an evangelist for CloudBees and Platform as a Service. He came to CloudBees after 13 years at BEA Systems and Oracle, where he was product manager for the WebLogic Platform. A graduate of St John's College, Cambridge and the Cambridge University Computer Laboratory, Mark works for CloudBees in Los Altos, CA. Follow Mark on Twitter and via his blog Clouds, Bees and Blogs.

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.