Skip to content

pr-test-2 #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b451ebb
updated-readme
Jan 31, 2022
b22d408
feedbacks-added
Feb 9, 2022
f3b8619
feedbacks-added
Feb 9, 2022
d26ec1f
gif added
Feb 9, 2022
ae3bd18
gif added
Feb 9, 2022
ec99363
Merge pull request #1 from arushi09-hub/readme
pghildiyal Feb 9, 2022
49f06ea
fixes-readme
Feb 11, 2022
2ed3b4a
fixes-readme
Feb 11, 2022
70a6a33
Merge pull request #2 from arushi09-hub/readme-fixes
pghildiyal Feb 11, 2022
e7b56de
Added Video URL
gunish-dt Mar 7, 2022
4fd7094
Merge pull request #3 from gunish-dt/gunishReadme
prakarsh-dt Mar 7, 2022
351cf17
Update README.md
prakarsh-dt Apr 12, 2022
2546c36
Update README.md
prakarsh-dt Apr 12, 2022
2ded892
Update README.md
prakarsh-dt Apr 12, 2022
da3ba32
Update README.md
prakarsh-dt Apr 12, 2022
17489a3
Update app.js
pghildiyal Jan 2, 2023
4da167b
Updated dockerfile for multi-arch support
pawan-mehta-dt Feb 22, 2023
6a82412
Merge pull request #5 from devtron-labs/arm-builds
nishant-d Feb 22, 2023
dfde5ec
Update README.md
vivek-devtron Mar 31, 2023
042d04e
Update README.md
vikramdevtron Mar 31, 2023
5cee56a
added lock and modules
pghildiyal Apr 18, 2024
c6213a7
Create nginx.default
pghildiyal Aug 30, 2024
36358de
Update app.js
pghildiyal Aug 31, 2024
e372580
Update app.js
pghildiyal Aug 31, 2024
8a545e7
Update README.md
ajaydevtron Nov 12, 2024
ee7a5a7
Update app.js
tayalrishabh96 Dec 31, 2024
49c2d2e
Update app.js
tayalrishabh96 Dec 31, 2024
2357472
Merge pull request #13 from devtron-labs/logs-throttling-fix
pghildiyal Dec 31, 2024
06e3a73
Update app.js
tayalrishabh96 Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file added .DS_Store
Binary file not shown.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.wercker
node_modules
package-lock.json
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node

ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && echo $arch && wget https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${arch} -O /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]

