Browse Source
Merge pull request #4571 from Budibase/deprovision-and-couch-fix
Deprovision and local couch db url fix
pull/4607/head
Rory Powell
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with
7 additions and
6 deletions
-
packages/backend-core/src/context/deprovision.js
-
packages/backend-core/src/migrations/index.js
-
packages/server/scripts/dev/manage.js
-
packages/server/src/db/client.js
-
packages/worker/scripts/dev/manage.js
-
packages/worker/src/db/index.js
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
const { getGlobalUserParams, getAllApps } = require("../db/utils") |
|
|
|
const { getDB, getCouch } = require("../db") |
|
|
|
const { getDB } = require("../db") |
|
|
|
const { getGlobalDB } = require("../tenancy") |
|
|
|
const { StaticDatabases } = require("../db/constants") |
|
|
|
|
|
|
|
@ -79,7 +79,7 @@ const removeGlobalDB = async tenantId => { |
|
|
|
|
|
|
|
const removeTenantApps = async tenantId => { |
|
|
|
try { |
|
|
|
const apps = await getAllApps(getCouch(), { all: true }) |
|
|
|
const apps = await getAllApps({ all: true }) |
|
|
|
const destroyPromises = apps.map(app => getDB(app.appId).destroy()) |
|
|
|
await Promise.allSettled(destroyPromises) |
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
@ -22,6 +22,7 @@ exports.getMigrationsDoc = async db => { |
|
|
|
if (err.status && err.status === 404) { |
|
|
|
return { _id: DocumentTypes.MIGRATIONS } |
|
|
|
} |
|
|
|
console.error(err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -37,7 +37,7 @@ async function init() { |
|
|
|
const envFileJson = { |
|
|
|
PORT: 4001, |
|
|
|
MINIO_URL: "http://localhost:4004", |
|
|
|
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", |
|
|
|
COUCH_DB_URL: "http://budibase:budibase@localhost:4005", |
|
|
|
REDIS_URL: "localhost:6379", |
|
|
|
WORKER_URL: "http://localhost:4002", |
|
|
|
INTERNAL_API_KEY: "budibase", |
|
|
|
|
|
|
|
@ -5,7 +5,7 @@ const allDbs = require("pouchdb-all-dbs") |
|
|
|
const find = require("pouchdb-find") |
|
|
|
const env = require("../environment") |
|
|
|
|
|
|
|
const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/" |
|
|
|
const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005" |
|
|
|
|
|
|
|
PouchDB.plugin(replicationStream.plugin) |
|
|
|
PouchDB.plugin(find) |
|
|
|
|
|
|
|
@ -16,7 +16,7 @@ async function init() { |
|
|
|
REDIS_URL: "localhost:6379", |
|
|
|
REDIS_PASSWORD: "budibase", |
|
|
|
MINIO_URL: "http://localhost:4004", |
|
|
|
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", |
|
|
|
COUCH_DB_URL: "http://budibase:budibase@localhost:4005", |
|
|
|
COUCH_DB_USERNAME: "budibase", |
|
|
|
COUCH_DB_PASSWORD: "budibase", |
|
|
|
// empty string is false
|
|
|
|
|
|
|
|
@ -4,7 +4,7 @@ const env = require("../environment") |
|
|
|
const { getCouchUrl } = require("@budibase/backend-core/db") |
|
|
|
|
|
|
|
// level option is purely for testing (development)
|
|
|
|
const COUCH_DB_URL = getCouchUrl() || "http://localhost:10000/db/" |
|
|
|
const COUCH_DB_URL = getCouchUrl() || "http://localhost:4005" |
|
|
|
|
|
|
|
let POUCH_DB_DEFAULTS = { |
|
|
|
prefix: COUCH_DB_URL, |
|
|
|
|