Deploy the App

Page last updated:

Page last updated:

In this step you will deploy the app to Swisscom Application Cloud.

Before we can push it, we need to compile the app using Leiningen. To do so, run

$ lein uberjar

...

2016-04-05 09:41:09.060:INFO::main: Logging initialized @3611ms
Compiling cf-sample-app-clojure.core
Created /.../cf-sample-app-clojure/target/cf-sample-app-clojure-0.1.0-SNAPSHOT.jar
Created /.../cf-sample-app-clojure/target/cf-sample-app-clojure-0.1.0-SNAPSHOT-standalone.jar

Push your app to the cloud by executing the following command and replacing the “my-random-hostname” with your own hostname. This will be part of the URL your app will be reached at and it has to be globally unique so be creative.

The -b java_buildpack tells Cloud Foundry to use the Java buildpack for our app and the -p target/cf-sample-app-clojure-0.1.0-SNAPSHOT-standalone.jar tells Cloud Foundry where to find the compiled application to push to the Cloud.

$ cf push my-clojure-app -b java_buildpack -p target/cf-sample-app-clojure-0.1.0-SNAPSHOT-standalone.jar -n my-random-hostname
Creating app my-clojure-app in org MyOrg / space MySpace as user@mydomain.com...
OK

Creating route my-random-hostname.scapp.io...
OK

Binding my-random-hostname.scapp.io to my-clojure-app...
OK

Uploading my-clojure-app...
Uploading app files from: /.../cf-sample-app-clojure
Uploading 6.1K, 17 files
Done uploading
OK

...

requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: my-random-hostname.scapp.io
last uploaded: Wed Mar 30 14:10:57 UTC 2016
stack: unknown
buildpack: java_buildpack

The application is now deployed. Ensure that the app is running:

$ cf app my-clojure-app
Showing health and status for app my-clojure-app in org MyOrg / space MySpace as user@mydomain.com...
OK

requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: my-random-hostname.scapp.io
last uploaded: Wed Mar 30 14:10:57 UTC 2016
stack: cflinuxfs2
buildpack: java_buildpack

     state     since                    cpu    memory          disk        details
#0   running   2016-03-30 04:11:27 PM   0.0%   70.1M of 1G   42M of 1G

Now visit the app at the URL. You can find the URL in the urls property of the statement above.

I have deployed my App
View the source for this page in GitHub