Skip to content

Instantly share code, notes, and snippets.

Arvind Sridharan arvsr1988

  • Chennai
View GitHub Profile
@arvsr1988
arvsr1988 / DockerFile_node
Created Jul 14, 2017
docker script for node app
View DockerFile_node
#how to run app in docker
#docker build -t <name> .
#docker run -p 3000:3000 <name>
FROM node:6-alpine
# Create app directory
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
@arvsr1988
arvsr1988 / deploy_node_app.sh
Created Sep 22, 2016
deploying a node app using a CI system to a new directory.
View deploy_node_app.sh
#bin/bash
CURRENT_DATE=`date +%s`
echo "current date is $CURRENT_DATE"
DEPLOYMENT_DIR='{deployment directory}'
CURRENT_DEPLOYMENT_DIR=$DEPLOYMENT_DIR$CURRENT_DATE
ARTIFACT_ZIP_LOCATION=~/tmp/
echo "current deployment dir $CURRENT_DEPLOYMENT_DIR"
PM2_PROCESS_NAME='{process name}'
mkdir -p $CURRENT_DEPLOYMENT_DIR
cp $ARTIFACT_ZIP_LOCATION/web.tar.gz $CURRENT_DEPLOYMENT_DIR
View gmail_send_api_notworking.js
var google = require('googleapis');
var googleAuth = require('google-auth-library');
var mimelib = require("mimelib");
let btoa = require('btoa');
// If modifying these scopes, delete your previously saved credentials
// at ~/.credentials/sheets.googleapis.com-nodejs-quickstart.json
var SCOPES = ['https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/gmail.send'];
var key = require('./client_secret.json');
var jwtClient = new google.auth.JWT(key.client_email, null, key.private_key, SCOPES, null);
@arvsr1988
arvsr1988 / node_module_copier.js
Last active Dec 27, 2017
Copy node modules from your dependencies recursively to your artifact directory using this code. This will work with npmjs version 3 and node js version 6(supporting ES 6)
View node_module_copier.js
let shell = require('shelljs');
const path = require('path');
const rootDir = path.resolve('./');
const alreadyCopied = (module, deployDir) => {
return shell.test('-d', deployDir + '/node_modules/' + module);
}
function copyDeps(packageFile, deployDir){
let moduleDeps = require(packageFile).dependencies;
You can’t perform that action at this time.