Expand Down
86 changes: 69 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,100 @@
# getting-started-nodejs
Hii
> Check out this video on Youtube which demonstrates how to deploy this node.js microservice on a Kubernetes cluster using Devtron:
>
> [![Demo Video](https://user-images.githubusercontent.com/71125043/162990352-93313d53-0b06-4565-9ed6-a55750002942.png)](https://www.youtube.com/watch?v=9u-pKiWV-tM&t=2s)

[![wercker status](https://app.wercker.com/status/7b1a402dd00d57fc9abddf9eb5161675/s "wercker status")](https://app.wercker.com/project/bykey/7b1a402dd00d57fc9abddf9eb5161675)
ample application in Javascript on NodeJS for Wercker

This application uses the `node` container obtained from the [Docker Hub](https://hub.docker.com/_/node/)
This application uses the `node` container image obtained from the [Docker Hub](https://hub.docker.com/_/node/)

## Setup
lone this repo and cd into the directory:

Clone this repo and cd into the directory:

```
git clone https://github.com/wercker/getting-started-nodejs.git
git clone https://github.com/devtron-labs/getting-started-nodejs
cd getting-started-nodejs
```

## Running
You can run the sample app in a couple of different ways. The first is to simply launch the executable:
You can run the sample app while executing this command -

```
node app.js
```

Now point your browser at `http://localhost:8080` to see:

```
{"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo"]}
```

The second, and more useful, way is to use the `wercker dev` command to launch the binary within a Docker container, using the base image defined in the `box/id` property at the top of the `wercker.yml`, like so:
## Getting started with deploying application through Devtron

Lets see how to deploy a custom nodejs app through Devtron.
Make sure Global Configurations are successfully saved and validated before deploying your application.

**STEP 1**
Login into your Devtron Dashboard, Go to >> Applications >> Create new App. Give an appropriate name to this App, choose the project in which you want to keep the app, and create it.

**STEP 2**
After creating the app, setup the configurations. Copy the repo URL https://github.com/devtron-labs/getting-started-nodejs and paste it the Git repo section of your App. Click save and move to next config.

**STEP 3**
Now choose your Docker build config, the repository where you want to keep your CI build image. Select the container registry from the drop-down.

**STEP 4**
Coming up next is configuring the deployment template. As this is a very simple nodejs application we will be only covering the required the configs.

```
wercker dev --expose-ports
ContainerPort :
port : 8080
servicePort : 80
```
The `dev` target inside `wercker.yml` uses the `internal/watch` step to dynamically reload the runtime container when sourcefile changes are detected, which allows you to quickly test changes without having to kill/rebuild/relaunch the container. For instance, add another city to the array on `app.js:3' like so:

`8080` is the port number on which my nodejs application is running.

Set the resource limits & requests as given below -

```
var cities = {"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo","London"]}
resources:
limits:
cpu: "0.5"
memory: 50Mi
requests:
cpu: "0.1"
memory: 10Mi
```

and then refresh your browser pointing to `http://localhost:8080` to see:
Now, select the serviceType, keep it as `LoadBalancer`.

```
{"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo","London"]}}
service:
type: LoadBalancer
```

**STEP 5**
Now, create a CI/CD workflow for deploying this application. Select the type of pipeline & you can also add “Pre-build” “Post-build” & "Docker build" stages as well. Next add your CD pipeline, by choosing in which environment you want to deploy your app in.

**STEP 6**
You can add or create secrets or configmaps as per your requirement. These values will be automatically mounted with pods and made available as volumes or as env variables as per your selection.

**STEP 7**
That’s it, now trigger your CI pipeline by selecting the latest image and deploy it on your chosen project.

**STEP 8**
After the successful deployment, check out your service manifest for fetching the LoadBalancer URL from the dashboard present in the App Details section.

![](/gifs/fetching_loadbalancer.gif)

**STEP 9**
Use this URL on your browser and you can get the output as.

```
{"cities":["Amsterdam","Berlin","New York","San Francisco","Tokyo"]}
```

Find out a detailed documentation about the configurations from here - https://docs.devtron.ai/devtron/user-guide/creating-application

---
Sign up for Wercker: http://www.wercker.com

Learn more at: http://devcenter.wercker.com
17
18

12 changes: 9 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var text4 = text3+ " "+makeid(40);
var logs = ["i 1", "am 1", "here 1", "hello 1", "and 1", "you 1", "know 1", "who 1", "i 2", "am 2", "here 2", "hello 2", "hello 2", "and 2", "you 2", "know 2", "who 2", "i 3", "am 3", "here 3", "hello 3", "and 3", "hello 3", "and 3", "you 3", "know 3", "who 3", "i 4", "am 4", "here 4", "hello 4", "and 4", "we 4", "hello 4", "and 4", "you 4", "know 4", "who 4", "i 5", "am 5", "here 5", "hello 5", "or 5", "not 5", "and 5", "we 5", "hello 5", "and 5", "you 5", "know 5", "who 5", "i 6", "am 6", "here 6", "hello 6", "or 6", "not 6", "and 6", "hello 6", "and 6", "you 6", "know 6", "who 6", "i 7", "am 7", "here 7", "hello 7", "and 7", "we 7", "are 7", "here1 7", "hello 7", "and 7", "you 7", "know 7", "who 7", "i 8", "am 8", "here 8", "hello 8", "and 8", "we 8", "miss 8", "are 8", "here1 8", "hello 8", "and 8", "you 8", "know 8", "who 8"]
var i = 0
app.get('/', function(req, res){
console.log("received request");
res.writeHead(200, { 'Content-Type': 'application/json' });
res.write(JSON.stringify(cities));
res.end();
Expand All @@ -20,6 +21,11 @@ app.get('/health', (req, res) => res.send({"status": "OK", "time": new Date()}))
var port = process.env.PORT || 8080;
app.listen(port);

// setInterval(callback, delay, [arg1, arg2, ...])
// callback: The function to execute at each interval.
// delay: Time in milliseconds between each execution of the callback.
// arg1, arg2, ... (optional): Additional arguments passed to the callback function.

setInterval(function(str1, str2) {
var text = makeid(40);
var ran = Math.random()
Expand All @@ -29,11 +35,11 @@ setInterval(function(str1, str2) {
text = makeid(40)+ ""+makeid(40)+ ""+makeid(40)
else if (ran > 0.25)
text = makeid(40)+ ""+makeid(40)
//console.log(str1 + "" + str2 + "" + text+ "" +makeid(40) + "args2" + process.argv);
console.log(logs[i])
console.log(str1 + "" + str2 + "" + text+ "" +makeid(40));
//console.log(logs[i])
i++
if (i == logs.length) i = 0
}, 1, "Hello.", "How are you?");
}, 5000, "Hello.", "How are you?");

function makeid(length) {
var text = "";
Expand Down
21 changes: 0 additions & 21 deletions azure-pipelines-1.yml

This file was deleted.

21 changes: 0 additions & 21 deletions azure-pipelines.yml

This file was deleted.

56 changes: 0 additions & 56 deletions devtron-ci.yaml

This file was deleted.

Binary file added gifs/.DS_Store
Binary file not shown.
Binary file added gifs/fetching_loadbalancer.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions nginx.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# nginx.default

server {
listen 80;
listen [::]:80;
server_name *.devtron.info;
root /app;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:3000;
}

}
1 change: 1 addition & 0 deletions node_modules/.bin/_mocha

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/acorn

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/c8

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/express

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/generate-tap-test-class

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/glob

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/installed-package-contents

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/is-ci

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/jade

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/loose-envify

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/mime

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/mkdirp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/mocha

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/node-gyp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/node-which

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/nodeunit

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/nopt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/opener

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/pacote

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/rimraf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/semver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/sync-content

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tap-parser

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tap-run

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node-cwd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node-esm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node-script

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/ts-node-transpile-only

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tsc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tshy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/tsserver

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions node_modules/.bin/yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading