redis, tidy ups

This commit is contained in:
Martin McKeaveney 2021-03-22 16:18:29 +00:00
parent 6742c3ca99
commit 306d29d870
7 changed files with 42 additions and 93 deletions

View File

@ -3,45 +3,8 @@ 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:
container_name: budi-minio-dev
restart: always
image: minio/minio
volumes:
@ -60,6 +23,7 @@ services:
retries: 3
proxy-service:
container_name: budi-envoy-dev
restart: always
image: envoyproxy/envoy:v1.16-latest
volumes:
@ -72,6 +36,7 @@ services:
- couchdb-service
couchdb-service:
container_name: budi-couchdb-dev
restart: always
image: apache/couchdb:3.0
environment:
@ -83,7 +48,7 @@ services:
#- "9100:9100"
volumes:
- couchdb_data:/opt/couchdb/data
couch-init:
image: curlimages/curl
environment:
@ -92,8 +57,23 @@ services:
- couchdb-service
command: ["sh","-c","sleep 10 && $${PUT_CALL}/_users && $${PUT_CALL}/_replicator; fg;"]
redis-service:
container_name: budi-redis-dev
restart: always
image: redis
environment:
- COUCHDB_PASSWORD=${COUCH_DB_PASSWORD}
- COUCHDB_USER=${COUCH_DB_USER}
ports:
- "${REDIS_PORT}:6379"
volumes:
- redis_data:/data
volumes:
couchdb_data:
driver: local
minio_data:
driver: local
redis_data:
driver: local

View File

@ -16,31 +16,16 @@ static_resources:
- 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: "/"
- match: { prefix: "/cache/" }
route:
cluster: redis-service
prefix_rewrite: "/"
# minio is on the default route because this works
# best, minio + AWS SDK doesn't handle path proxy
- match: { prefix: "/" }
@ -51,20 +36,6 @@ static_resources:
- 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
@ -79,20 +50,6 @@ static_resources:
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
@ -107,3 +64,16 @@ static_resources:
address: couchdb-service
port_value: 5984
- name: redis-service
connect_timeout: 0.25s
type: strict_dns
lb_policy: round_robin
load_assignment:
cluster_name: redis-service
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: redis-service
port_value: 6379

View File

@ -18,4 +18,5 @@ APP_PORT=4002
WORKER_PORT=4003
MINIO_PORT=4004
COUCH_DB_PORT=4005
REDIS_PORT=6379
BUDIBASE_ENVIRONMENT=PRODUCTION

View File

@ -26,6 +26,7 @@ APP_PORT=4002
WORKER_PORT=4003
MINIO_PORT=4004
COUCH_DB_PORT=4005
REDIS_PORT=6379
BUDIBASE_ENVIRONMENT=PRODUCTION`
}

View File

@ -19,4 +19,5 @@ COUCH_DB_URL=http://budibase:budibase@localhost:10000/db/
# MINIO_PORT=4004
# COUCH_DB_PORT=4005
# BUDIBASE_ENVIRONMENT=PRODUCTION
# REDIS_PORT=6379

View File

@ -33,6 +33,5 @@
"pouchdb": "^7.2.2",
"pouchdb-all-dbs": "^1.0.2",
"server-destroy": "^1.0.1"
},
"gitHead": "1b95326b20d1352d36305910259228b96a683dc7"
}
}

View File

@ -1,12 +1,9 @@
const PouchDB = require("pouchdb")
const allDbs = require("pouchdb-all-dbs")
const env = require("../environment")
const { join } = require("path")
const { homedir } = require("os")
// level option is purely for testing (development)
const COUCH_DB_URL =
env.COUCH_DB_URL || `leveldb://${join(homedir(), ".budibase")}/.data/`
const COUCH_DB_URL = env.COUCH_DB_URL || "http://localhost:10000/db/"
const Pouch = PouchDB.defaults({
prefix: COUCH_DB_URL,