mirror of https://github.com/Budibase/budibase.git
34 changed files with 241 additions and 961 deletions
@ -0,0 +1,21 @@ |
|||||
|
# Use the main port in the builder for your self hosting URL, e.g. localhost:10000 |
||||
|
MAIN_PORT=10000 |
||||
|
|
||||
|
# This section contains all secrets pertaining to the system |
||||
|
# These should be updated |
||||
|
JWT_SECRET=testsecret |
||||
|
MINIO_ACCESS_KEY=budibase |
||||
|
MINIO_SECRET_KEY=budibase |
||||
|
COUCH_DB_PASSWORD=budibase |
||||
|
COUCH_DB_USER=budibase |
||||
|
REDIS_PASSWORD=budibase |
||||
|
INTERNAL_API_KEY=budibase |
||||
|
|
||||
|
# This section contains variables that do not need to be altered under normal circumstances |
||||
|
APP_PORT=4002 |
||||
|
WORKER_PORT=4003 |
||||
|
MINIO_PORT=4004 |
||||
|
COUCH_DB_PORT=4005 |
||||
|
REDIS_PORT=6379 |
||||
|
WATCHTOWER_PORT=6161 |
||||
|
BUDIBASE_ENVIRONMENT=PRODUCTION |
||||
@ -1,2 +0,0 @@ |
|||||
FROM nginx:latest |
|
||||
COPY nginx.conf /etc/nginx/nginx.conf |
|
||||
@ -1,2 +1,2 @@ |
|||||
FROM nginx:latest |
FROM nginx:latest |
||||
COPY nginx.conf /etc/nginx/nginx.conf |
COPY .generated-nginx.prod.conf /etc/nginx/nginx.conf |
||||
@ -0,0 +1,70 @@ |
|||||
|
#!/usr/bin/env node
|
||||
|
const path = require("path") |
||||
|
const fs = require("fs") |
||||
|
const { processStringSync } = require("@budibase/string-templates") |
||||
|
|
||||
|
const Configs = { |
||||
|
prod: { |
||||
|
k8s: true, |
||||
|
apps: "app-service.budibase.svc.cluster.local", |
||||
|
worker: "worker-service.budibase.svc.cluster.local", |
||||
|
minio: "minio-service.budibase.svc.cluster.local", |
||||
|
couchdb: "budibase-prod-svc-couchdb", |
||||
|
}, |
||||
|
preprod: { |
||||
|
k8s: true, |
||||
|
apps: "app-service.budibase.svc.cluster.local", |
||||
|
worker: "worker-service.budibase.svc.cluster.local", |
||||
|
minio: "minio-service.budibase.svc.cluster.local", |
||||
|
couchdb: "budibase-preprod-svc-couchdb", |
||||
|
}, |
||||
|
compose: { |
||||
|
compose: true, |
||||
|
apps: "app-service", |
||||
|
worker: "worker-service", |
||||
|
minio: "minio-service", |
||||
|
couchdb: "couchdb-service", |
||||
|
watchtower: "watchtower-service", |
||||
|
}, |
||||
|
} |
||||
|
|
||||
|
const Commands = { |
||||
|
Prod: "prod", |
||||
|
Preprod: "preprod", |
||||
|
Compose: "compose", |
||||
|
} |
||||
|
|
||||
|
async function init(managementCommand) { |
||||
|
const config = Configs[managementCommand] |
||||
|
const hostingPath = path.join(process.cwd(), "..", "..", "hosting") |
||||
|
const nginxHbsPath = path.join(hostingPath, "nginx.prod.conf.hbs") |
||||
|
const nginxOutputPath = path.join( |
||||
|
hostingPath, |
||||
|
"proxy", |
||||
|
".generated-nginx.prod.conf" |
||||
|
) |
||||
|
const contents = fs.readFileSync(nginxHbsPath, "utf8") |
||||
|
fs.writeFileSync(nginxOutputPath, processStringSync(contents, config)) |
||||
|
} |
||||
|
|
||||
|
const managementCommand = process.argv.slice(2)[0] |
||||
|
|
||||
|
if ( |
||||
|
!managementCommand || |
||||
|
!Object.values(Commands).some(command => managementCommand === command) |
||||
|
) { |
||||
|
throw new Error( |
||||
|
"You must supply either a 'compose', 'preprod' or 'prod' commmand to generate an NGINX config." |
||||
|
) |
||||
|
} |
||||
|
|
||||
|
init(managementCommand) |
||||
|
.then(() => { |
||||
|
console.log("Done! 🎉") |
||||
|
}) |
||||
|
.catch(err => { |
||||
|
console.error( |
||||
|
"Something went wrong while creating the nginx configuration", |
||||
|
err.message |
||||
|
) |
||||
|
}) |
||||
File diff suppressed because it is too large
Loading…
Reference in new issue