Skip to content

Commit 1850086

Browse files
Merge pull request #25 from IBM-Cloud/icd-mongoDB
Update code to use ICD for MongoDB
2 parents 9d79c71 + 2262223 commit 1850086

File tree

8 files changed

+1458
-51
lines changed

8 files changed

+1458
-51
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ SESSION_SECRET=
33

44
# URL for your local mongodb installation. The below value is likely correct unless you setup your MongoDB configuration differently.
55
LOCAL_MONGODB_URL=mongodb://localhost:27017
6+
# Certificate - needed for connecting to IBM Cloud Databases for MongoDB
7+
CERTIFICATE_BASE64=
8+
PORT=6001
9+
BIND=0.0.0.0

Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM node:8
2+
3+
# Create app directory
4+
RUN mkdir /src
5+
WORKDIR /src
6+
7+
8+
9+
# If you are building your code for production
10+
# RUN npm ci --only=production
11+
12+
COPY ./package*.json /src/
13+
14+
RUN npm install
15+
16+
# Bundle app source
17+
COPY ./server /src/server
18+
COPY ./public /src/public
19+
COPY ./server.js /src/server.js
20+
COPY ./.env /src/.env
21+
22+
23+
EXPOSE 6001
24+
CMD [ "npm", "start" ]

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
# Modern Web Application using MEAN stack
22

