diff --git a/20160309-distelli-manifest.yml b/20160309-distelli-manifest.yml new file mode 100644 index 0000000..7ad1b0e --- /dev/null +++ b/20160309-distelli-manifest.yml @@ -0,0 +1,59 @@ +bmcgehee/example-node7: + # Distelli Manifest example + + PreBuild: + # Add any build pre-requisites here + #- echo "---PreBuild---" + + Build: + # Enter your build steps here! + - echo "---Building---" + - npm install + - echo "--Testing--" + - npm test + #- docker login -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" -e "$DISTELLI_DOCKER_EMAIL" "$DISTELLI_DOCKER_ENDPOINT" + #- docker build --quiet=false -t "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_PATH" + #- docker tag "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + #- docker push "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + + + PkgInclude: + - '*' + + ###Below is deployment phases + + Env: + # Set any environment variables in this section. + # These are available during all phases of a deploy. + - PORT: "3000" + - DISTELLI_INSTALLVIEW: "templates/notset.json" + + InstallTemplates: + - "views/index.jade" + + PreInstall: + # Use this section to install any deployment pre-requisites. + - echo "---PreInstall---" + #- sudo docker login --rm=true -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" -e "$DISTELLI_DOCKER_EMAIL" "$DISTELLI_DOCKER_ENDPOINT" + #- echo "--Installing deploy dependencies--" + - echo "-Updating apt-get-" + - sudo apt-get -y update + - echo "-Installing nodejs-" + - sudo apt-get -y install nodejs npm + #- curl --silent --location https://rpm.nodesource.com/setup | sudo bash - + #- sudo yum -y install nodejs + #- sudo yum -y groupinstall 'Development Tools' + + PostInstall: + - echo "---PostInstall---" + #- npm install + #- npm test + + Exec: + - nodejs app.js + #- sudo docker run "$DISTELLI_DOCKER_PORTS" --rm=true "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + + PostStart: + #- publicip=$(curl -s ident.me) + - 'echo "You can validate the install by pointing your browser at http://PUBLIC_IP:$PORT"' + diff --git a/2018-11-07-testing.txt b/2018-11-07-testing.txt new file mode 100644 index 0000000..e69de29 diff --git a/2018-11-07-testing2.txt b/2018-11-07-testing2.txt new file mode 100644 index 0000000..e69de29 diff --git a/2018-11-07-testing3.txt b/2018-11-07-testing3.txt new file mode 100644 index 0000000..e69de29 diff --git a/2018-11-07-testing4.txt b/2018-11-07-testing4.txt new file mode 100644 index 0000000..e69de29 diff --git a/2018-11-07-testing5.txt b/2018-11-07-testing5.txt new file mode 100644 index 0000000..e69de29 diff --git a/2018-11-07-testing6.txt b/2018-11-07-testing6.txt new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d8ee39a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:14.04 +RUN apt-get update -y +RUN sudo apt-get -y install nodejs +COPY . /src +EXPOSE 3000 +CMD ["nodejs", "/src/app.js"] diff --git a/README.md b/README.md index 59fc2a0..8620c33 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Getting Started Building and Deploying with Distelli - NodeJS Example +develop# Getting Started Building and Deploying with Distelli - NodeJS Example This tutorial will get you setup, building, testing, and deploying an application with Distelli in minutes. -The tutorial assumes you have already: +The tutorial assumes you have already: * [Created a free Distelli account](https://www.distelli.com/signup) * Have a login to, at least, one of the two public repositories. - https://github.com/ @@ -10,7 +10,7 @@ The tutorial assumes you have already: The scenario also expects that you have a **Destination** server available to do deployments of the example application. -### Step 1. Prepare Server for Deployment +### Step 1. Prepare Server for Deployment To enable auto deployment of an application you must have a destination server to deploy to. @@ -18,7 +18,7 @@ If you don't have a server you can use a virtual server. For a simple guide to s You must install the Distelli agent on the server to facilitate deployments. Instructions on installing the Distelli agent can be found here Distelli agent reference guide. -Install the agent and return to this document. +Install the agent and return to this document. ### Step 2. Fork and Clone the Repository @@ -77,30 +77,15 @@ For example if your username is 'YourUserName' your `distelli-manifest.yml` shou ``` YourUserName/nodejsbuilddeploy: - # Distelli Manifest example - # this example assumes the build and deploy servers are: - # Ubuntu 14.04 - - PreRelease: - - echo "---Beginning PreRelease---" - - echo "--Installing build dependencies--" - - echo "-Updating apt-get-" - - sudo apt-get -y update - - echo "-Installing nodejs-" - - sudo apt-get -y install nodejs - - echo "-Installing npm-" - - sudo apt-get -y install npm - - echo "--Building--" - - sudo npm install + Build: + - echo "---Building---" + - npm install - echo "--Testing--" - npm test PkgInclude: - '*' - PkgExclude: - - node_modules/ - PreInstall: - echo "---Begining PreInstall---" - echo "--Installing deploy dependencies--" @@ -108,18 +93,15 @@ YourUserName/nodejsbuilddeploy: - sudo apt-get -y update - echo "-Installing nodejs-" - sudo apt-get -y install nodejs - - echo "-Installing npm-" - - sudo apt-get -y install npm PostInstall: - echo "Begin PostInstall" - - npm install - + Env: - - PORT: 3000 - + - PORT: "3000" + Exec: - - /usr/bin/nodejs app.js + - nodejs app.js ``` **Save your change.** diff --git a/app.js b/app.js index 921696e..6d01680 100644 --- a/app.js +++ b/app.js @@ -2,7 +2,6 @@ var express = require('express'); var app = express(); var path = require('path'); var bodyParser = require('body-parser'); -var newRelic = require('newrelic'); var timeController = require('./controllers/time'); var homeController = require('./controllers/home'); diff --git a/distelli-manifest.yml b/distelli-manifest.yml index 7d45f4f..4c3aea7 100644 --- a/distelli-manifest.yml +++ b/distelli-manifest.yml @@ -1,49 +1,67 @@ -bmcghee/example-node: - # Distelli Manifest example - # this example assumes the build and deploy servers are: - # Ubuntu 14.04 +bmcgehee/example-node: + # Distelli Manifest example + + PreBuild: + # Add any build pre-requisites here + #- echo "---PreBuild---" + + #CommitData: + #- RepoType: Git + #- RepoPath: . Build: + #- echo "DD_USERNAME - $DISTELLI_DOCKER_USERNAME" + #- echo "DD_EMAIL - $DISTELLI_DOCKER_EMAIL" + #- echo "DD_ENDPOINT - $DISTELLI_DOCKER_ENDPOINT" + #- echo "DD_REPO - $DISTELLI_DOCKER_REPO" + + # Enter your build steps here! - echo "---Building---" - - set +e; source /etc/profile; set -e - - nvm install v4.2.1 - - npm install + - npm install - echo "--Testing--" - npm test - + #- docker login -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" -e "$DISTELLI_DOCKER_EMAIL" "$DISTELLI_DOCKER_ENDPOINT" + #- docker build --quiet=false -t "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_PATH" + #- docker tag "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + #- docker push "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + PkgInclude: - '*' - #PkgExclude: - #- node_modules/ + ###Below is deployment phases + + Env: + # Set any environment variables in this section. + # These are available during all phases of a deploy. + - PORT: "3000" + - DISTELLI_INSTALLVIEW: "templates/notset.json" + + InstallTemplates: + - "views/index.jade" - PreInstall: - - echo "---Begining PreInstall---" + PreInstall: + # Use this section to install any deployment pre-requisites. + - echo "---PreInstall---" + #- sudo docker login -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" -e "$DISTELLI_DOCKER_EMAIL" "$DISTELLI_DOCKER_ENDPOINT" - echo "--Installing deploy dependencies--" - echo "-Updating apt-get-" + - sudo apt-get -y clean - sudo apt-get -y update - echo "-Installing nodejs-" - sudo apt-get -y install nodejs - - echo "-Installing npm-" - - sudo apt-get -y install npm - - InstallTemplates: - - "views/index.jade" PostInstall: - - echo "Begin PostInstall" - #- npm install - - cp node_modules/newrelic/newrelic.js . - - sed -i "s|license key here|$NR_INSTALL_KEY|g" newrelic.js - - sed -i "s|My Application|$NR_APP_NAME|g" newrelic.js + - echo "---PostInstall---" - Env: - - PORT: "4000" - - DISTELLI_INSTALLVIEW="templates/notset.json" - - NR_INSTALL_SILENT: "TRUE" - - NR_APP_NAME: "NodeJS App" - - NR_INSTALL_KEY: "fc297ee8baef8312725cc134642ab4fce85a7666" - - PORT: "8000" - Exec: - - /usr/bin/nodejs app.js + - nodejs app.js + #- sudo docker run "$DISTELLI_DOCKER_PORTS" --rm=true "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + + PostStart: + - publicip=$(curl -s ident.me) || true + - 'echo "You can validate the install by pointing your browser at http://$publicip:$PORT"' + + + + + diff --git a/distelli_manifest.rh7.1.yml b/distelli_manifest.rh7.1.yml new file mode 100644 index 0000000..32336f8 --- /dev/null +++ b/distelli_manifest.rh7.1.yml @@ -0,0 +1,58 @@ +bmcgeheecap1/example-node: + # Distelli Manifest example + + PreBuild: + # Add any build pre-requisites here + #- echo "---PreBuild---" + + Build: + # Enter your build steps here! + #- echo "---Building---" + #- npm install + #- echo "--Testing--" + #- npm test + #- docker login -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" -e "$DISTELLI_DOCKER_EMAIL" "$DISTELLI_DOCKER_ENDPOINT" + #- docker build --quiet=false -t "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_PATH" + #- docker tag "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + #- docker push "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + + + PkgInclude: + - '*' + + ###Below is deployment phases + + Env: + # Set any environment variables in this section. + # These are available during all phases of a deploy. + - PORT: "3000" + - DISTELLI_INSTALLVIEW: "templates/notset.json" + + InstallTemplates: + - "views/index.jade" + + PreInstall: + # Use this section to install any deployment pre-requisites. + - echo "---PreInstall---" + #- sudo docker login --rm=true -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" -e "$DISTELLI_DOCKER_EMAIL" "$DISTELLI_DOCKER_ENDPOINT" + #- echo "--Installing deploy dependencies--" + #- echo "-Updating apt-get-" + #- sudo apt-get -y update + - echo "-Installing nodejs-" + #- sudo apt-get -y install nodejs + - curl --silent --location https://rpm.nodesource.com/setup | sudo bash - + - sudo yum -y install nodejs + - sudo yum -y groupinstall 'Development Tools' + + PostInstall: + - echo "---PostInstall---" + - npm install + - npm test + + Exec: + - node app.js + #- sudo docker run "$DISTELLI_DOCKER_PORTS" --rm=true "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" + + PostStart: + - publicip=$(curl -s ident.me) + - 'echo "You can validate the install by pointing your browser at http://$publicip:$PORT"' diff --git a/old_distelli-manifest.yml b/old_distelli-manifest.yml new file mode 100644 index 0000000..f9a7a94 --- /dev/null +++ b/old_distelli-manifest.yml @@ -0,0 +1,55 @@ +bmcgehee2/example-node: + # Distelli Manifest example + + PreBuild: + - echo "---Preparing for Build---" + - set +e; source /etc/profile; set -e + - nvm install v4.2.1 + + Build: + - echo "---NVM Use---" + - set +e; source ~/.nvm/nvm.sh; set -e + - nvm use v4.2.1 + - echo "---Building---" + - npm install + - cp node_modules/newrelic/newrelic.js . + - sed -i "s|license key here|$NR_INSTALL_KEY|g" newrelic.js + - sed -i "s|My Application|$NR_APP_NAME|g" newrelic.js + - echo "--Testing--" + - npm test + + PkgInclude: + - '*' + + PreInstall: + - echo "---Begining PreInstall---" + - echo "--Installing deploy dependencies--" + - echo "-Updating apt-get-" + - sudo apt-get -y update + - echo "-Installing nvm pre-requisites-" + - sudo apt-get -y install build-essential libssl-dev curl + - echo "-Installing nvm-" + - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.26.0/install.sh | bash + - set +e; source ~/.nvm/nvm.sh; set -e + - echo "-Installing nodejs-" + - nvm install v4.2.1 + + InstallTemplates: + - "views/index.jade" + + PostInstall: + - echo "Begin PostInstall" + + Env: + - DISTELLI_INSTALLVIEW: "templates/notset.json" + - NR_INSTALL_SILENT: "TRUE" + - NR_APP_NAME: "SET_THIS_IN_DISTELLI" + - NR_INSTALL_KEY: "SET_THIS_IN_DISTELLI" + - PORT: "8000" + + Exec: + - set +e; source ~/.nvm/nvm.sh; set -e + - nvm use v4.2.1 + - node app.js + + diff --git a/package.json b/package.json index 34f0130..5e1ae02 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "grunt": "^0.4.5", "jade": "^1.10.0", "nodemon": "^1.3.8", - "path": "^0.11.14", - "newrelic": "^1.20.0" + "path": "^0.11.14" } } diff --git a/test.20160514a b/test.20160514a new file mode 100644 index 0000000..e69de29 diff --git a/test.20160514a-2 b/test.20160514a-2 new file mode 100644 index 0000000..e69de29 diff --git a/test.develop b/test.develop new file mode 100644 index 0000000..e69de29 diff --git a/views/index.jade b/views/index.jade index 3ba6433..5b4fb59 100644 --- a/views/index.jade +++ b/views/index.jade @@ -8,10 +8,9 @@ html body #message {{#display_msg}} -
Running in the {{this_env}} environment
+Testing in the {{this_env}} environment AND THIS IS A TEST 2016-04-20
{{/display_msg}} #container h1 Just a Simple Node + Express App h1 #{date} a(href="https://www.distelli.com" target="_blank") Built and Deployed by Distelli -