redis, tidy ups

This commit is contained in:
Martin McKeaveney 2021-03-22 16:18:29 +00:00
parent 2852a739a4
commit f7f385937c
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. # optional ports are specified throughout for more advanced use cases.
services: 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: minio-service:
container_name: budi-minio-dev
restart: always restart: always
image: minio/minio image: minio/minio
volumes: volumes:
@ -60,6 +23,7 @@ services:
retries: 3 retries: 3
proxy-service: proxy-service:
container_name: budi-envoy-dev
restart: always restart: always
image: envoyproxy/envoy:v1.16-latest image: envoyproxy/envoy:v1.16-latest
volumes: volumes:
@ -72,6 +36,7 @@ services:
- couchdb-service - couchdb-service
couchdb-service: couchdb-service:
container_name: budi-couchdb-dev
restart: always restart: always
image: apache/couchdb:3.0 image: apache/couchdb:3.0
environment: environment:
@ -83,7 +48,7 @@ services:
#- "9100:9100" #- "9100:9100"
volumes: volumes:
- couchdb_data:/opt/couchdb/data - couchdb_data:/opt/couchdb/data
couch-init: couch-init:
image: curlimages/curl image: curlimages/curl
environment: environment:
@ -92,8 +57,23 @@ services:
- couchdb-service - couchdb-service
command: ["sh","-c","sleep 10 && $${PUT_CALL}/_users && $${PUT_CALL}/_replicator; fg;"] 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: volumes:
couchdb_data: couchdb_data:
driver: local driver: local
minio_data: minio_data:
driver: local driver: local
redis_data:
driver: local

View File

@ -16,31 +16,16 @@ static_resources:
- name: local_services - name: local_services
domains: ["*"] domains: ["*"]
routes: 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/" } - match: { prefix: "/db/" }
route: route:
cluster: couchdb-service cluster: couchdb-service
prefix_rewrite: "/" prefix_rewrite: "/"
- match: { prefix: "/cache/" }
route:
cluster: redis-service
prefix_rewrite: "/"
# minio is on the default route because this works # minio is on the default route because this works
# best, minio + AWS SDK doesn't handle path proxy # best, minio + AWS SDK doesn't handle path proxy
- match: { prefix: "/" } - match: { prefix: "/" }
@ -51,20 +36,6 @@ static_resources:
- name: envoy.filters.http.router - name: envoy.filters.http.router
clusters: 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 - name: minio-service
connect_timeout: 0.25s connect_timeout: 0.25s
type: strict_dns type: strict_dns
@ -79,20 +50,6 @@ static_resources:
address: minio-service address: minio-service
port_value: 9000 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 - name: couchdb-service
connect_timeout: 0.25s connect_timeout: 0.25s
type: strict_dns type: strict_dns
@ -107,3 +64,16 @@ static_resources:
address: couchdb-service address: couchdb-service
port_value: 5984 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 WORKER_PORT=4003
MINIO_PORT=4004 MINIO_PORT=4004
COUCH_DB_PORT=4005 COUCH_DB_PORT=4005
REDIS_PORT=6379
BUDIBASE_ENVIRONMENT=PRODUCTION BUDIBASE_ENVIRONMENT=PRODUCTION

View File

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

View File

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

View File

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

View File

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