-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nodejs): Add deploy config for nodejs (#1137)
* feat(nodejs): Add node js and docker deploy config
- Loading branch information
1 parent
ce58007
commit cc4102a
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
test/deploy/linux/nodejs/redhat/roles/configure/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
- debug: | ||
msg: Install Nodejs and docker | ||
|
||
- name: update yum packages | ||
shell: yum update -y | ||
become: true | ||
|
||
- name: install docker | ||
shell: yum install docker | ||
become: true | ||
|
||
- name: RHEL - Start docker service | ||
shell: "service docker start" | ||
|
||
# - name: RHEL - Granting permissions to docker from ec2-user | ||
# shell: "usermod -a -G docker ec2-user" | ||
|
||
# - name: Install Node.js | ||
# shell: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | ||
# become: true | ||
|
||
# - name: load nvm | ||
# shell: source ~/.bashrc | ||
|
||
# - name: install node.js 20.5.1 | ||
# shell: nvm install 20.5.1 | ||
|
||
# - name: set node.js version 20.5.1 as default | ||
# shell: nvm alias default 20.5.1 | ||
|
||
# - name: Create node.js app directory | ||
# file: | ||
# path: /home/ec2-user/myNodeApp | ||
# state: directory | ||
|
||
# - name: Copy files to myNodeApp directory | ||
# synchronize: | ||
# src: "{{ item }}" | ||
# dest: /home/ec2-user/myNodeApp | ||
# mode: push | ||
# with_fileglob: | ||
# - "../../../../templates/*" | ||
# become: true | ||
|
||
# - name: create package.json | ||
# shell: cd /home/ec2-user/myNodeApp && npm init -y | ||
# become: true | ||
|
||
# - name: install express | ||
# shell: cd /home/ec2-user/myNodeApp && npm install express | ||
# become: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Dockerfile | ||
|
||
FROM node | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
# Install app dependencies | ||
COPY package*.json ./ | ||
RUN npm install | ||
|
||
# Bundle app source | ||
COPY . . | ||
|
||
# Expose the port the app runs on | ||
EXPOSE 3030 | ||
|
||
# Command to run the application | ||
CMD [ "node", "index.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// index.js | ||
|
||
// Load the New Relic agent before anything else | ||
require('newrelic'); | ||
|
||
const express = require('express'); | ||
const app = express(); | ||
const PORT = process.env.PORT || 3030; | ||
|
||
// Simple route for testing | ||
app.get('/', (req, res) => { | ||
res.send('Hello World! This is my Node.js app instrumented with New Relic.'); | ||
}); | ||
|
||
// Start the server | ||
app.listen(PORT, () => { | ||
console.log(`Server is running on http://localhost:${PORT}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"global_tags": { | ||
"owning_team": "virtuoso", | ||
"Environment": "development", | ||
"Department": "product", | ||
"Product": "virtuoso" | ||
}, | ||
"resources": [ | ||
{ | ||
"id": "node-js-docker", | ||
"provider": "aws", | ||
"type": "ec2", | ||
"size": "t2.medium", | ||
"ami_name": "amzn2-ami-hvm-2.0.????????.?-x86_64-gp2", | ||
"user_name": "ec2-user" | ||
} | ||
], | ||
"services": [ | ||
{ | ||
"id": "nodejs", | ||
"source_repository": "https://github.com/newrelic/open-install-library.git", | ||
"deploy_script_path": "test/deploy/linux/nodejs/redhat/roles", | ||
"port": 8080, | ||
"destinations": [ | ||
"node-js-docker" | ||
] | ||
} | ||
] | ||
} |