Skip to content

Instantly share code, notes, and snippets.

@hjanuschka
Created January 27, 2015 09:44
Show Gist options
  • Save hjanuschka/ca273eaebb96cc92c5ec to your computer and use it in GitHub Desktop.
Save hjanuschka/ca273eaebb96cc92c5ec to your computer and use it in GitHub Desktop.
shipit bartlby-core
module.exports = function (shipit) {
require('shipit-deploy')(shipit);
shipit.initConfig({
default: {
workspace: '/tmp/shipit/bartlby-core',
deployTo: '/tmp/shipit/bartlby-core',
repositoryUrl: 'https://github.com/Bartlby/bartlby-core.git',
ignores: ['.git', 'node_modules'],
keepReleases: 2,
key: '/Users/h.januschka/Desktop/h.januschka_2008_07.openssh',
shallowClone: false
},
staging: {
branch: "development/stage",
servers: 'root@localhost:8002',
configure: './configure --prefix=/opt/bartlby --enable-nrpe --enable-ssl --enable-snmp',
mysql: {
user: "root",
password: "docker",
host: "localhost",
db: "bartlby"
},
install_path: "/tmp/install"
}
});
shipit.blTask('build', function () {
shipit.log("Building...." + shipit.config.configure + " ->" + shipit.releasePath + shipit.config.mysql.user);
function make_install() {
shipit.log("MAKE INSTALL");
return shipit.remote("cd " + shipit.releasePath + " && make install");
}
function make() {
shipit.log("MAKE");
return shipit.remote("cd " + shipit.releasePath + " && make -j5");
}
function configure() {
shipit.log("Configure");
return shipit.remote("cd " + shipit.releasePath + " && " + shipit.config.configure);
}
function autogen() {
shipit.log("Running Autogen");
return shipit.remote("cd " + shipit.releasePath + " && ./autogen.sh");
}
function patch_db() {
shipit.log("PATCH DB");
envs = " export BARTLBY_ENV_AUTO_INSTALL=1;"
envs += "export BARTLBY_ENV_MYSQL_USER=" + shipit.config.mysql.user + ";"
envs += "export BARTLBY_ENV_MYSQL_DB=" + shipit.config.mysql.db + ";"
envs += "export BARTLBY_ENV_MYSQL_PASSWORD=" + shipit.config.mysql.password + ";"
envs += "export BARTLBY_ENV_MYSQL_HOST=" + shipit.config.mysql.host + ";"
return shipit.remote(envs + " cd " + shipit.releasePath + " && bash postinstall-pak")
}
return autogen()
.then(configure)
.then(make)
.then(make_install)
.then(patch_db);
//return shipit.remote('cd ' + shipit.config.deployTo + "/current && ./autogen.sh && ./configure && make");
});
shipit.on('updated', function () {
shipit.start('build');
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment