MCPcopy
hub / github.com/caprover/caprover / install

Function install

src/utils/CaptainInstaller.ts:206–441  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

204}
205
206export function install() {
207 const backupManger = new BackupManager()
208
209 Promise.resolve()
210 .then(function () {
211 if (!EnvVar.ACCEPTED_TERMS) {
212 throw new Error(
213 `
214 Add the following to the installer line:
215 -e ACCEPTED_TERMS=true
216
217 Terms of service must be accepted before installation, view them here:
218 https://github.com/caprover/caprover/blob/master/TERMS_AND_CONDITIONS.md
219 `.trim()
220 )
221 }
222 })
223 .then(function () {
224 printTroubleShootingUrl()
225 })
226 .then(function () {
227 return checkSystemReq()
228 })
229 .then(function () {
230 return initializeExternalIp()
231 })
232 .then(function (externalIp) {
233 if (EnvVar.MAIN_NODE_IP_ADDRESS) {
234 return EnvVar.MAIN_NODE_IP_ADDRESS
235 }
236
237 try {
238 const externalIpFetched = externalIp.publicIpv4()
239 if (externalIpFetched) {
240 return externalIpFetched
241 }
242 } catch (error) {
243 console.error(
244 'Defaulting to 127.0.0.1 - Error retrieving IP address:',
245 error
246 )
247 }
248
249 return '127.0.0.1'
250 })
251 .then(function (ip4) {
252 if (!ip4) {
253 throw new Error(
254 'Something went wrong. No IP address was retrieved.'
255 )
256 }
257
258 if (CaptainConstants.isDebug) {
259 return new Promise<string>(function (resolve, reject) {
260 DockerApi.get()
261 .swarmLeave(true)
262 .then(function (ignore) {
263 resolve(ip4)

Callers

nothing calls this directly

Calls 15

printTroubleShootingUrlFunction · 0.85
checkSystemReqFunction · 0.85
initializeExternalIpFunction · 0.85
checkPortOrThrowFunction · 0.85
swarmLeaveMethod · 0.80
logMethod · 0.80
pullImageMethod · 0.80
ensureSwarmExistsMethod · 0.80
initSwarmMethod · 0.80

Tested by

no test coverage detected