-
Notifications
You must be signed in to change notification settings - Fork 57
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
fix(nodejs) : Fixed nodejs deployer scripts #1161
base: main
Are you sure you want to change the base?
Conversation
# create a sample Dockerfile | ||
- name: Create a sample Dockerfile | ||
copy: | ||
content: | | ||
FROM node:18 | ||
WORKDIR /app | ||
COPY . /app | ||
RUN npm install | ||
EXPOSE 3000 | ||
CMD ["node", "app.js"] | ||
dest: "/home/{{ ansible_user }}/myNodeApp/Dockerfile" | ||
mode: "0644" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good overall! For better readability, I was wondering if we could exclude the Dockerfile
and sample application example changes from main.yml
and move them under templates
directory, similar to the existing structure for NodeJS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @Nandu-pns the suggested changes are done!!
- name: Create sample Node.js application | ||
copy: | ||
content: | | ||
const http = require('http'); | ||
|
||
# - name: set node.js version 20.5.1 as default | ||
# shell: nvm alias default 20.5.1 | ||
const hostname = '127.0.0.1'; | ||
const port = 3000; | ||
|
||
# - name: Create node.js app directory | ||
# file: | ||
# path: /home/ec2-user/myNodeApp | ||
# state: directory | ||
const server = http.createServer((req, res) => { | ||
res.statusCode = 200; | ||
res.setHeader('Content-Type', 'text/plain'); | ||
res.end('Hello, Node.js!\n'); | ||
}); | ||
|
||
# - name: Copy files to myNodeApp directory | ||
# synchronize: | ||
# src: "{{ item }}" | ||
# dest: /home/ec2-user/myNodeApp | ||
# mode: push | ||
# with_fileglob: | ||
# - "../../../../templates/*" | ||
# become: true | ||
server.listen(port, hostname, () => { | ||
console.log(`Server running at http://${hostname}:${port}/`); | ||
}); | ||
dest: "/home/{{ ansible_user }}/myNodeApp/app.js" | ||
mode: "0644" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same applies here as well.
https://github.com/newrelic/open-install-library/pull/1161/files#r1958171757
Fixed the Node.js deployer scripts to support both Docker and Linux on-host installation flows.
Ansible playbook validation

Docker
NodeJs Docker Based Instrumentation:-
Ansible playbbok validation for OnHost

NodeJs OnHost Linux Based Instrumentation:-
More informations can be found in JIRA ticket