forked from tsai/budibase
10 changed files with 286 additions and 1137 deletions
@ -1,16 +0,0 @@ |
|||||
version: "3" |
|
||||
|
|
||||
services: |
|
||||
app-service: |
|
||||
build: ./server |
|
||||
volumes: |
|
||||
- ./server:/app |
|
||||
environment: |
|
||||
SELF_HOSTED: 1 |
|
||||
PORT: 4002 |
|
||||
|
|
||||
worker-service: |
|
||||
build: ./worker |
|
||||
environment: |
|
||||
SELF_HOSTED: 1, |
|
||||
PORT: 4003 |
|
||||
@ -1 +0,0 @@ |
|||||
../../packages/server/ |
|
||||
@ -1 +0,0 @@ |
|||||
../../packages/worker/ |
|
||||
@ -0,0 +1,99 @@ |
|||||
|
version: "3" |
||||
|
|
||||
|
# optional ports are specified throughout for more advanced use cases. |
||||
|
|
||||
|
services: |
||||
|
# app-service: |
||||
|
# restart: always |
||||
|
# #build: ./build/server |
||||
|
# image: budibase/budibase-apps |
||||
|
# ports: |
||||
|
# - "${APP_PORT}:4002" |
||||
|
# environment: |
||||
|
# SELF_HOSTED: 1 |
||||
|
# CLOUD: 1 |
||||
|
# COUCH_DB_URL: http://${COUCH_DB_USER}:${COUCH_DB_PASSWORD}@couchdb-service:5984 |
||||
|
# WORKER_URL: http://worker-service:4003 |
||||
|
# HOSTING_KEY: ${HOSTING_KEY} |
||||
|
# BUDIBASE_ENVIRONMENT: ${BUDIBASE_ENVIRONMENT} |
||||
|
# PORT: 4002 |
||||
|
# JWT_SECRET: ${JWT_SECRET} |
||||
|
# depends_on: |
||||
|
# - worker-service |
||||
|
|
||||
|
# worker-service: |
||||
|
# restart: always |
||||
|
# #build: ./build/worker |
||||
|
# image: budibase/budibase-worker |
||||
|
# ports: |
||||
|
# - "${WORKER_PORT}:4003" |
||||
|
# environment: |
||||
|
# SELF_HOSTED: 1, |
||||
|
# PORT: 4003 |
||||
|
# MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} |
||||
|
# MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} |
||||
|
# RAW_MINIO_URL: http://minio-service:9000 |
||||
|
# COUCH_DB_USERNAME: ${COUCH_DB_USER} |
||||
|
# COUCH_DB_PASSWORD: ${COUCH_DB_PASSWORD} |
||||
|
# COUCH_DB_URL: http://${COUCH_DB_USER}:${COUCH_DB_PASSWORD}@couchdb-service:5984 |
||||
|
# SELF_HOST_KEY: ${HOSTING_KEY} |
||||
|
# depends_on: |
||||
|
# - minio-service |
||||
|
# - couch-init |
||||
|
|
||||
|
minio-service: |
||||
|
restart: always |
||||
|
image: minio/minio |
||||
|
volumes: |
||||
|
- minio_data:/data |
||||
|
ports: |
||||
|
- "${MINIO_PORT}:9000" |
||||
|
environment: |
||||
|
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} |
||||
|
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} |
||||
|
MINIO_BROWSER: "off" |
||||
|
command: server /data |
||||
|
healthcheck: |
||||
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] |
||||
|
interval: 30s |
||||
|
timeout: 20s |
||||
|
retries: 3 |
||||
|
|
||||
|
proxy-service: |
||||
|
restart: always |
||||
|
image: envoyproxy/envoy:v1.16-latest |
||||
|
volumes: |
||||
|
- ./envoy.dev.yaml:/etc/envoy/envoy.yaml |
||||
|
ports: |
||||
|
- "${MAIN_PORT}:10000" |
||||
|
#- "9901:9901" |
||||
|
depends_on: |
||||
|
- minio-service |
||||
|
- couchdb-service |
||||
|
|
||||
|
couchdb-service: |
||||
|
restart: always |
||||
|
image: apache/couchdb:3.0 |
||||
|
environment: |
||||
|
- COUCHDB_PASSWORD=${COUCH_DB_PASSWORD} |
||||
|
- COUCHDB_USER=${COUCH_DB_USER} |
||||
|
ports: |
||||
|
- "${COUCH_DB_PORT}:5984" |
||||
|
#- "4369:4369" |
||||
|
#- "9100:9100" |
||||
|
volumes: |
||||
|
- couchdb_data:/opt/couchdb/data |
||||
|
|
||||
|
couch-init: |
||||
|
image: curlimages/curl |
||||
|
environment: |
||||
|
PUT_CALL: "curl -u ${COUCH_DB_USER}:${COUCH_DB_PASSWORD} -X PUT couchdb-service:5984" |
||||
|
depends_on: |
||||
|
- couchdb-service |
||||
|
command: ["sh","-c","sleep 10 && $${PUT_CALL}/_users && $${PUT_CALL}/_replicator; fg;"] |
||||
|
|
||||
|
volumes: |
||||
|
couchdb_data: |
||||
|
driver: local |
||||
|
minio_data: |
||||
|
driver: local |
||||
@ -0,0 +1,109 @@ |
|||||
|
static_resources: |
||||
|
listeners: |
||||
|
- name: main_listener |
||||
|
address: |
||||
|
socket_address: { address: 0.0.0.0, port_value: 10000 } |
||||
|
filter_chains: |
||||
|
- filters: |
||||
|
- name: envoy.filters.network.http_connection_manager |
||||
|
typed_config: |
||||
|
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager |
||||
|
stat_prefix: ingress |
||||
|
codec_type: auto |
||||
|
route_config: |
||||
|
name: local_route |
||||
|
virtual_hosts: |
||||
|
- name: local_services |
||||
|
domains: ["*"] |
||||
|
routes: |
||||
|
# - match: { prefix: "/app/" } |
||||
|
# route: |
||||
|
# cluster: app-service |
||||
|
# prefix_rewrite: "/" |
||||
|
|
||||
|
# # special case for presenting our static self hosting page |
||||
|
# - match: { path: "/" } |
||||
|
# route: |
||||
|
# cluster: app-service |
||||
|
|
||||
|
# special case for when API requests are made, can just forward, not to minio |
||||
|
# - match: { prefix: "/api/" } |
||||
|
# route: |
||||
|
# cluster: app-service |
||||
|
|
||||
|
# - match: { prefix: "/worker/" } |
||||
|
# route: |
||||
|
# cluster: worker-service |
||||
|
# prefix_rewrite: "/" |
||||
|
|
||||
|
- match: { prefix: "/db/" } |
||||
|
route: |
||||
|
cluster: couchdb-service |
||||
|
prefix_rewrite: "/" |
||||
|
|
||||
|
# minio is on the default route because this works |
||||
|
# best, minio + AWS SDK doesn't handle path proxy |
||||
|
- match: { prefix: "/" } |
||||
|
route: |
||||
|
cluster: minio-service |
||||
|
|
||||
|
http_filters: |
||||
|
- name: envoy.filters.http.router |
||||
|
|
||||
|
clusters: |
||||
|
# - name: app-service |
||||
|
# connect_timeout: 0.25s |
||||
|
# type: strict_dns |
||||
|
# lb_policy: round_robin |
||||
|
# load_assignment: |
||||
|
# cluster_name: app-service |
||||
|
# endpoints: |
||||
|
# - lb_endpoints: |
||||
|
# - endpoint: |
||||
|
# address: |
||||
|
# socket_address: |
||||
|
# address: app-service |
||||
|
# port_value: 4002 |
||||
|
|
||||
|
- name: minio-service |
||||
|
connect_timeout: 0.25s |
||||
|
type: strict_dns |
||||
|
lb_policy: round_robin |
||||
|
load_assignment: |
||||
|
cluster_name: minio-service |
||||
|
endpoints: |
||||
|
- lb_endpoints: |
||||
|
- endpoint: |
||||
|
address: |
||||
|
socket_address: |
||||
|
address: minio-service |
||||
|
port_value: 9000 |
||||
|
|
||||
|
# - name: worker-service |
||||
|
# connect_timeout: 0.25s |
||||
|
# type: strict_dns |
||||
|
# lb_policy: round_robin |
||||
|
# load_assignment: |
||||
|
# cluster_name: worker-service |
||||
|
# endpoints: |
||||
|
# - lb_endpoints: |
||||
|
# - endpoint: |
||||
|
# address: |
||||
|
# socket_address: |
||||
|
# address: worker-service |
||||
|
# port_value: 4003 |
||||
|
|
||||
|
- name: couchdb-service |
||||
|
connect_timeout: 0.25s |
||||
|
type: strict_dns |
||||
|
lb_policy: round_robin |
||||
|
load_assignment: |
||||
|
cluster_name: couchdb-service |
||||
|
endpoints: |
||||
|
- lb_endpoints: |
||||
|
- endpoint: |
||||
|
address: |
||||
|
socket_address: |
||||
|
address: couchdb-service |
||||
|
port_value: 5984 |
||||
|
|
||||
@ -1 +1,22 @@ |
|||||
PORT=4001 |
PORT=4001 |
||||
|
|
||||
|
# Use this password when configuring your self hosting settings |
||||
|
# This should be updated |
||||
|
HOSTING_KEY=budibase |
||||
|
|
||||
|
# 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 |
||||
|
COUCH_DB_URL=http://budibase:budibase@localhost:10000/db/ |
||||
|
|
||||
|
# 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 |
||||
|
# BUDIBASE_ENVIRONMENT=PRODUCTION |
||||
|
|
||||
|
|||||
@ -1,17 +1,17 @@ |
|||||
const { join } = require("path") |
// const { join } = require("path")
|
||||
const { homedir } = require("os") |
// const { homedir } = require("os")
|
||||
|
|
||||
const initialiseBudibase = require("../src/utilities/initialiseBudibase") |
// // const initialiseBudibase = require("../src/utilities/initialiseBudibase")
|
||||
const DIRECTORY = "~/.budibase" |
// // const DIRECTORY = "~/.budibase"
|
||||
|
|
||||
function run() { |
// function run() {
|
||||
let opts = {} |
// let opts = {}
|
||||
let dir = DIRECTORY |
// // let dir = DIRECTORY
|
||||
opts.quiet = true |
// opts.quiet = true
|
||||
opts.dir = dir.startsWith("~") ? join(homedir(), dir.substring(1)) : dir |
// // opts.dir = dir.startsWith("~") ? join(homedir(), dir.substring(1)) : dir
|
||||
return initialiseBudibase(opts) |
// return initialiseBudibase(opts)
|
||||
} |
// }
|
||||
|
|
||||
run().then(() => { |
// run().then(() => {
|
||||
console.log("Init complete.") |
// console.log("Init complete.")
|
||||
}) |
// })
|
||||
|
|||||
@ -1,37 +1,37 @@ |
|||||
const { existsSync, readFile, writeFile, ensureDir } = require("fs-extra") |
// const { existsSync, readFile, writeFile, ensureDir } = require("fs-extra")
|
||||
const { join, resolve } = require("./centralPath") |
// const { join, resolve } = require("./centralPath")
|
||||
const { processString } = require("@budibase/string-templates") |
// const { processString } = require("@budibase/string-templates")
|
||||
const uuid = require("uuid") |
// const uuid = require("uuid")
|
||||
|
|
||||
module.exports = async opts => { |
// module.exports = async opts => {
|
||||
await ensureDir(opts.dir) |
// // await ensureDir(opts.dir)
|
||||
await setCouchDbUrl(opts) |
// await setCouchDbUrl(opts)
|
||||
|
|
||||
// need an env file
|
// // need an env file
|
||||
await createDevEnvFile(opts) |
// await createDevEnvFile(opts)
|
||||
} |
// }
|
||||
|
|
||||
const setCouchDbUrl = async opts => { |
// const setCouchDbUrl = async opts => {
|
||||
if (!opts.couchDbUrl) { |
// if (!opts.couchDbUrl) {
|
||||
const dataDir = join(opts.dir, ".data") |
// const dataDir = join(opts.dir, ".data")
|
||||
await ensureDir(dataDir) |
// await ensureDir(dataDir)
|
||||
opts.couchDbUrl = |
// opts.couchDbUrl =
|
||||
dataDir + (dataDir.endsWith("/") || dataDir.endsWith("\\") ? "" : "/") |
// dataDir + (dataDir.endsWith("/") || dataDir.endsWith("\\") ? "" : "/")
|
||||
} |
// }
|
||||
} |
// }
|
||||
|
|
||||
const createDevEnvFile = async opts => { |
// const createDevEnvFile = async opts => {
|
||||
const destConfigFile = join(opts.dir, "./.env") |
// const destConfigFile = join(opts.dir, "./.env")
|
||||
let createConfig = !existsSync(destConfigFile) || opts.quiet |
// let createConfig = !existsSync(destConfigFile) || opts.quiet
|
||||
if (createConfig) { |
// if (createConfig) {
|
||||
const template = await readFile( |
// const template = await readFile(
|
||||
resolve(__dirname, "..", "..", ".env.template"), |
// resolve(__dirname, "..", "..", ".env.template"),
|
||||
{ |
// {
|
||||
encoding: "utf8", |
// encoding: "utf8",
|
||||
} |
// }
|
||||
) |
// )
|
||||
opts.cookieKey1 = opts.cookieKey1 || uuid.v4() |
// opts.cookieKey1 = opts.cookieKey1 || uuid.v4()
|
||||
const config = await processString(template, opts) |
// const config = await processString(template, opts)
|
||||
await writeFile(destConfigFile, config, { flag: "w+" }) |
// await writeFile(destConfigFile, config, { flag: "w+" })
|
||||
} |
// }
|
||||
} |
// }
|
||||
|
|||||
File diff suppressed because it is too large
Loading…
Reference in new issue