Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Begun build tools and completed intellij
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Higham committed Mar 14, 2013
1 parent c0a0c3f commit bf51427
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 4 deletions.
109 changes: 109 additions & 0 deletions source/docs/using/deploying-apps/jvm/lift-getting-started.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,113 @@
title: Lift - Getting started
---

## <a id='intro'></a>Introduction ##

This guide illustrates how to create a lift application and deploy it to Cloud Foundry. This guide assumes Java 6 or 7 and Maven are already installed and working.

## <a id='intro'></a>Create a test application ##

Create a test project with maven;

<pre class="terminal">

$ mvn archetype:generate \
-DarchetypeGroupId=net.liftweb \
-DarchetypeArtifactId=lift-archetype-basic_2.9.1 \
-DarchetypeVersion=2.4-M5 \
-DarchetypeRepository=http://scala-tools.org/repo-snapshots \
-DremoteRepositories=http://scala-tools.org/repo-snapshots \
-DgroupId=com.company \
-DartifactId=lift_hello_world \
-Dversion=1.0
</pre>

Maven should download any dependencies and create a Lift application. The application can be tested localy by having Maven clean the build and start Jetty.

<pre class="terminal">
$ cd lift_hello_world
$ mvn clean jetty:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building lift_hello_world Project 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ lift_hello_world ---
[INFO]
[INFO] >>> maven-jetty-plugin:6.1.25:run (default-cli) @ lift_hello_world >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ lift_hello_world ---

...

15:54:37.000 [main] INFO net.liftweb.mapper.Schemifier - ALTER TABLE users ADD CONSTRAINT users_PK PRIMARY KEY(id)
15:54:37.068 [main] INFO net.liftweb.mapper.Schemifier - CREATE INDEX users_email ON users ( email )
15:54:37.071 [main] INFO net.liftweb.mapper.Schemifier - CREATE INDEX users_uniqueid ON users ( uniqueid )
15:54:37.072 [main] DEBUG net.liftweb.mapper.Schemifier - Executing DDL statements
15:54:37.073 [main] DEBUG net.liftweb.mapper.Schemifier - Running afterSchemifier on table users
15:54:37.074 [main] DEBUG net.liftweb.db.ProtoDBVendor - Released connection. poolSize=1
2013-03-12 15:54:37.153:INFO::Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 5 seconds.
</pre>

The application should be available at http://127.0.0.1:8080

## <a id='intro'></a>Deploying to Cloud Foundry ##

Deploying is as simple as creating a web archive with Maven and pushing the output with VMC;

<pre class="terminal">
$ mvn package
$ vmc push --path=./target/lift_hello_world-1.0.war
Name> lift-hello-world

Instances> 1

1: lift
2: other
Framework> lift

1: java
2: java7
3: other
Runtime> 1

1: 64M
2: 128M
3: 256M
4: 512M
5: 1G
6: 2G
7: 4G
8: 8G
9: 16G
Memory Limit> 512M

Creating lift-hello-world... OK

1: lift-hello-world.cloudfoundry.com
2: none
Domain> lift-hello-world.cloudfoundry.com

Updating lift-hello-world... OK

Create services for application?> n

Bind other services to application?> n

Save configuration?> n

Uploading lift-hello-world... OK
Starting lift-hello-world... OK
Checking lift-hello-world...
0/1 instances: 1 starting
0/1 instances: 1 starting
0/1 instances: 1 starting
1/1 instances: 1 running
OK
</pre>

In this example, the application was deployed to http://lift-hello-world.cloudfoundry.com

6 changes: 3 additions & 3 deletions source/docs/using/managing-apps/build-tools/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
title: Build Tools
---

Coming soon...
It is possible to deploy application using a couple of different JVM build tools, Maven and Gradle.

* Maven plugin
* [Maven plugin](./maven.html)

* Gradle plugin (unofficial)
* [Gradle plugin (unofficial)](./gradle.html)

66 changes: 66 additions & 0 deletions source/docs/using/managing-apps/build-tools/maven.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: Maven
---

## <a id='intro'></a>Introduction ##

Using the "cf-maven-plugin" plugin, it's possible to deploy an application directly from Maven. This is useful as it means being able to store the Cloud Foundry application manifest in pom.xml.

## <a id='install-the-plugin'></a>Install the plugin ##

Add the following to the plugins node of pom.xml;

~~~xml
<plugin>
<groupId>org.cloudfoundry</groupId>
<artifactId>cf-maven-plugin</artifactId>
<version>1.0.0.M4</version>
<configuration>
<server>mycloudfoundry-instance</server>
<target>http://api.cloudfoundry.com</target>
<url>hello-java-maven.cloudfoundry.com</url>
<framework>lift</framework>
<memory>256</memory>
</configuration>
</plugin>
~~~

Set the server name, the target address of the Cloud Foundry server, the intended url of the application and memory allocation.

Add the following to the pluginRepositories node;

~~~xml
<pluginRepository>
<id>repository.springframework.maven.milestone</id>
<name>Spring Framework Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</pluginRepository>
~~~

Create a file at ~/.m2/settings.xml or if the file exists, edit and add;

~~~xml

<settings>
...
<servers>
...
<server>
<id>mycloudfoundry-instance</id>
<username>demo.user@vmware.com</username>
<password>s3cr3t</password>
</server>
</servers>
...
</settings>
~~~

Set the server/id node to correspond to the server name set in the pom.xml file and also set the username and password for the desired account.

Then use maven to package and deploy!

<pre class="terminal">
$ mvn clean package
$ mvn cf:push
</pre>

2 changes: 1 addition & 1 deletion source/docs/using/managing-apps/ide/intellij.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Once the artifact has been added, configure the type, resource and services.

<img src="/images/intellij/config-artifact.png" />

## <a id='adding-a-configuration'></a>Deploying ##
## <a id='deploying'></a>Deploying ##

To deploy the application, select the relevant entry from the top of the "Run" menu. If the configuration was named "Production-CF" then the menu item will be captioned "Production-CF". The output pane of the "Run" tab should show output similar to that illustrated below;

Expand Down

0 comments on commit bf51427

Please sign in to comment.