move cloudron network creation to platform code
this gives us more control on re-creating the network with different arguments/options when needed.
This commit is contained in:
@@ -53,6 +53,7 @@ async function start(options) {
|
||||
try {
|
||||
if (existingInfra.version !== infra.version) await removeAllContainers();
|
||||
if (existingInfra.version === 'none') await volumes.mountAll(); // when restoring, mount all volumes
|
||||
await createDockerNetwork();
|
||||
await markApps(existingInfra, options); // mark app state before we start addons. this gives the db import logic a chance to mark an app as errored
|
||||
await services.startServices(existingInfra);
|
||||
await fs.promises.writeFile(paths.INFRA_VERSION_FILE, JSON.stringify(infra, null, 4));
|
||||
@@ -111,6 +112,13 @@ async function pruneInfraImages() {
|
||||
}
|
||||
}
|
||||
|
||||
async function createDockerNetwork() {
|
||||
debug('createDockerNetwork: recreating docker network');
|
||||
|
||||
await shell.promises.exec('createDockerNetwork', 'docker network rm cloudron');
|
||||
await shell.promises.exec('createDockerNetwork', 'docker network create --subnet=172.18.0.0/16 --ip-range=172.18.0.0/20 --gateway 172.18.0.1 cloudron');
|
||||
}
|
||||
|
||||
async function removeAllContainers() {
|
||||
debug('removeAllContainers: removing all containers for infra upgrade');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user