Some fixes for CLI to get exporting/importing with different ports working, as well as a fix for access to minio through proxy.
This commit is contained in:
parent
51251b1fe2
commit
6d72e51d16
|
@ -171,11 +171,13 @@ http {
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
|
||||||
proxy_connect_timeout 300;
|
proxy_connect_timeout 300;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Connection "";
|
proxy_set_header Connection "";
|
||||||
chunked_transfer_encoding off;
|
chunked_transfer_encoding off;
|
||||||
|
|
||||||
proxy_pass http://$minio:9000;
|
proxy_pass http://$minio:9000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,16 +16,21 @@ exports.exportObjects = async () => {
|
||||||
const path = join(TEMP_DIR, MINIO_DIR)
|
const path = join(TEMP_DIR, MINIO_DIR)
|
||||||
fs.mkdirSync(path)
|
fs.mkdirSync(path)
|
||||||
let fullList = []
|
let fullList = []
|
||||||
|
let errorCount = 0
|
||||||
for (let bucket of bucketList) {
|
for (let bucket of bucketList) {
|
||||||
const client = ObjectStore(bucket)
|
const client = ObjectStore(bucket)
|
||||||
try {
|
try {
|
||||||
await client.headBucket().promise()
|
await client.headBucket().promise()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
errorCount++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const list = await client.listObjectsV2().promise()
|
const list = await client.listObjectsV2().promise()
|
||||||
fullList = fullList.concat(list.Contents.map(el => ({ ...el, bucket })))
|
fullList = fullList.concat(list.Contents.map(el => ({ ...el, bucket })))
|
||||||
}
|
}
|
||||||
|
if (errorCount === bucketList.length) {
|
||||||
|
throw new Error("Unable to access MinIO/S3 - check environment config.")
|
||||||
|
}
|
||||||
const bar = progressBar(fullList.length)
|
const bar = progressBar(fullList.length)
|
||||||
let count = 0
|
let count = 0
|
||||||
for (let object of fullList) {
|
for (let object of fullList) {
|
||||||
|
|
|
@ -2,17 +2,19 @@ const dotenv = require("dotenv")
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const { string } = require("../questions")
|
const { string } = require("../questions")
|
||||||
const { getPouch } = require("../core/db")
|
const { getPouch } = require("../core/db")
|
||||||
|
const { env: environment } = require("@budibase/backend-core")
|
||||||
|
|
||||||
exports.DEFAULT_COUCH = "http://budibase:budibase@localhost:10000/db/"
|
|
||||||
exports.DEFAULT_MINIO = "http://localhost:10000/"
|
|
||||||
exports.TEMP_DIR = ".temp"
|
exports.TEMP_DIR = ".temp"
|
||||||
exports.COUCH_DIR = "couchdb"
|
exports.COUCH_DIR = "couchdb"
|
||||||
exports.MINIO_DIR = "minio"
|
exports.MINIO_DIR = "minio"
|
||||||
|
|
||||||
const REQUIRED = [
|
const REQUIRED = [
|
||||||
{ value: "MAIN_PORT", default: "10000" },
|
{ value: "MAIN_PORT", default: "10000" },
|
||||||
{ value: "COUCH_DB_URL", default: exports.DEFAULT_COUCH },
|
{
|
||||||
{ value: "MINIO_URL", default: exports.DEFAULT_MINIO },
|
value: "COUCH_DB_URL",
|
||||||
|
default: "http://budibase:budibase@localhost:10000/db/",
|
||||||
|
},
|
||||||
|
{ value: "MINIO_URL", default: "http://localhost:10000" },
|
||||||
{ value: "MINIO_ACCESS_KEY" },
|
{ value: "MINIO_ACCESS_KEY" },
|
||||||
{ value: "MINIO_SECRET_KEY" },
|
{ value: "MINIO_SECRET_KEY" },
|
||||||
]
|
]
|
||||||
|
@ -27,7 +29,7 @@ exports.checkURLs = config => {
|
||||||
] = `http://${username}:${password}@localhost:${mainPort}/db/`
|
] = `http://${username}:${password}@localhost:${mainPort}/db/`
|
||||||
}
|
}
|
||||||
if (!config["MINIO_URL"]) {
|
if (!config["MINIO_URL"]) {
|
||||||
config["MINIO_URL"] = exports.DEFAULT_MINIO
|
config["MINIO_URL"] = `http://localhost:${mainPort}/`
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
@ -65,6 +67,10 @@ exports.getConfig = async (envFile = true) => {
|
||||||
} else {
|
} else {
|
||||||
config = await exports.askQuestions()
|
config = await exports.askQuestions()
|
||||||
}
|
}
|
||||||
|
// fill out environment
|
||||||
|
for (let key of Object.keys(config)) {
|
||||||
|
environment._set(key, config[key])
|
||||||
|
}
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue