Skip to content

Commit bbf8c80

Browse files
committed
Update README with ElephantSQL
1 parent d770452 commit bbf8c80

File tree

1 file changed

+84
-24
lines changed

1 file changed

+84
-24
lines changed

README.md

Lines changed: 84 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,137 @@
1-
# How to Run and Deploy the Java PostgreSQL Upload App #
1+
# How to Run and Deploy the Java ElephantSQL Upload App #
22

33
## Overview of the app ##
44

55
This is a Java app that uses the following cloud services:
66

7-
- PostgreSQL Database
7+
- ElephantSQL Database
88

9-
This app demonstrates how to connect to a PostgreSQL database on BlueMix from a Java app.
10-
Simply upload a line-separated file of text (e.g. tweets), and it will add each line to PostgreSQL database.
9+
This app demonstrates how to connect to an ElephantSQL database on BlueMix from a Java app.
10+
Simply upload a line-separated file of text (e.g. tweets), and it will add each line to the ElephantSQL database.
11+
This tutorial is intended to deploy a pre-compiled warfile through the command line. If you would like to
12+
use Eclipse and modify the source code, see [development](#development).
1113

1214
## Prerequisites ##
1315

1416
Before we begin, we first need to install the [**cf**](https://github.com/cloudfoundry/cli/releases) command line tool that will be used to upload and manage your application. If you've previously installed an older version of the cf tool, make sure you are now using v6 of cf by passing it the -v flag:
1517

1618
cf -v
17-
19+
1820
## Download ##
1921

22+
If you would like to modify the source code and work in development, see [development](#development).
23+
2024
Download the latest WAR file 'release' from https://github.com/ibmjstart/bluemix-java-postgresql-upload/releases
2125

22-
## Deploy to BlueMix and Binding the PostgreSQL Service via the Command Line Interface ##
26+
## Deploy to BlueMix and Binding the ElephantSQL Service via the Command Line Interface for Production##
2327

2428
From the command line, navigate to the directory of the app and run the following commands.
2529

2630
1. Login to Bluemix.
2731

32+
2833
| *usage:* | `$ cf login [-a API_URL] [-o ORG] [-s SPACE]`|
2934
|------------|:---------------------------------------------|
3035
| *example:* | `$ cf login -a https://api.ng.bluemix.net` |
3136

32-
2. Create an instance of the PostgreSQL service, giving it a unique name in the last argument. The application is written to assume that the service instance name will begin with "postgresql".
37+
2. Create an instance of the ElephantSQL service, giving it a unique name in the last argument. The application is written to assume that the service instance name will begin with "elephantsql".
38+
3339

3440
| *usage:* | `$ cf create-service SERVICE PLAN SERVICE_INSTANCE`|
3541
|------------|:---------------------------------------------------|
36-
| *example:* | `$ cf create-service postgresql 100 postgresql_JPU`|
42+
| *example:* | `$ cf create-service elephantsql turtle elephantsql_JEU`|
43+
44+
3. From the directory you placed your WAR file in, push the app with the -p flag to specify the WAR file
45+
path and the --no-start option so we can bind our required service before starting our app. Give your
46+
app a unique app name to be used as its hostname; for instance, if you replace `<YOUR-NAME>`
47+
with 'user1' then the example below would be hosted at http://jeu-user1.mybluemix.net.
3748

38-
3. From the directory you placed your WAR file in, push the app with the -p flag to specify the WAR file path and the --no-start option so we can bind our required service before starting our app. Give your app a unique app name to be used as its hostname; for instance, if you replace `<YOUR-NAME>` with 'user1' then the example below would be hosted at http://jpu-user1.ng.bluemix.net.
3949

4050
| *usage:* | `$ cf push APP [--no-manifest] [--no-start] [-p PATH]` |
4151
|------------|:----------------------------------------------------------------|
42-
| *example:* | `$ cf push jpu-<YOUR-NAME> -b https://github.com/cloudfoundry/java-buildpack --no-manifest --no-start -p PostgreSQLUpload.war`|
52+
| *example:* | `$ cf push jeu-<YOUR-NAME> -b https://github.com/cloudfoundry/java-buildpack --no-manifest --no-start -p ElephantSQL-Uploader.war`|
53+
54+
*Note* : `-p elephantSQL.war` assumes you are running these commands from within the same directory that
55+
this file resides.
4356

44-
*Note* : `-p PostgreSQLUpload.war` assumes you are running these commands from within the same directory that this file resides.
57+
4. Bind the elephantSQL service instance to the new app
4558

46-
4. Bind the postgreSQL service instance to the new app
4759

4860
| *usage:* | `$ cf bind-service APP SERVICE_INSTANCE`|
4961
|------------|:----------------------------------------|
50-
| *example:* | `$ cf bind-service jpu-<YOUR-NAME> postgresql_JPU`|
62+
| *example:* | `$ cf bind-service jeu-<YOUR-NAME> elephantsql_JEU`|
5163

5264
5. Start the app
5365

66+
5467
| *usage:* | `$ cf start APP`|
5568
|------------|:----------------|
56-
| *example:* | `$ cf start jpu-<YOUR-NAME>`|
57-
58-
## Import the App into Eclipse ##
69+
| *example:* | `$ cf start jeu-<YOUR-NAME>`|
70+
71+
## <a name="development"></a>Import the App into Eclipse for Development ##
72+
73+
To view and edit the application, simply import the project into Eclipse. If you don't have an Eclipse instance with Java EE support, you may download it from http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunar
5974

60-
To view and edit the application, simply import the project into Eclipse. If you don't have an Eclipse instance with Java EE support, you may download it from https://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/keplersr2
75+
### Download the Source Code ###
6176

62-
Once you have Eclipse running, you can Import the WAR file as a new project via
77+
Once you have Eclipse running, you can Import the WAR file as a new project via (this does not give access to the source code, as it is already compiled into the war.)
6378
1. File->Import...
6479
2. Scroll down to the "Web" section, expand that section and click WAR File then click Next.
6580
3. Deselect the 'Add project to an EAR' checkbox
6681
4. Click next and then Finish and the project should be imported into Eclipse
6782

68-
Now that you have the project in Eclipse, you can edit the source and re-deploy to BlueMix by either:
69-
83+
If you would like to edit the source code of the project, you will have to clone the git URL.
84+
85+
1. Open Eclipse
86+
2. Select File->Import
87+
3. Under the header labeled "Git", click "Projects from Git" and click `Next`
88+
4. Select `Clone URI` and click `Next`
89+
5. Copy paste the git clone URL into the next page. Hit `Next`
90+
6. Select the Branch to clone (you should only need Master). Click `Next`
91+
7. Name the destination directory. click `Next`
92+
8. Check `Import Existing Projects` and click `Next`
93+
9. Check the project, and click `Finish`
94+
95+
### Modify the Source Code and Deploy to Bluemix ###
96+
97+
With access to the source code, you may modify the application, add functionality, or deploy it straight
98+
to Bluemix. When you push source code to Bluemix, Eclipse first compiles it into a war file, and then
99+
pushes that war file to Bluemix. Alternatively, you may select File->Export and export the war file. Then,
100+
you may push the war file using the same methods above.
101+
102+
Now that you have the project in Eclipse, and have modified the source code, re-deploy to BlueMix by either:
103+
70104
A. Exporting your updated project as a WAR file and push it from the command line as before
71-
72-
-OR-
73-
74-
B. Installing the [Eclipse Cloud Foundry Plugin](https://marketplace.eclipse.org/content/cloud-foundry-integration-eclipse), defining the BlueMix endpoint (https://api.ng.bluemix.net), and deploying your application right from Eclipse.
105+
106+
-OR-
107+
108+
B. Installing the [IBM Eclipse Tools for Bluemix Plugin](http://marketplace.eclipse.org/content/ibm-eclipse-tools-bluemix#.VAiRPbywIRI),
109+
defining the BlueMix endpoint (https://api.ng.bluemix.net), and deploying your application right from Eclipse. To deploy to Bluemix:
110+
111+
112+
#### • Set up Bluemix Server ####
113+
114+
Make sure you are in the Java EE [perspective](http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Fconcepts%2Fconcepts-4.htm) in Eclipse.
115+
116+
1. In the bottom window section, select the **Servers** tab. (Alternatively, you can click: `Window > Show View > Servers`)
117+
2. Right-Click inside the Servers panel and select `New > Server`
118+
3. Select, `IBM > IBM Bluemix` and click `Next`.
119+
4. Enter your login information for Bluemix in the email and password sections.
120+
5. From the URL dropdown menu, choose: `IBM Bluemix`
121+
6. Hit `Next` and Bluemix will automatically validate your account credentials.
122+
7. Optional: Select the Organization within your Bluemix account that you would like to deploy to.
123+
8. Click: Finish
124+
125+
#### • Push the app ####
126+
1. Right-Click on the Bluemix server and click: `Connect` (Optional)
127+
2. Right-Click on the Bluemix server and select: `Add and Remove...`
128+
3. Select your ElephantSQL project from the window on the left and click: `Add >`
129+
4. Click: `Finish`
130+
5. Enter a Name for your app and select: `Next`
131+
6. Specify a unique subdomain for your application. Similar to the command line tools, you can pick
132+
something like <jeu-yourUser> so that your app is located at `http://jeu-yourUser.mybluemix.net`. Hit `Next`
133+
7. Create and bind the elephantSQL service by selecting either an existing elephantSQL service or creating one by selecting the icon in the top right. Search for ElephantSQL, and you can bind the application through the plugin GUI.
134+
8. Hit `Next` and `Finish`. Your app should deploy to Bluemix and be available at the URL you gave it. This can be viewed in the ACE UI.
75135

76136
## License ##
77137
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

0 commit comments

Comments
 (0)