Created
December 3, 2015 16:37
-
-
Save delianides/f302b7e60148cb1e4a14 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Description: | |
# Create a database backup and upload it to S3 | |
# | |
# Dependencies: | |
# "aws-sdk": "^2.2.20" | |
# | |
# Configuration: | |
# HUBOT_OPS_ROOM - Private room so only certain people have access | |
# AWS_REGION | |
# AWS_ACCESS_KEY_ID | |
# AWS_SECRET_ACCESS_KEY | |
# HUBOT_DUMP_BUCKET | |
# | |
# Commands: | |
# hubot get me a database | |
# | |
# Author | |
# delianides | |
spawn = require('child_process').spawn | |
fs = require('fs') | |
zlib = require('zlib') | |
moment = require "moment" | |
AWS = require('aws-sdk') | |
AWS.config.region = process.env.HUBOT_AWS_REGION | |
module.exports = (robot) -> | |
robot.respond /get me a database/i, (msg) -> | |
mysqldump = spawn("/Users/drew.delianides/Projects/go/bin/mysqlsuperdump -h") | |
mysqldump.stdout.on 'data', (data) -> | |
msg.reply data | |
return | |
# body = fs.createReadStream(mysqldump.stdout).pipe(zlib.createGzip()) | |
# s3obj = new (AWS.S3)(params: | |
# Bucket: 'ns.ops' | |
# Key: 'backup.sql.gz') | |
# s3obj.upload(Body: body).on('httpUploadProgress', (evt) -> | |
# console.log evt | |
# return | |
# ).send (err, data) -> | |
# console.log err, data | |
# return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment