Skip to content

Commit 2ea1ce5

Browse files
committed
Updated Node.js engine version and updated README.md to incorporate the deploy to Bluemix button.
1 parent 41dd934 commit 2ea1ce5

File tree

4 files changed

+32
-63
lines changed

4 files changed

+32
-63
lines changed

README.md

Lines changed: 28 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,54 @@
1-
# How to Run and Deploy the Node MySQL Upload App #
1+
# Overview of the App #
2+
3+
This is a Node.js app that uses the following cloud services:
4+
5+
- MySQL Database
6+
7+
This app demonstrates how to connect to a MySQL database on IBM BlueMix from a Node.js app.
8+
Simply upload a line-separated file of text (e.g. tweets), and it will add each line to MySQL.
9+
10+
Give it a try! Click the button below to fork into IBM DevOps Services and deploy your own copy of this application on Bluemix.
11+
12+
[![Deploy to Bluemix](images/deploy-button.png)](https://hub.jazz.net/code/cfui/bluemix/deploy.html?Repository=https://github.com/ibmjstart/bluemix-node-mysql-uploader.git)
13+
14+
Enjoy! (note, it may take minute or so for the app to start)
15+
16+
___
17+
18+
### [Alternative] Deploying the App Via the Command-Line ###
219

3-
## Overview of the app ##
4-
5-
This is a NodeJS app that uses the following cloud services:
6-
7-
- MySQL Database
8-
9-
This app demonstrates how to connect to a MySQL database on codename: BlueMix from a NodeJS app.
10-
Simply upload a line-separated file of text (e.g. tweets), and it will add each line to MySQL.
11-
12-
## Deploying the App and Binding the MySQL Service ##
13-
Multiple methods exist for interacting with the BlueMix platform. Outlined below are two of those methods:
14-
15-
1. [Command-Line](#method-command-line)
16-
2. [IBM JazzHub](#method-ibm-jazzhub)
17-
18-
### Method: Command-Line ###
1920
#### Prerequisites ####
2021

2122
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:
2223

2324
cf -v
2425

2526
#### Steps ####
26-
In the terminal, go into the directory named **app**, and follow these steps.
27+
In the terminal, go into the root directory, and follow these steps.
2728

2829
1. Login to Bluemix.
2930

3031
| *usage:* | `$ cf login [-a API_URL] [-o ORG] [-s SPACE]`|
3132
|------------|----------------------------------------------|
3233
| *example:* | `$ cf login -a https://api.ng.bluemix.net` |
3334

34-
2. Create an instance of the mySQL service, giving it a unique name in the last arguement.
35+
2. Create an instance of the mySQL service, giving it the name "mysql-database" in the last arguement. Note, if a different name is desired, then the manifest.yml file needs to be changed accordingly.
3536

3637
| *usage:* | `$ cf create-service SERVICE PLAN SERVICE_INSTANCE`|
3738
|------------|----------------------------------------------------|
38-
| *example:* | `$ cf create-service mysql 100 mysql_NMU` |
39+
| *example:* | `$ cf create-service mysql 100 mysql-database` |
3940

40-
3. **From the directory that houses the _app.js_ file** (not from the root directory that contains this *README.md* file), push the app with the --no-start option so we can bind our required service before starting. Pass the -c flag to specify the start command that should be used by CloudFoundry to run your app. Be sure to give your app a unique app name to be used for its hostname; for instance the example below would result in http://myupload-<username>.ng.bluemix.net.
41+
3. From the root directory that contains this *README.md* file, push the app like below. Be sure to give your app a unique APP_NAME to be used for its hostname. For instance the example below would result in http://myupload-&lt;username&gt;.ng.bluemix.net.
4142

42-
| *usage:* | `$ cf push APP [--no-manifest] [--no-start] [-c COMMAND]` |
43-
|------------|--------------------------------------------------------------------------|
44-
| *example:* | `$ cf push myupload-<username> --no-manifest --no-start -c "node app.js"` |
45-
46-
4. Bind the MySQL service instance to the new app
47-
48-
| *usage:* | `$ cf bind-service APP SERVICE_INSTANCE`|
49-
|------------|-----------------------------------------|
50-
| *example:* | `$ cf bind-service myupload-<username> mysql_NMU` |
51-
52-
5. Start the app
53-
54-
| *usage:* | `$ cf start APP` |
43+
| *usage:* | `$ cf push APP_NAME` |
5544
|------------|----------------------------------|
56-
| *example:* | `$ cf start myupload-<username>` |
57-
58-
59-
### Method: IBM JazzHub ###
60-
1. Browse to the JazzHub project repository located [here](https://hub.jazz.net/project/jstart/MySQL%20Upload%20App%20(Node)/overview). Click on **Edit Code** for the project.
61-
2. Click on "Fork". This will provide you with a personal copy of the code within your JazzHub project space.
62-
63-
![image](images/forkProject.png)
64-
65-
3. Located in the **app** directory of the project, rename **manifest.yml.v5** to **manifest.yml**
66-
67-
![image](images/RenameManifest.png)
68-
69-
4. Next, click on "Deploy". This will use information within the **manifest.yml** to deploy the sample application directly into the codename: BlueMix platform.
70-
71-
![image](images/Deploy.png)
72-
73-
You may continue to deploy changes to your BlueMix application directly from JazzHub using the "Deploy" and "Deploy As" buttons.
74-
75-
5. Next, click on the Root Project Name and scroll to the **Manual Deployment Information** section.
76-
77-
![image](images/Manage.png)
78-
79-
You can check the status of the app using this section. If a green filled circle is visible, you may click the Application Name shown within the section and interact with the running application. However, if a red filled circle is displayed, you may click **Manage** and directly interact with the BlueMix User interface for further investigation and debugging.
45+
| *example:* | `$ cf push myupload-<username>` |
8046

47+
Congratulations, the app should be running on Bluemix.
48+
49+
___
8150

82-
## License ##
51+
### License ###
8352
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
8453

8554
http://www.apache.org/licenses/LICENSE-2.0

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "twitter-search",
33
"version": "0.0.1",
44
"engines": {
5-
"node": "0.8.x"
5+
"node": "0.10.x"
66
},
77
"scripts": {
88
"start": "node app.js"

images/deploy-button.png

1.76 KB
Loading
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
declared-services:
3-
mysql-node-upload:
3+
mysql-database:
44
type: mysql
55
plan: '100'
66

77
applications: #Reference http://docs.cloudfoundry.com/docs/using/deploying-apps/manifest.html
88
- name: NodeMySQLUpload #Application Name. Unique to the user's Space
99
memory: 256M #The maximum memory to allocate to each application instance
1010
instances: 1 #The number of instances of the application to start
11-
path: . #Path to the application to be pushed
11+
path: ./app/ #Path to the application to be pushed
1212
command: node app.js #The command to use to start the application
1313
services:
14-
- mysql-node-upload #Identifier for MySQL Bound Service instance
14+
- mysql-database #Identifier for MySQL Bound Service instance
1515

0 commit comments

Comments
 (0)