コード例 #1
0
  fs.readlink(currentSymlink, function(err, id) {
    if (err) {
      self.debug('no current deployment found');
      return callback();
    }

    // If we find it, it was already prepared (and run) in the past, so emit
    // it as 'prepared', after figuring out the commit metadata.
    var dir = self.git.workdir({id: id});
    var hash = id.split('.')[0];
    var commit = cicadaCommit({
      dir: dir,
      hash: hash,
      id: id,
      repo: self.instanceId,
      branch: 'default', // XXX(sam) should stop logging branch, its meaningless
    });
    self.server.getInstanceEnv(self.instanceId, function(err, env) {
      if (err) return callback(err);
      commit.env = env;
      commit.container = self;

      self.emit('prepared', commit);
      callback();
    });

  });
コード例 #2
0
Container.prototype.updateInstanceEnv = function(env, callback) {
  var self = this;
  var current = self.current;

  self.debug('updateInstanceEnv: %j', env);

  setImmediate(callback);

  if (!current)
    return self.debug('no current to restart with new env');

  if (!envChanged(current.commit.env, env))
    return self.debug('no change in env to restart with');

  self.debug('restarting with new env: %j', env);

  // Make copy of current app but with an updated environment.
  // XXX(sam) commit creation should be in a common function.
  var commit = cicadaCommit(current.commit);
  commit.env = env;
  commit.instanceId = this.instanceId;
  commit.container = self;

  self.emit('prepared', commit);
};
コード例 #3
0
ファイル: container.js プロジェクト: rtrag/strong-pm
  fs.readlink(currentSymlink, function(err, dir) {
    if (err) {
      self.debug('no current deployment found');
      return callback();
    }

    // The current symlink is now absolute, but it used to be relative prior to
    // strong-runner 5.x, so can still exist on disk as relative, both previous
    // strong-pm installs, as well as in the unit test fixtures. Resolve it to
    // absolute in case it isn't already.
    dir = path.resolve(currentSymlink, '..', dir);

    // If we find it, it was already prepared (and run) in the past, so emit
    // it as 'prepared', after figuring out the commit metadata.
    var id = path.basename(dir);
    var hash = id.split('.')[0];
    var commit = cicadaCommit({
      dir: dir,
      hash: hash,
      id: id,
      repo: self.instanceId,
      branch: 'default', // XXX(sam) should stop logging branch, its meaningless
    });
    self.server.getInstanceEnv(self.instanceId, function(err, env) {
      if (err) return callback(err);
      commit.env = env;
      commit.container = self;

      self.emit('prepared', commit);
      callback();
    });

  });
コード例 #4
0
ファイル: pack-receiver.js プロジェクト: afrog33k/strong-pm
  untarStream.on('end', function() {
    debug('done untgz from %s', tarGzPath);
    debug('done untgz into %s', untarDir);

    // XXX(sam) I'm setting up a structure where I use my own folders
    // to distinguish between services... but perhaps I could find a way to
    // use repos? The last element of the git push path will be 'deploy',
    // but perhaps we can manually make the path be
    //   /api/Services/SVC/deploy/SVC
    // so that a single cicada instatnce takes care of tracking the 'repo'
    // rather than the Container needing a Cicada per service?
    var repo = 'default';

    var branch = 'npm-pack';
    var commit = cicadaCommit({
      hash: hash,
      id: id,
      dir: untarDir,
      repo: repo,
      branch: branch,
    });
    commit.runInPlace = false;
    self.cicada.emit('commit', commit);
    res.writeHead(200);
    res.end('Application received');
  });
コード例 #5
0
ファイル: server.js プロジェクト: jrschumacher/strong-pm
  fs.readlink(currentSymlink, function(err, id) {
    if (err) {
      debug('no current deployment found');
      return cb();
    }

    // If we find it, it was already prepared (and run) in the past, so emit
    // it as 'prepared', after figuring out the commit metadata.
    var dir = self.git.workdir({id: id});
    var hash = id.split('.')[0];
    // XXX(sam) repo and branch not known at this point, so config won't be
    // correct!  but config will be gone soon, so we don't care for now.
    var commit = cicadaCommit({hash: hash, id: id, dir: dir});
    commit.config = configForCommit(commit);
    commit.env = self.env();
    self.emit('prepared', commit);
    process.nextTick(cb);
  });
コード例 #6
0
LocalDeployer.prototype.processLocalDir = function(req, res, dirPath, hash) {
  var id = hash + '.' + Date.now();

  var repo = path.basename(dirPath);

  debug('processLocalDir: id=%s dir=%s repo=%s branch=%s',
        id, dirPath, repo, branch);

  var branch = 'local-directory';

  var commit = serverCommit({
    hash: hash, id: id, dir: dirPath, repo: repo, branch: branch
  });

  commit.runInPlace = true;

  debug('commit: %j', commit);
  this.server.emit('prepared', commit); // FIXME emit on container
  res.writeHead(200);
  res.end('Application deployed\n');
};
コード例 #7
0
ファイル: server.js プロジェクト: jrschumacher/strong-pm
 this._env.save(function(err) {
   debug('Saved environment: ', arguments);
   if (err) {
     if (callback) {
       return callback(err);
     } else {
       throw err;
     }
   }
   var current = runner.current();
   if (current) {
     // make copy of current app but with an updated environment
     var commit = cicadaCommit(runner.current().commit);
     commit.config = configForCommit(commit);
     commit.env = self.env();
     debug('Restarting app with new env');
     self.emit('commit', commit);
   } else {
     debug('No current app to restart');
   }
   if (callback) {
     callback();
   }
 });