Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion configs/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ GITHUB_DEPLOY_KEY_TITLE=Runnable-development
GITHUB_HOOK_SECRET=3V3RYTHINGisAW3S0ME!
KRAIN_PORT=3100
LOG_SRC=true
MAVIS_HOST=http://mavis-staging-codenow.runnableapp.com
MONGO=mongodb://127.0.0.1:27017/runnable2
NEO4J=http://localhost:7474
OPTIMUS_HOST=optimus-staging-CodeNow.runnableapp.com
Expand Down
1 change: 0 additions & 1 deletion configs/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ GITHUB_DEPLOY_KEYS_POOL_SIZE=100
GITHUB_DEPLOY_KEY_TITLE=Runnable-io
KRAIN_PORT=3100
LOG_LEVEL_STDOUT=trace
MAVIS_HOST=http://mavis.runnable.io:80
NEW_RELIC_TRACER_ENABLED=false
REGISTRY_DOMAIN=registry.runnable.com
S3_CONTEXT_RESOURCE_BUCKET=runnable.context.resources.production
1 change: 0 additions & 1 deletion configs/.env.production-beta
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ GITHUB_DEPLOY_KEYS_POOL_SIZE=100
GITHUB_DEPLOY_KEY_TITLE=Runnable-io-beta
KRAIN_PORT=3100
LOG_LEVEL_STDOUT=trace
MAVIS_HOST=http://mavis.runnable-beta.com:80
NEW_RELIC_TRACER_ENABLED=false
REGISTRY_DOMAIN=registry.runnable.com
S3_CONTEXT_RESOURCE_BUCKET=runnable-beta.context.resources.production
1 change: 0 additions & 1 deletion configs/.env.production-gamma
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ GITHUB_DEPLOY_KEYS_POOL_SIZE=100
GITHUB_DEPLOY_KEY_TITLE=Runnable-io-gamma
KRAIN_PORT=3100
LOG_LEVEL_STDOUT=trace
MAVIS_HOST=http://mavis.runnable-gamma.com:80
NEW_RELIC_TRACER_ENABLED=false
REGISTRY_DOMAIN=registry.runnable.com
S3_CONTEXT_RESOURCE_BUCKET=runnable.context.resources.production-beta
1 change: 0 additions & 1 deletion configs/.env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ GITHUB_HOOK_SECRET=3V3RYTHINGisAW3S0ME!
KRAIN_PORT=3100
LOGGLY_TOKEN=f673760d-e0b3-4a93-a15e-2862ea074f91
LOG_SRC=true
MAVIS_HOST=http://mavis-staging-codenow.runnableapp.com
MIXPANEL_APP_ID=abed31a0844a1bf389205355edfda4c2
MONGO=mongodb://mongodb-staging-codenow.runnableapp.com/alpha
NAVI_HOST=http://10.0.1.41:33744
Expand Down
1 change: 0 additions & 1 deletion configs/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ IS_QUEUE_WORKER=true
KRAIN_PORT=1234
LOG_LEVEL_STDOUT=none
LOG_SRC=true
MAVIS_HOST=http://localhost:4000
MONGO=mongodb://127.0.0.1:27017/runnable_test123
NAVI_HOST=http://localhost:1234
NEO4J=http://localhost:7474
Expand Down
4 changes: 0 additions & 4 deletions lib/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ function logFn (err) {
errorData = assign(errorData, pick(err.data.krain, ['uri', 'statusCode', 'info']))
logger.log.error(errorData, 'log krain error')
}
if (err.data.mavis) {
errorData = assign(errorData, pick(err.data.mavis, ['uri', 'statusCode', 'info']))
logger.log.error(errorData, 'log mavis error')
}
if (err.data.s3) {
errorData = assign(errorData, pick(err.data.s3,
['bucket', 'contextId', 'sourcePath', 'sourceUrl']))
Expand Down
159 changes: 0 additions & 159 deletions lib/models/apis/mavis.js

This file was deleted.

6 changes: 3 additions & 3 deletions lib/models/rabbitmq/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ RabbitMQ.prototype.connect = function (cb) {
username: process.env.RABBITMQ_USERNAME,
subscribedEvents: [
'container.network.attached',
'container.network.attach-failed'
'container.network.attach-failed',
'dock.removed'
],
publishedEvents: [
'instance.created',
Expand All @@ -60,7 +61,6 @@ RabbitMQ.prototype.connect = function (cb) {
'delete-instance-container',
'deploy-instance',
'metis-github-event',
'on-dock-removed',
'on-image-builder-container-create',
'on-image-builder-container-die',
'on-instance-container-create',
Expand Down Expand Up @@ -115,7 +115,7 @@ RabbitMQ.prototype.loadWorkers = function () {
var ponosTasks = this.ponosTasks = {
'create-instance-container': require('workers/create-instance-container'),
'pull-instance-image': require('workers/pull-instance-image'),
'on-dock-removed': require('workers/on-dock-removed')
'dock.removed': require('workers/dock.removed')
}
// ponos: subscribe to queues
var ponosServer = this.ponosServer = new ponos.Server({
Expand Down
22 changes: 11 additions & 11 deletions lib/workers/on-dock-removed.js → lib/workers/dock.removed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Respond to dock-unhealthy event from docker-listener
* - get running containers on dock
* - redeploy those containers
* @module lib/workers/on-dock-removed
* @module lib/workers/dock.removed
*/
'use strict'

Expand All @@ -17,7 +17,7 @@ var joi = require('utils/joi')
var TaskFatalError = require('ponos').TaskFatalError
var log = require('middlewares/logger')(__filename).log

module.exports = OnDockRemovedWorker
module.exports = DockRemovedWorker

/**
* Main handler for docker unhealthy event
Expand All @@ -27,7 +27,7 @@ module.exports = OnDockRemovedWorker
* @param {Object} job - Job info
* @returns {Promise}
*/
function OnDockRemovedWorker (job) {
function DockRemovedWorker (job) {
job = job || true // Do this so joi will trigger validation failure on empty job
var logData = {
tx: true,
Expand All @@ -41,7 +41,7 @@ function OnDockRemovedWorker (job) {
.catch(function (err) {
throw new TaskFatalError(err)
})
.then(log.trace.bind(log, logData, 'OnDockRemovedWorker handle'))
.then(log.trace.bind(log, logData, 'DockRemovedWorker handle'))
.then(function () {
return Promise.fromCallback(function (cb) {
ContextVersion.markDockRemovedByDockerHost(job.host, cb)
Expand All @@ -58,16 +58,16 @@ function OnDockRemovedWorker (job) {
})
})
.then(function (instances) {
log.trace(logData, 'OnDockRemovedWorker - Instances found ' + instances.length)
log.trace(logData, 'DockRemovedWorker - Instances found ' + instances.length)
if (instances.length > 0) {
return Promise.all([
OnDockRemovedWorker._redeployContainers(instances),
OnDockRemovedWorker._updateFrontendInstances(instances)
DockRemovedWorker._redeployContainers(instances),
DockRemovedWorker._updateFrontendInstances(instances)
])
}
})
.catch(function (e) {
log.trace(logData, 'OnDockRemovedWorker - ERROR! ' + e)
log.trace(logData, 'DockRemovedWorker - ERROR! ' + e)
throw e
})
}
Expand All @@ -78,11 +78,11 @@ function OnDockRemovedWorker (job) {
* @returns {Promise}
* @private
*/
OnDockRemovedWorker._redeployContainers = function (instances) {
DockRemovedWorker._redeployContainers = function (instances) {
var runnableClient = new Runnable(process.env.FULL_API_DOMAIN, {
requestDefaults: {
headers: {
'user-agent': 'worker-on-dock-removed'
'user-agent': 'worker-dock.removed'
}
}
})
Expand All @@ -107,7 +107,7 @@ OnDockRemovedWorker._redeployContainers = function (instances) {
})
}

OnDockRemovedWorker._updateFrontendInstances = function (instances) {
DockRemovedWorker._updateFrontendInstances = function (instances) {
return Promise.all(
instances
.map(function (instance) {
Expand Down
19 changes: 4 additions & 15 deletions lib/workers/pull-instance-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ var TaskFatalError = require('ponos').TaskFatalError
var Docker = require('models/apis/docker')
var Instance = require('models/mongo/instance')
var joi = require('utils/joi')
var Mavis = require('models/apis/mavis')
var rabbitMQ = require('models/rabbitmq')
var toJSON = require('utils/to-json')
var toObjectId = require('utils/to-object-id')
Expand Down Expand Up @@ -62,23 +61,13 @@ function pullInstanceImage (job) {
return instance
})
})
.then(function findDockerHost (instance) {
log.info(logData, 'onInstanceImagePull.findDockerHost')
var mavis = new Mavis()
var cv = instance.contextVersion
return Promise.props({
instance: instance,
dockerHost: mavis.findDockForContainerAsync(cv)
})
})
.then(function modifyInstanceImagePull (data) {
.then(function modifyInstanceImagePull (instance) {
log.info(logData, 'onInstanceImagePull.modifyInstanceImagePull')
var instance = data.instance
var cv = instance.contextVersion
var dockerTag = cv.build.dockerTag
var instancePromise = instance.modifyImagePullAsync(cv._id, {
dockerTag: dockerTag,
dockerHost: data.dockerHost,
dockerHost: process.env.SWARM_HOST,
sessionUser: {
github: job.sessionUserGithubId
},
Expand All @@ -93,14 +82,14 @@ function pullInstanceImage (job) {
})
return Promise.props({
instance: instancePromise,
dockerHost: data.dockerHost,
dockerHost: process.env.SWARM_HOST,
dockerTag: dockerTag
})
})
.then(function pullImage (data) {
log.info(logData, 'onInstanceImagePull.pullImage')
var instance = data.instance
var docker = new Docker(data.dockerHost)
var docker = new Docker(process.env.SWARM_HOST)
return docker.pullImageAsync(data.dockerTag)
.then(function () {
return data.instance // return instance
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@
"jsdoc": "^3.2.2",
"krain": "git+ssh://git@github.com:CodeNow/krain.git#v0.0.9",
"lab": "5.8.0",
"mavis": "git+ssh://git@github.com:CodeNow/mavis#v0.3.0",
"multiline": "^1.0.2",
"nock": "^0.51.0",
"node-inspector": "^0.9.2",
Expand Down
Loading