initial sample code push
parents
Showing
.cfignore
0 → 100644
.gitignore
0 → 100644
Dockerfile
0 → 100644
LICENSE
0 → 100644
README-kubernetes.md
0 → 100644
| # Deploy to IBM Cloud Kubernetes Service | ||
| Follow these instructions to deploy this application to a Kubernetes cluster and connect it with a Cloudant database. | ||
| ## Download | ||
| ```bash | ||
| git clone https://github.com/IBM-Cloud/get-started-node | ||
| cd get-started-node | ||
| ``` | ||
| ## Build Docker Image | ||
| 1. Find your container registry **namespace** by running `ibmcloud cr namespaces`. If you don't have any, create one using `ibmcloud cr namespace-add <name>` | ||
| 2. Identify your **Container Registry** by running `ibmcloud cr info` (Ex: registry.ng.bluemix.net) | ||
| 3. Build and tag (`-t`)the docker image by running the command below replacing REGISTRY and NAMESPACE with he appropriate values. | ||
| ```sh | ||
| docker build . -t <REGISTRY>/<NAMESPACE>/myapp:v1.0.0 | ||
| ``` | ||
| Example: `docker build . -t registry.ng.bluemix.net/mynamespace/myapp:v1.0.0` | ||
| 4. Push the docker image to your Container Registry on IBM Cloud | ||
| ```sh | ||
| docker push <REGISTRY>/<NAMESPACE>/myapp:v1.0.0 | ||
| ``` | ||
| ## Deploy | ||
| #### Create a Kubernetes cluster | ||
| 1. [Creating a Kubernetes cluster in IBM Cloud](https://console.bluemix.net/docs/containers/container_index.html#clusters). | ||
| 2. Follow the instructions in the Access tab to set up your `kubectl` cli. | ||
| #### Create a Cloudant Database | ||
| 1. Go to the [Catalog](https://console.bluemix.net/catalog/) and create a new [Cloudant](https://console.bluemix.net/catalog/services/cloudant-nosql-db) database instance. | ||
| 2. Choose `Legacy and IAM` for **Authentication** | ||
| 3. Create new credentials under **Service Credentials** and copy value of the **url** field. | ||
| 4. Create a Kubernetes secret with your Cloudant credentials. | ||
| ```bash | ||
| kubectl create secret generic cloudant --from-literal=url=<URL> | ||
| ``` | ||
| Example: | ||
| ```bash | ||
| kubectl create secret generic cloudant --from-literal=url=https://username:[email protected] | ||
| ``` | ||
| #### Create the deployment | ||
| 1. Replace `<REGISTRY>` and `<NAMESPACE>` with the appropriate values in `kubernetes/deployment.yaml` | ||
| 2. Create a deployment: | ||
| ```shell | ||
| kubectl create -f kubernetes/deployment.yaml | ||
| ``` | ||
| - **Paid Cluster**: Expose the service using an External IP and Loadbalancer | ||
| ``` | ||
| kubectl expose deployment get-started-node --type LoadBalancer --port 8080 --target-port 8080 | ||
| ``` | ||
| - **Free Cluster**: Use the Worker IP and NodePort | ||
| ```bash | ||
| kubectl expose deployment get-started-node --type NodePort --port 8080 --target-port 8080 | ||
| ``` | ||
| ### Access the application | ||
| Verify **STATUS** of pod is `RUNNING` | ||
| ```shell | ||
| kubectl get pods -l app=get-started-node | ||
| ``` | ||
| **Standard (Paid) Cluster:** | ||
| 1. Identify your LoadBalancer Ingress IP using `kubectl get service get-started-node` | ||
| 2. Access your application at t `http://<EXTERNAL-IP>:8080/` | ||
| **Free Cluster:** | ||
| 1. Identify your Worker Public IP using `ibmcloud cs workers YOUR_CLUSTER_NAME` | ||
| 2. Identify the Node Port using `kubectl describe service get-started-node` | ||
| 3. Access your application at `http://<WORKER-PUBLIC-IP>:<NODE-PORT>/` | ||
| ## Clean Up | ||
| ```bash | ||
| kubectl delete deployment,service -l app=get-started-node | ||
| kubectl delete secret cloudant | ||
| ``` |
README.md
0 → 100644
README_MONGO.md
0 → 100644
kubernetes/deployment.yaml
0 → 100644
manifest.yml
0 → 100644
package-lock.json
0 → 100644
This diff is collapsed.
package.json
0 → 100644
| { | ||
| "name": "get-started-node", | ||
| "main": "server.js", | ||
| "description": "An introduction to developing Node.js apps on the IBM Cloud platform", | ||
| "version": "0.1.1", | ||
| "private": false, | ||
| "engines": { | ||
| "node": "10.*" | ||
| }, | ||
| "scripts": { | ||
| "start": "node server.js" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/IBM-Cloud/get-started-node" | ||
| }, | ||
| "dependencies": { | ||
| "@cloudant/cloudant": "^3.0.2", | ||
| "body-parser": "^1.17.x", | ||
| "cfenv": "^1.0.x", | ||
| "dotenv": "^4.0.0", | ||
| "express": "^4.15.x", | ||
| "mongodb": "^3.0.10" | ||
| }, | ||
| "author": "IBM Corp", | ||
| "license": "Apache-2.0" | ||
| } |
server.js
0 → 100644
vcap-local.example.json
0 → 100644
views/antixss.js
0 → 100644
views/index.html
0 → 100644
-
Maintainer
IBM Cloud toolchain: Delivery Pipeline deployed saschaStarter to saschaDev, including this commit
Please register or sign in to comment