From 769c37a11d6f53ed2026ee60c5c2a5cac369901a Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 16 Aug 2021 15:58:04 +0100 Subject: [PATCH 01/29] couchdb direct auth --- packages/auth/src/db/utils.js | 8 +++++++- packages/server/scripts/dev/manage.js | 2 +- packages/server/src/db/client.js | 4 ++++ packages/server/src/environment.js | 2 ++ packages/worker/scripts/dev/manage.js | 2 +- packages/worker/src/db/index.js | 4 ++++ packages/worker/src/environment.js | 3 +-- 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 1fc78f4182..e3a86f8ae8 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -168,7 +168,13 @@ exports.getAllDbs = async () => { if (env.isTest()) { return getCouch().allDbs() } - const response = await fetch(`${env.COUCH_DB_URL}/_all_dbs`) + const response = await fetch(`${env.COUCH_DB_URL}/_all_dbs`, { + method: "POST", + body: JSON.stringify({ + name: env.COUCH_DB_USERNAME, + password: env.COUCH_DB_PASSWORD, + }), + }) if (response.status === 200) { return response.json() } else { diff --git a/packages/server/scripts/dev/manage.js b/packages/server/scripts/dev/manage.js index ffd8c6b9e3..7e9d7f6a07 100644 --- a/packages/server/scripts/dev/manage.js +++ b/packages/server/scripts/dev/manage.js @@ -36,7 +36,7 @@ async function init() { const envFileJson = { PORT: 4001, MINIO_URL: "http://localhost:10000/", - COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", + COUCH_DB_URL: "http://localhost:10000/db/", REDIS_URL: "localhost:6379", WORKER_URL: "http://localhost:4002", INTERNAL_API_KEY: "budibase", diff --git a/packages/server/src/db/client.js b/packages/server/src/db/client.js index d50d72b18d..887b287c84 100644 --- a/packages/server/src/db/client.js +++ b/packages/server/src/db/client.js @@ -12,6 +12,10 @@ PouchDB.adapter("writableStream", replicationStream.adapters.writableStream) let POUCH_DB_DEFAULTS = { prefix: COUCH_DB_URL, + auth: { + username: env.COUCH_DB_USERNAME, + password: env.COUCH_DB_PASSWORD, + } } if (env.isTest()) { diff --git a/packages/server/src/environment.js b/packages/server/src/environment.js index 52c680f65a..45c7673851 100644 --- a/packages/server/src/environment.js +++ b/packages/server/src/environment.js @@ -23,6 +23,8 @@ module.exports = { // important PORT: process.env.PORT, JWT_SECRET: process.env.JWT_SECRET, + COUCH_DB_USERNAME: process.env.COUCH_DB_USER, + COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD, COUCH_DB_URL: process.env.COUCH_DB_URL, MINIO_URL: process.env.MINIO_URL, WORKER_URL: process.env.WORKER_URL, diff --git a/packages/worker/scripts/dev/manage.js b/packages/worker/scripts/dev/manage.js index b9d28b6278..d7eb76fc74 100644 --- a/packages/worker/scripts/dev/manage.js +++ b/packages/worker/scripts/dev/manage.js @@ -17,7 +17,7 @@ async function init() { REDIS_URL: "localhost:6379", REDIS_PASSWORD: "budibase", MINIO_URL: "http://localhost:10000/", - COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", + COUCH_DB_URL: "http://localhost:10000/db/", } let envFile = "" Object.keys(envFileJson).forEach(key => { diff --git a/packages/worker/src/db/index.js b/packages/worker/src/db/index.js index d6d035cff1..d09ddf0652 100644 --- a/packages/worker/src/db/index.js +++ b/packages/worker/src/db/index.js @@ -7,6 +7,10 @@ const COUCH_DB_URL = env.COUCH_DB_URL || "http://localhost:10000/db/" let POUCH_DB_DEFAULTS = { prefix: COUCH_DB_URL, + auth: { + username: env.COUCH_DB_USERNAME, + password: env.COUCH_DB_PASSWORD, + } } if (env.isTest()) { diff --git a/packages/worker/src/environment.js b/packages/worker/src/environment.js index 384230b9b3..e8666e6b87 100644 --- a/packages/worker/src/environment.js +++ b/packages/worker/src/environment.js @@ -23,7 +23,6 @@ module.exports = { MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY, MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY, MINIO_URL: process.env.MINIO_URL, - COUCH_DB_URL: process.env.COUCH_DB_URL, LOG_LEVEL: process.env.LOG_LEVEL, JWT_SECRET: process.env.JWT_SECRET, SALT_ROUNDS: process.env.SALT_ROUNDS, @@ -31,7 +30,7 @@ module.exports = { REDIS_PASSWORD: process.env.REDIS_PASSWORD, INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, /* TODO: to remove - once deployment removed */ - COUCH_DB_USERNAME: process.env.COUCH_DB_USERNAME, + COUCH_DB_USERNAME: process.env.COUCH_DB_USER, COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD, _set(key, value) { process.env[key] = value From beb16a733e70ceb5394fb2a7759d3d4acb39dce5 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 16 Aug 2021 16:38:00 +0100 Subject: [PATCH 02/29] utility helper for determining correct couchDB URL --- packages/auth/src/db/utils.js | 21 ++++++++++++------- packages/auth/src/environment.js | 2 ++ .../src/api/controllers/row/internalSearch.js | 3 ++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index e3a86f8ae8..7c44664a68 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -159,6 +159,17 @@ exports.getDeployedAppID = appId => { return appId } +exports.getCouchUrl = () => { + // username and password already exist in URL + if (env.COUCH_DB_URL.includes("@")) { + return env.COUCH_DB_URL + } + + const [protocol, ...rest] = env.COUCH_DB_URL.split("://") + + return `${protocol}://${env.COUCH_DB_USERNAME}:${env.COUCH_DB_PASSWORD}@${rest}` +} + /** * if in production this will use the CouchDB _all_dbs call to retrieve a list of databases. If testing * when using Pouch it will use the pouchdb-all-dbs package. @@ -168,13 +179,7 @@ exports.getAllDbs = async () => { if (env.isTest()) { return getCouch().allDbs() } - const response = await fetch(`${env.COUCH_DB_URL}/_all_dbs`, { - method: "POST", - body: JSON.stringify({ - name: env.COUCH_DB_USERNAME, - password: env.COUCH_DB_PASSWORD, - }), - }) + const response = await fetch(`${exports.getCouchUrl()}/_all_dbs`) if (response.status === 200) { return response.json() } else { @@ -309,4 +314,4 @@ exports.Replication = Replication exports.getScopedConfig = getScopedConfig exports.generateConfigID = generateConfigID exports.getConfigParams = getConfigParams -exports.getScopedFullConfig = getScopedFullConfig +exports.getScopedFullConfig = getScopedFullConfig \ No newline at end of file diff --git a/packages/auth/src/environment.js b/packages/auth/src/environment.js index 355843d02d..e64a1c75f0 100644 --- a/packages/auth/src/environment.js +++ b/packages/auth/src/environment.js @@ -9,6 +9,8 @@ function isTest() { module.exports = { JWT_SECRET: process.env.JWT_SECRET, COUCH_DB_URL: process.env.COUCH_DB_URL, + COUCH_DB_USERNAME: process.env.COUCH_DB_USER, + COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD, SALT_ROUNDS: process.env.SALT_ROUNDS, REDIS_URL: process.env.REDIS_URL, REDIS_PASSWORD: process.env.REDIS_PASSWORD, diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index c13091d6e8..20147a7857 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -1,6 +1,7 @@ const { SearchIndexes } = require("../../../db/utils") const env = require("../../../environment") const fetch = require("node-fetch") +const { getCouchUrl } = require("@budibase/auth/db") /** * Class to build lucene query URLs. @@ -233,7 +234,7 @@ class QueryBuilder { } async run() { - const url = `${env.COUCH_DB_URL}/${this.appId}/_design/database/_search/${SearchIndexes.ROWS}` + const url = `${getCouchUrl()}/${this.appId}/_design/database/_search/${SearchIndexes.ROWS}` const body = this.buildSearchBody() return await runQuery(url, body) } From a06325cace97b2889f2bc2bc869ade8ff69a39f4 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 16 Aug 2021 16:39:10 +0100 Subject: [PATCH 03/29] readd couchDB url to env --- packages/worker/src/environment.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/worker/src/environment.js b/packages/worker/src/environment.js index e8666e6b87..1fc68ccc71 100644 --- a/packages/worker/src/environment.js +++ b/packages/worker/src/environment.js @@ -23,6 +23,7 @@ module.exports = { MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY, MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY, MINIO_URL: process.env.MINIO_URL, + COUCH_DB_URL: process.env.COUCH_DB_URL, LOG_LEVEL: process.env.LOG_LEVEL, JWT_SECRET: process.env.JWT_SECRET, SALT_ROUNDS: process.env.SALT_ROUNDS, From cedc78e4902d7624fa7ae210288cbfd5dfb56f85 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 16 Aug 2021 16:44:46 +0100 Subject: [PATCH 04/29] match up env var in worker --- packages/worker/src/environment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/worker/src/environment.js b/packages/worker/src/environment.js index 1fc68ccc71..384230b9b3 100644 --- a/packages/worker/src/environment.js +++ b/packages/worker/src/environment.js @@ -31,7 +31,7 @@ module.exports = { REDIS_PASSWORD: process.env.REDIS_PASSWORD, INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, /* TODO: to remove - once deployment removed */ - COUCH_DB_USERNAME: process.env.COUCH_DB_USER, + COUCH_DB_USERNAME: process.env.COUCH_DB_USERNAME, COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD, _set(key, value) { process.env[key] = value From 0bfbedac80288de6ec820e596a7c870fdfcdfd23 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 16 Aug 2021 16:47:26 +0100 Subject: [PATCH 05/29] lint --- packages/server/src/api/controllers/row/internalSearch.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index 20147a7857..c5bd01b383 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -1,5 +1,4 @@ const { SearchIndexes } = require("../../../db/utils") -const env = require("../../../environment") const fetch = require("node-fetch") const { getCouchUrl } = require("@budibase/auth/db") From 2661d1c0b4edb5020299353b451070064fbe58e1 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 16 Aug 2021 17:17:48 +0100 Subject: [PATCH 06/29] lint :sparkles: --- packages/auth/src/db/utils.js | 2 +- packages/server/src/api/controllers/row/internalSearch.js | 4 +++- packages/server/src/db/client.js | 2 +- packages/worker/src/db/index.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 7c44664a68..2ac23d02a5 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -314,4 +314,4 @@ exports.Replication = Replication exports.getScopedConfig = getScopedConfig exports.generateConfigID = generateConfigID exports.getConfigParams = getConfigParams -exports.getScopedFullConfig = getScopedFullConfig \ No newline at end of file +exports.getScopedFullConfig = getScopedFullConfig diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index c5bd01b383..cc35da40ec 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -233,7 +233,9 @@ class QueryBuilder { } async run() { - const url = `${getCouchUrl()}/${this.appId}/_design/database/_search/${SearchIndexes.ROWS}` + const url = `${getCouchUrl()}/${this.appId}/_design/database/_search/${ + SearchIndexes.ROWS + }` const body = this.buildSearchBody() return await runQuery(url, body) } diff --git a/packages/server/src/db/client.js b/packages/server/src/db/client.js index 887b287c84..9a244fee17 100644 --- a/packages/server/src/db/client.js +++ b/packages/server/src/db/client.js @@ -15,7 +15,7 @@ let POUCH_DB_DEFAULTS = { auth: { username: env.COUCH_DB_USERNAME, password: env.COUCH_DB_PASSWORD, - } + }, } if (env.isTest()) { diff --git a/packages/worker/src/db/index.js b/packages/worker/src/db/index.js index d09ddf0652..c0676634f7 100644 --- a/packages/worker/src/db/index.js +++ b/packages/worker/src/db/index.js @@ -10,7 +10,7 @@ let POUCH_DB_DEFAULTS = { auth: { username: env.COUCH_DB_USERNAME, password: env.COUCH_DB_PASSWORD, - } + }, } if (env.isTest()) { From 0cc16ee5c299d038c0a8272a34285321fae2491a Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 16 Aug 2021 16:35:51 +0000 Subject: [PATCH 07/29] v0.9.106 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lerna.json b/lerna.json index 825ab2f1f1..30b42fc1ec 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.105", + "version": "0.9.106", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index ea638f859f..db542205ff 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.105", + "version": "0.9.106", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index c8f93c9dfb..b1951d9874 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.105", + "version": "0.9.106", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index a7ed98b639..9595ad6035 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.105", + "version": "0.9.106", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.105", - "@budibase/client": "^0.9.105", + "@budibase/bbui": "^0.9.106", + "@budibase/client": "^0.9.106", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.105", + "@budibase/string-templates": "^0.9.106", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 0dc653a296..aa5b558bd5 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.105", + "version": "0.9.106", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 6fe0e6b3bf..4fe16bc42a 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.105", + "version": "0.9.106", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.105", - "@budibase/standard-components": "^0.9.105", - "@budibase/string-templates": "^0.9.105", + "@budibase/bbui": "^0.9.106", + "@budibase/standard-components": "^0.9.106", + "@budibase/string-templates": "^0.9.106", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index 7ca5437433..ad9a146828 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.105", + "version": "0.9.106", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -60,9 +60,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.105", - "@budibase/client": "^0.9.105", - "@budibase/string-templates": "^0.9.105", + "@budibase/auth": "^0.9.106", + "@budibase/client": "^0.9.106", + "@budibase/string-templates": "^0.9.106", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -115,7 +115,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.105", + "@budibase/standard-components": "^0.9.106", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index a9bdbf6428..2b017c90ae 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.105", + "version": "0.9.106", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.105", + "@budibase/bbui": "^0.9.106", "@spectrum-css/card": "^3.0.3", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index d980f2b361..f124d57643 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.105", + "version": "0.9.106", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 9e33e6ac64..8b504aa44b 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.105", + "version": "0.9.106", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.105", - "@budibase/string-templates": "^0.9.105", + "@budibase/auth": "^0.9.106", + "@budibase/string-templates": "^0.9.106", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 8e1e016c66fe9192dbf5416260b5013dfd46a003 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 17 Aug 2021 07:16:43 +0100 Subject: [PATCH 08/29] Revert "Feature/couchdb auth" --- packages/auth/src/db/utils.js | 13 +------------ packages/auth/src/environment.js | 2 -- packages/server/scripts/dev/manage.js | 2 +- .../src/api/controllers/row/internalSearch.js | 6 ++---- packages/server/src/db/client.js | 4 ---- packages/server/src/environment.js | 2 -- packages/worker/scripts/dev/manage.js | 2 +- packages/worker/src/db/index.js | 4 ---- 8 files changed, 5 insertions(+), 30 deletions(-) diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 2ac23d02a5..1fc78f4182 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -159,17 +159,6 @@ exports.getDeployedAppID = appId => { return appId } -exports.getCouchUrl = () => { - // username and password already exist in URL - if (env.COUCH_DB_URL.includes("@")) { - return env.COUCH_DB_URL - } - - const [protocol, ...rest] = env.COUCH_DB_URL.split("://") - - return `${protocol}://${env.COUCH_DB_USERNAME}:${env.COUCH_DB_PASSWORD}@${rest}` -} - /** * if in production this will use the CouchDB _all_dbs call to retrieve a list of databases. If testing * when using Pouch it will use the pouchdb-all-dbs package. @@ -179,7 +168,7 @@ exports.getAllDbs = async () => { if (env.isTest()) { return getCouch().allDbs() } - const response = await fetch(`${exports.getCouchUrl()}/_all_dbs`) + const response = await fetch(`${env.COUCH_DB_URL}/_all_dbs`) if (response.status === 200) { return response.json() } else { diff --git a/packages/auth/src/environment.js b/packages/auth/src/environment.js index e64a1c75f0..355843d02d 100644 --- a/packages/auth/src/environment.js +++ b/packages/auth/src/environment.js @@ -9,8 +9,6 @@ function isTest() { module.exports = { JWT_SECRET: process.env.JWT_SECRET, COUCH_DB_URL: process.env.COUCH_DB_URL, - COUCH_DB_USERNAME: process.env.COUCH_DB_USER, - COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD, SALT_ROUNDS: process.env.SALT_ROUNDS, REDIS_URL: process.env.REDIS_URL, REDIS_PASSWORD: process.env.REDIS_PASSWORD, diff --git a/packages/server/scripts/dev/manage.js b/packages/server/scripts/dev/manage.js index 7e9d7f6a07..ffd8c6b9e3 100644 --- a/packages/server/scripts/dev/manage.js +++ b/packages/server/scripts/dev/manage.js @@ -36,7 +36,7 @@ async function init() { const envFileJson = { PORT: 4001, MINIO_URL: "http://localhost:10000/", - COUCH_DB_URL: "http://localhost:10000/db/", + COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", REDIS_URL: "localhost:6379", WORKER_URL: "http://localhost:4002", INTERNAL_API_KEY: "budibase", diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index cc35da40ec..c13091d6e8 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -1,6 +1,6 @@ const { SearchIndexes } = require("../../../db/utils") +const env = require("../../../environment") const fetch = require("node-fetch") -const { getCouchUrl } = require("@budibase/auth/db") /** * Class to build lucene query URLs. @@ -233,9 +233,7 @@ class QueryBuilder { } async run() { - const url = `${getCouchUrl()}/${this.appId}/_design/database/_search/${ - SearchIndexes.ROWS - }` + const url = `${env.COUCH_DB_URL}/${this.appId}/_design/database/_search/${SearchIndexes.ROWS}` const body = this.buildSearchBody() return await runQuery(url, body) } diff --git a/packages/server/src/db/client.js b/packages/server/src/db/client.js index 9a244fee17..d50d72b18d 100644 --- a/packages/server/src/db/client.js +++ b/packages/server/src/db/client.js @@ -12,10 +12,6 @@ PouchDB.adapter("writableStream", replicationStream.adapters.writableStream) let POUCH_DB_DEFAULTS = { prefix: COUCH_DB_URL, - auth: { - username: env.COUCH_DB_USERNAME, - password: env.COUCH_DB_PASSWORD, - }, } if (env.isTest()) { diff --git a/packages/server/src/environment.js b/packages/server/src/environment.js index 45c7673851..52c680f65a 100644 --- a/packages/server/src/environment.js +++ b/packages/server/src/environment.js @@ -23,8 +23,6 @@ module.exports = { // important PORT: process.env.PORT, JWT_SECRET: process.env.JWT_SECRET, - COUCH_DB_USERNAME: process.env.COUCH_DB_USER, - COUCH_DB_PASSWORD: process.env.COUCH_DB_PASSWORD, COUCH_DB_URL: process.env.COUCH_DB_URL, MINIO_URL: process.env.MINIO_URL, WORKER_URL: process.env.WORKER_URL, diff --git a/packages/worker/scripts/dev/manage.js b/packages/worker/scripts/dev/manage.js index d7eb76fc74..b9d28b6278 100644 --- a/packages/worker/scripts/dev/manage.js +++ b/packages/worker/scripts/dev/manage.js @@ -17,7 +17,7 @@ async function init() { REDIS_URL: "localhost:6379", REDIS_PASSWORD: "budibase", MINIO_URL: "http://localhost:10000/", - COUCH_DB_URL: "http://localhost:10000/db/", + COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/", } let envFile = "" Object.keys(envFileJson).forEach(key => { diff --git a/packages/worker/src/db/index.js b/packages/worker/src/db/index.js index c0676634f7..d6d035cff1 100644 --- a/packages/worker/src/db/index.js +++ b/packages/worker/src/db/index.js @@ -7,10 +7,6 @@ const COUCH_DB_URL = env.COUCH_DB_URL || "http://localhost:10000/db/" let POUCH_DB_DEFAULTS = { prefix: COUCH_DB_URL, - auth: { - username: env.COUCH_DB_USERNAME, - password: env.COUCH_DB_PASSWORD, - }, } if (env.isTest()) { From a2efbb13380d08a2ffd2c08378cd16ca774c0e2a Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 17 Aug 2021 06:25:14 +0000 Subject: [PATCH 09/29] v0.9.107 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lerna.json b/lerna.json index 30b42fc1ec..1b2dfb6bbd 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.106", + "version": "0.9.107", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index db542205ff..8e8395b21e 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.106", + "version": "0.9.107", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index b1951d9874..7ea6d15a59 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.106", + "version": "0.9.107", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 9595ad6035..2aa61c79ba 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.106", + "version": "0.9.107", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.106", - "@budibase/client": "^0.9.106", + "@budibase/bbui": "^0.9.107", + "@budibase/client": "^0.9.107", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.106", + "@budibase/string-templates": "^0.9.107", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index aa5b558bd5..c328df69c0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.106", + "version": "0.9.107", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 4fe16bc42a..8972171863 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.106", + "version": "0.9.107", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.106", - "@budibase/standard-components": "^0.9.106", - "@budibase/string-templates": "^0.9.106", + "@budibase/bbui": "^0.9.107", + "@budibase/standard-components": "^0.9.107", + "@budibase/string-templates": "^0.9.107", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index ad9a146828..5daca5d40f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.106", + "version": "0.9.107", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -60,9 +60,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.106", - "@budibase/client": "^0.9.106", - "@budibase/string-templates": "^0.9.106", + "@budibase/auth": "^0.9.107", + "@budibase/client": "^0.9.107", + "@budibase/string-templates": "^0.9.107", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -115,7 +115,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.106", + "@budibase/standard-components": "^0.9.107", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 2b017c90ae..96b2deff04 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.106", + "version": "0.9.107", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.106", + "@budibase/bbui": "^0.9.107", "@spectrum-css/card": "^3.0.3", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index f124d57643..b64b19bb97 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.106", + "version": "0.9.107", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 8b504aa44b..9d6b98aa6d 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.106", + "version": "0.9.107", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.106", - "@budibase/string-templates": "^0.9.106", + "@budibase/auth": "^0.9.107", + "@budibase/string-templates": "^0.9.107", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 29c33d7ed45dd12efc3c5d4d4daea4b3550fd1a4 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 19 Aug 2021 17:18:41 +0100 Subject: [PATCH 10/29] Remove schema validation when inheriting initial values in forms --- packages/standard-components/src/forms/Form.svelte | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/standard-components/src/forms/Form.svelte b/packages/standard-components/src/forms/Form.svelte index 2514232ebc..b08a853437 100644 --- a/packages/standard-components/src/forms/Form.svelte +++ b/packages/standard-components/src/forms/Form.svelte @@ -24,12 +24,9 @@ if (["user", "url"].includes(context.closestComponentId)) { return {} } - // Only inherit values if the table ID matches + // Always inherit the closest data source const closestContext = context[`${context.closestComponentId}`] || {} - if (dataSource.tableId !== closestContext?.tableId) { - return {} - } - return closestContext + return closestContext || {} } $: initialValues = getInitialValues(actionType, dataSource, $context) From 73ea7a803261b2f530866499f57d3d7209d3db3c Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Thu, 19 Aug 2021 16:28:01 +0000 Subject: [PATCH 11/29] v0.9.108 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lerna.json b/lerna.json index 1b2dfb6bbd..f77edaab18 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.107", + "version": "0.9.108", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 8e8395b21e..1ef8877eb7 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.107", + "version": "0.9.108", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 7ea6d15a59..9fc53e0f58 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.107", + "version": "0.9.108", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 2aa61c79ba..07ad4c935c 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.107", + "version": "0.9.108", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.107", - "@budibase/client": "^0.9.107", + "@budibase/bbui": "^0.9.108", + "@budibase/client": "^0.9.108", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.107", + "@budibase/string-templates": "^0.9.108", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index c328df69c0..68934a0c71 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.107", + "version": "0.9.108", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 8972171863..08d98ac4b7 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.107", + "version": "0.9.108", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.107", - "@budibase/standard-components": "^0.9.107", - "@budibase/string-templates": "^0.9.107", + "@budibase/bbui": "^0.9.108", + "@budibase/standard-components": "^0.9.108", + "@budibase/string-templates": "^0.9.108", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index 5daca5d40f..a2cf814e14 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.107", + "version": "0.9.108", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -60,9 +60,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.107", - "@budibase/client": "^0.9.107", - "@budibase/string-templates": "^0.9.107", + "@budibase/auth": "^0.9.108", + "@budibase/client": "^0.9.108", + "@budibase/string-templates": "^0.9.108", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -115,7 +115,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.107", + "@budibase/standard-components": "^0.9.108", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 96b2deff04..cb29853a38 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.107", + "version": "0.9.108", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.107", + "@budibase/bbui": "^0.9.108", "@spectrum-css/card": "^3.0.3", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index b64b19bb97..13626d1b99 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.107", + "version": "0.9.108", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 9d6b98aa6d..5be0d4f920 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.107", + "version": "0.9.108", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.107", - "@budibase/string-templates": "^0.9.107", + "@budibase/auth": "^0.9.108", + "@budibase/string-templates": "^0.9.108", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 0fb566a3dd7503c8279867ccb4dc98cbf7bd3159 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 20 Aug 2021 09:47:08 +0100 Subject: [PATCH 12/29] allow users to override watchtower port --- hosting/docker-compose.yaml | 2 ++ hosting/hosting.properties | 1 + packages/cli/src/hosting/makeEnv.js | 1 + 3 files changed, 4 insertions(+) diff --git a/hosting/docker-compose.yaml b/hosting/docker-compose.yaml index 9cdf2b2114..fffadae24b 100644 --- a/hosting/docker-compose.yaml +++ b/hosting/docker-compose.yaml @@ -119,6 +119,8 @@ services: watchtower-service: image: containrrr/watchtower + ports: + - "${WATCHTOWER_PORT}:8080" volumes: - /var/run/docker.sock:/var/run/docker.sock command: --debug --http-api-update bbapps bbworker diff --git a/hosting/hosting.properties b/hosting/hosting.properties index d11972bc4b..6382bf2f07 100644 --- a/hosting/hosting.properties +++ b/hosting/hosting.properties @@ -17,4 +17,5 @@ WORKER_PORT=4003 MINIO_PORT=4004 COUCH_DB_PORT=4005 REDIS_PORT=6379 +WATCHTOWER_PORT=8080 BUDIBASE_ENVIRONMENT=PRODUCTION diff --git a/packages/cli/src/hosting/makeEnv.js b/packages/cli/src/hosting/makeEnv.js index 8806c2e1e6..ff59e60579 100644 --- a/packages/cli/src/hosting/makeEnv.js +++ b/packages/cli/src/hosting/makeEnv.js @@ -26,6 +26,7 @@ WORKER_PORT=4003 MINIO_PORT=4004 COUCH_DB_PORT=4005 REDIS_PORT=6379 +WATCHTOWER_PORT=8080 BUDIBASE_ENVIRONMENT=PRODUCTION` } From c3a6e13103062fff1e2e199b938bde065efff6c8 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 16 Aug 2021 09:44:15 +0100 Subject: [PATCH 13/29] Bug fix for unable to navigate from sql screen --- .../[selectedDatasource]/index.svelte | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte index b0377d2f27..0cd667a82e 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte @@ -9,7 +9,6 @@ import ICONS from "components/backend/DatasourceNavigator/icons" import { capitalise } from "helpers" - let unsaved = false let relationshipModal let displayColumnModal let selectedFromRelationship, selectedToRelationship @@ -71,7 +70,6 @@ // Create datasource await datasources.save(datasource) notifications.success(`Datasource ${name} updated successfully.`) - unsaved = false } catch (err) { notifications.error(`Error saving datasource: ${err}`) } @@ -81,7 +79,6 @@ try { await datasources.updateSchema(datasource) notifications.success(`Datasource ${name} tables updated successfully.`) - unsaved = false await tables.fetch() } catch (err) { notifications.error(`Error updating datasource schema: ${err}`) @@ -98,10 +95,6 @@ $goto(`../../table/${table._id}`) } - function setUnsaved() { - unsaved = true - } - function openRelationshipModal(fromRelationship, toRelationship) { selectedFromRelationship = fromRelationship || {} selectedToRelationship = toRelationship || {} @@ -111,16 +104,6 @@ function openDisplayColumnModal() { displayColumnModal.show() } - - $beforeUrlChange(() => { - if (unsaved) { - notifications.error( - "Unsaved changes. Please save your datasource configuration before leaving." - ) - return false - } - return true - }) @@ -164,7 +147,6 @@ {#if datasource.plus} From 461311bb06edca4d702e052732ab545f6b44c9b8 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Wed, 18 Aug 2021 00:02:17 +0100 Subject: [PATCH 14/29] fixes organisation logo not showing --- .../data/datasource/[selectedDatasource]/index.svelte | 2 +- .../src/pages/builder/portal/settings/organisation.svelte | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte index 0cd667a82e..fc82e3a11c 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/index.svelte @@ -1,5 +1,5 @@