3-
This is a basic boilerplate for the MEAN stack ([MongoDB](https://www.mongodb.org/), [Express](http://expressjs.com/), [AngularJS](https://angularjs.org/) and [Node.js](https://nodejs.org)) on [IBM Cloud](http://bluemix.net).
3+
This is a basic boilerplate for the MEAN stack ([MongoDB](https://www.mongodb.org/), [Express](http://expressjs.com/), [AngularJS](https://angularjs.org/) and [Node.js](https://nodejs.org)) on [IBM Cloud](https://cloud.ibm.com).
44

5-
This application uses the [Compose for MongoDB service](https://console.bluemix.net/catalog/services/compose-for-mongodb) and [Node.js runtime](https://www.ng.bluemix.net/docs/starters/nodejs/index.html) on IBM Cloud.
5+
This application uses the [IBM Cloud Databases for MongoDB service](https://cloud.ibm.com/catalog/services/databases-for-mongodb) and [Node.js runtime](https://cloud.ibm.com/docs/runtimes/nodejs?topic=Nodejs-nodejs_runtime) on IBM Cloud.
66

7-
<img src="ReadME-Images/Architecture2.png">
7+
<img src="ReadME-Images/Architecture.png">
88

99
#### Features
1010
- MVC project structure
1111
- Create, edit and delete user accounts
1212
- Authentication with username/password
1313
- Protected routes that can only be accessed by authenticated users
1414
- Bootstrap CSS framework & [Cosmo theme](https://bootswatch.com/cosmo/)
15-
- HTTPS built-in if deployed to [IBM Cloud](#deploy-to-bluemix)
15+
- HTTPS built-in if deployed to [IBM Cloud](#deploy-to-ibm-cloud)
1616
- [Mongoose](https://github.com/Automattic/mongoose) for MongoDB interactions.
1717
- [PassportJS](http://passportjs.org) for authentication, with over 300 authentication strategies to pick from.
1818

1919
## Application Requirements
2020
- [Node.js & NPM](https://nodejs.org/en/download/)
21-
- [Compose for MongoDB database](https://console.bluemix.net/catalog/compose-for-mongodb)
21+
- [IBM Cloud Databases for MongoDB](https://cloud.ibm.com/catalog/services/databases-for-mongodb)
2222
- [Cloud Foundry Command Line Tool](https://docs.cloudfoundry.org/devguide/installcf/)
2323

2424
## Getting Started
@@ -31,35 +31,38 @@ This application uses the [Compose for MongoDB service](https://console.bluemix.
3131
6. Run `node server.js` to start your app
3232
7. Open a browser to the link provided in the terminal prompt to view your app
3333

34+
Note that the code assumes a secured connection to MongoDB using SSL and a certificate. This way you can run the app locally but connect to IBM Cloud Databases for MongoDB.
35+
36+
An alternative way of local development is using the provided Dockerfile.
37+
3438
##### Deploy to IBM Cloud
3539

3640
Option 1 (launch this app directly from this repo):
3741

38-
[![Deploy to Bluemix](https://bluemix.net/deploy/button.png)](https://bluemix.net/deploy?repository=https://github.com/IBM-Bluemix/Nodejs-MEAN-Stack)
42+
[![Deploy to IBM Cloud](https://cloud.ibm.com/devops/setup/deploy/button.png)](https://cloud.ibm.com/devops/setup/deploy?repository=https://github.com/IBM-Cloud/nodejs-MEAN-stack)
3943

4044
Option 2 (deploy from your local machine):
4145

4246
1. Clone or download this repo onto your machine.
4347
2. Open a terminal prompt to the directory of your application.
44-
3. If you don't have an account, [create a free one here](https://console.ng.bluemix.net/registration/).
45-
4. Set your Cloud Foundry CLI tool's API endpoint to: `ibmcloud api https://api.ng.bluemix.net `
46-
5. Login to your account via the command line: `ibmcloud login`
47-
6. Target your account ORG and SPACE `ibmcloud target -o ORG -s SPACE`
48-
7. Create the instance of Compose for MongoDB on IBM Cloud: `ibmcloud cf create-service compose-for-mongodb Standard mean-starter-mongodb`
49-
8. Push your app to IBM Cloud with `ibmcloud cf push`
50-
9. Done, the app should be looking like:<img src="ReadME-Images/live-app.png">
48+
3. If you don't have an account, [create a free one here](https://cloud.ibm.com).
49+
4. Login to your account via the command line: `ibmcloud login`
50+
5. Target your account ORG and SPACE `ibmcloud target --cf`
51+
6. Create the instance of Compose for MongoDB on IBM Cloud: `ibmcloud cf create-service databases-for-mongodb standard mean-starter-mongodb`
52+
7. Push your app to IBM Cloud with `ibmcloud cf push`
53+
8. Done, the app should be looking like:<img src="ReadME-Images/live-app.png">
5154

5255

5356

5457
#### Problems or Questions?
5558

56-
Create a [GitHub issue](https://github.com/IBM-Bluemix/nodejs-MEAN-stack/issues/new) for questions or problems occurs using this demo.
59+
Create a [GitHub issue](https://github.com/IBM-Cloud/nodejs-MEAN-stack/issues/new) for questions or problems occurs using this demo.
5760

5861
## Critical Files & Folders
5962

6063
| File | Description |
6164
| ---------------------------------- | ------------------------------------------------------------ |
62-
| [**manifest.yml**](./manifest.yml) | File that defines deployment paramaters. [More info here](https://www.ng.bluemix.net/docs/manageapps/depapps.html#appmanifest)
65+
| [**manifest.yml**](./manifest.yml) | File that defines deployment paramaters. [More info here](http://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html)
6366
| [**.env.example**](./.env.example) | Set custom [environment variables](https://en.wikipedia.org/wiki/Environment_variable) for your application. This is the proper way to store credentials and other sensitive values.
6467
| [**server.js**](./server.js) | Main server file that the Node.js runtime uses. It contains all the server logic.
6568
| [**/server**](./server) | Folder for files used by the Node.js server
@@ -92,7 +95,7 @@ If you are not sure what your application name is, use this command to print you
9295
$ ibmcloud cf apps
9396
```
9497

95-
For more detailed information on troubleshooting your application, see the [Troubleshooting section](https://www.ng.bluemix.net/docs/troubleshoot/tr.html) in the documentation.
98+
For more detailed information on troubleshooting your application, see the [Troubleshooting section](https://cloud.ibm.com/docs/cloud-foundry-public?topic=cloud-foundry-public-ts-cf-apps) in the documentation.
9699

97100
## License
98-
See [LICENSE.MD](https://github.com/IBM-Bluemix/Nodejs-MEAN-Stack/blob/master/LICENSE.md) for license information.
101+
See [LICENSE.MD](https://github.com/IBM-Cloud/nodejs-MEAN-stack/blob/master/LICENSE.md) for license information.

ReadME-Images/Architecture.png

-25.3 KB
Loading

manifest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
applications:
33
- name: mean-stack
4-
host: mean-${random-word}
4+
random-route: true
55
memory: 256M
66
services:
77
- mean-starter-mongodb
88
env:
99
NODE_ENV: cloud-foundry
1010
declared-services:
1111
mean-starter-mongodb:
12-
label: compose-for-mongodb
13-
plan: Standard
12+
label: databases-for-mongodb
13+
plan: standard

0 commit comments

Comments
 (0)