mirror of
https://github.com/caprover/caprover
synced 2026-08-27 18:06:39 +00:00
bug fix for service creation
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -381,7 +381,8 @@ class ServiceManager {
|
||||
getBuildStatus(appName) {
|
||||
const self = this;
|
||||
this.buildLogs[appName] =
|
||||
this.buildLogs[appName] || new BuildLog(CaptainConstants.buildLogSize);
|
||||
this.buildLogs[appName] ||
|
||||
new BuildLog(CaptainConstants.buildLogSize);
|
||||
return {
|
||||
isAppBuilding: self.isAppBuilding(appName),
|
||||
logs: self.buildLogs[appName].getLogs(),
|
||||
@@ -391,7 +392,8 @@ class ServiceManager {
|
||||
logBuildFailed(appName, error) {
|
||||
error = (error || '') + '';
|
||||
this.buildLogs[appName] =
|
||||
this.buildLogs[appName] || new BuildLog(CaptainConstants.buildLogSize);
|
||||
this.buildLogs[appName] ||
|
||||
new BuildLog(CaptainConstants.buildLogSize);
|
||||
this.buildLogs[appName].onBuildFailed(error);
|
||||
}
|
||||
ensureServiceInitedAndUpdated(appName) {
|
||||
@@ -430,6 +432,10 @@ class ServiceManager {
|
||||
if (!imageName) {
|
||||
throw new Error('ImageName for deployed version is not available, this is impossible!');
|
||||
}
|
||||
Logger.d(`Creating service ${serviceName} with default image, we will update image later`);
|
||||
// if we pass in networks here. Almost always it results in a delayed update which causes
|
||||
// update errors if they happen right away!
|
||||
return dockerApi.createServiceOnNodeId(CaptainConstants.appPlaceholderImageName, serviceName, undefined, undefined, undefined, undefined, undefined);
|
||||
}
|
||||
})
|
||||
.then(function () {
|
||||
@@ -437,10 +443,6 @@ class ServiceManager {
|
||||
})
|
||||
.then(function (data) {
|
||||
dockerAuthObject = data;
|
||||
Logger.d(`Creating service ${serviceName} with image ${imageName}`);
|
||||
// if we pass in networks here. Almost always it results in a delayed update which causes
|
||||
// update errors if they happen right away!
|
||||
return dockerApi.createServiceOnNodeId(CaptainConstants.appPlaceholderImageName, serviceName, undefined, undefined, undefined, undefined, undefined);
|
||||
})
|
||||
.then(function () {
|
||||
return self.createPreDeployFunctionIfExist(app);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -42,12 +42,10 @@ import tar = require('tar')
|
||||
import path = require('path')
|
||||
import TemplateHelper = require('./TemplateHelper')
|
||||
import GitHelper = require('../utils/GitHelper')
|
||||
import uuid = require('uuid/v4')
|
||||
import ApiStatusCodes = require('../api/ApiStatusCodes')
|
||||
import { AnyError } from '../models/OtherTypes'
|
||||
import BuildLog = require('./BuildLog')
|
||||
import DataStore = require('../datastore/DataStore')
|
||||
import ServiceManager = require('./ServiceManager');
|
||||
|
||||
const RAW_SOURCE_DIRECTORY = 'source_files'
|
||||
const TAR_FILE_NAME_READY_FOR_DOCKER = 'image.tar'
|
||||
|
||||
@@ -11,7 +11,6 @@ import BuildLog = require('./BuildLog')
|
||||
import { ImageInfo } from 'dockerode'
|
||||
import ImageMaker = require('./ImageMaker')
|
||||
|
||||
|
||||
class ServiceManager {
|
||||
private activeBuilds: IHashMapGeneric<boolean>
|
||||
private buildLogs: IHashMapGeneric<BuildLog>
|
||||
@@ -533,7 +532,8 @@ class ServiceManager {
|
||||
getBuildStatus(appName: string) {
|
||||
const self = this
|
||||
this.buildLogs[appName] =
|
||||
this.buildLogs[appName] || new BuildLog(CaptainConstants.buildLogSize)
|
||||
this.buildLogs[appName] ||
|
||||
new BuildLog(CaptainConstants.buildLogSize)
|
||||
|
||||
return {
|
||||
isAppBuilding: self.isAppBuilding(appName),
|
||||
@@ -545,7 +545,8 @@ class ServiceManager {
|
||||
logBuildFailed(appName: string, error: string) {
|
||||
error = (error || '') + ''
|
||||
this.buildLogs[appName] =
|
||||
this.buildLogs[appName] || new BuildLog(CaptainConstants.buildLogSize)
|
||||
this.buildLogs[appName] ||
|
||||
new BuildLog(CaptainConstants.buildLogSize)
|
||||
this.buildLogs[appName].onBuildFailed(error)
|
||||
}
|
||||
|
||||
@@ -591,6 +592,22 @@ class ServiceManager {
|
||||
'ImageName for deployed version is not available, this is impossible!'
|
||||
)
|
||||
}
|
||||
|
||||
Logger.d(
|
||||
`Creating service ${serviceName} with default image, we will update image later`
|
||||
)
|
||||
|
||||
// if we pass in networks here. Almost always it results in a delayed update which causes
|
||||
// update errors if they happen right away!
|
||||
return dockerApi.createServiceOnNodeId(
|
||||
CaptainConstants.appPlaceholderImageName,
|
||||
serviceName,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined
|
||||
)
|
||||
}
|
||||
})
|
||||
.then(function() {
|
||||
@@ -600,22 +617,6 @@ class ServiceManager {
|
||||
})
|
||||
.then(function(data) {
|
||||
dockerAuthObject = data
|
||||
|
||||
Logger.d(
|
||||
`Creating service ${serviceName} with image ${imageName}`
|
||||
)
|
||||
|
||||
// if we pass in networks here. Almost always it results in a delayed update which causes
|
||||
// update errors if they happen right away!
|
||||
return dockerApi.createServiceOnNodeId(
|
||||
CaptainConstants.appPlaceholderImageName,
|
||||
serviceName,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined
|
||||
)
|
||||
})
|
||||
.then(function() {
|
||||
return self.createPreDeployFunctionIfExist(app)
|
||||
|
||||
Reference in New Issue
Block a user