Add awareness of deployment environment
This commit is contained in:
parent
7ebfaf8a31
commit
a4eef3daab
|
@ -28,6 +28,8 @@ spec:
|
||||||
- env:
|
- env:
|
||||||
- name: BUDIBASE_ENVIRONMENT
|
- name: BUDIBASE_ENVIRONMENT
|
||||||
value: {{ .Values.globals.budibaseEnv }}
|
value: {{ .Values.globals.budibaseEnv }}
|
||||||
|
- name: DEPLOYMENT_ENVIRONMENT
|
||||||
|
value: "kubernetes"
|
||||||
- name: COUCH_DB_URL
|
- name: COUCH_DB_URL
|
||||||
{{ if .Values.services.couchdb.url }}
|
{{ if .Values.services.couchdb.url }}
|
||||||
value: {{ .Values.services.couchdb.url }}
|
value: {{ .Values.services.couchdb.url }}
|
||||||
|
|
|
@ -27,6 +27,8 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- env:
|
- env:
|
||||||
|
- name: DEPLOYMENT_ENVIRONMENT
|
||||||
|
value: "kubernetes"
|
||||||
- name: CLUSTER_PORT
|
- name: CLUSTER_PORT
|
||||||
value: {{ .Values.services.worker.port | quote }}
|
value: {{ .Values.services.worker.port | quote }}
|
||||||
{{ if .Values.services.couchdb.enabled }}
|
{{ if .Values.services.couchdb.enabled }}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
FROM couchdb
|
FROM couchdb
|
||||||
|
|
||||||
|
ENV DEPLOYMENT_ENVIRONMENT=docker
|
||||||
ENV COUCHDB_PASSWORD=budibase
|
ENV COUCHDB_PASSWORD=budibase
|
||||||
ENV COUCHDB_USER=budibase
|
ENV COUCHDB_USER=budibase
|
||||||
ENV COUCH_DB_URL=http://budibase:budibase@localhost:5984
|
ENV COUCH_DB_URL=http://budibase:budibase@localhost:5984
|
||||||
|
|
|
@ -52,8 +52,10 @@ const env: any = {
|
||||||
process.env.GLOBAL_CLOUD_BUCKET_NAME || "prod-budi-tenant-uploads",
|
process.env.GLOBAL_CLOUD_BUCKET_NAME || "prod-budi-tenant-uploads",
|
||||||
USE_COUCH: process.env.USE_COUCH || true,
|
USE_COUCH: process.env.USE_COUCH || true,
|
||||||
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
||||||
SERVICE: process.env.SERVICE || "budibase",
|
|
||||||
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
|
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
|
||||||
|
SERVICE: process.env.SERVICE || "budibase",
|
||||||
|
DEPLOYMENT_ENVIRONMENT:
|
||||||
|
process.env.DEPLOYMENT_ENVIRONMENT || "docker-compose",
|
||||||
_set(key: any, value: any) {
|
_set(key: any, value: any) {
|
||||||
process.env[key] = value
|
process.env[key] = value
|
||||||
module.exports[key] = value
|
module.exports[key] = value
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { UserPermissionAssignedEvent } from "./../../../types/src/events/user"
|
|
||||||
import {
|
import {
|
||||||
Event,
|
Event,
|
||||||
BackfillMetadata,
|
BackfillMetadata,
|
||||||
|
@ -18,7 +17,7 @@ import {
|
||||||
AppPublishedEvent,
|
AppPublishedEvent,
|
||||||
UserCreatedEvent,
|
UserCreatedEvent,
|
||||||
RoleAssignedEvent,
|
RoleAssignedEvent,
|
||||||
RowsCreatedEvent,
|
UserPermissionAssignedEvent,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import * as context from "../context"
|
import * as context from "../context"
|
||||||
import { CacheKeys } from "../cache/generic"
|
import { CacheKeys } from "../cache/generic"
|
||||||
|
@ -173,7 +172,7 @@ const getEventKey = (event?: Event, properties?: any) => {
|
||||||
const custom = CUSTOM_PROPERTY_SUFFIX[event]
|
const custom = CUSTOM_PROPERTY_SUFFIX[event]
|
||||||
const suffix = custom ? custom(properties) : undefined
|
const suffix = custom ? custom(properties) : undefined
|
||||||
if (suffix) {
|
if (suffix) {
|
||||||
eventKey = `${event}:${suffix}`
|
eventKey = `${eventKey}:${suffix}`
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
eventKey = `${CacheKeys.EVENTS}:${tenantId}:*`
|
eventKey = `${CacheKeys.EVENTS}:${tenantId}:*`
|
||||||
|
|
|
@ -23,6 +23,7 @@ export default class PosthogProcessor implements EventProcessor {
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
properties.version = pkg.version
|
properties.version = pkg.version
|
||||||
properties.service = env.SERVICE
|
properties.service = env.SERVICE
|
||||||
|
properties.environment = env.DEPLOYMENT_ENVIRONMENT
|
||||||
|
|
||||||
const appId = context.getAppId()
|
const appId = context.getAppId()
|
||||||
if (appId) {
|
if (appId) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ WORKDIR /app
|
||||||
ENV PORT=4001
|
ENV PORT=4001
|
||||||
ENV COUCH_DB_URL=https://couchdb.budi.live:5984
|
ENV COUCH_DB_URL=https://couchdb.budi.live:5984
|
||||||
ENV BUDIBASE_ENVIRONMENT=PRODUCTION
|
ENV BUDIBASE_ENVIRONMENT=PRODUCTION
|
||||||
|
ENV SERVICE=app-service
|
||||||
|
|
||||||
# copy files and install dependencies
|
# copy files and install dependencies
|
||||||
COPY . ./
|
COPY . ./
|
||||||
|
|
|
@ -54,6 +54,8 @@ async function init() {
|
||||||
DISABLE_ACCOUNT_PORTAL: "",
|
DISABLE_ACCOUNT_PORTAL: "",
|
||||||
MULTI_TENANCY: "",
|
MULTI_TENANCY: "",
|
||||||
DISABLE_THREADING: 1,
|
DISABLE_THREADING: 1,
|
||||||
|
SERVICE: "app-service",
|
||||||
|
DEPLOYMENT_ENVIRONMENT: "development",
|
||||||
}
|
}
|
||||||
let envFile = ""
|
let envFile = ""
|
||||||
Object.keys(envFileJson).forEach(key => {
|
Object.keys(envFileJson).forEach(key => {
|
||||||
|
|
|
@ -153,6 +153,7 @@ export enum Event {
|
||||||
export interface BaseEvent {
|
export interface BaseEvent {
|
||||||
version?: string
|
version?: string
|
||||||
service?: string
|
service?: string
|
||||||
|
environment?: string
|
||||||
appId?: string
|
appId?: string
|
||||||
installationId?: string
|
installationId?: string
|
||||||
tenantId?: string
|
tenantId?: string
|
||||||
|
|
|
@ -21,4 +21,6 @@ EXPOSE 4001
|
||||||
# which are actually needed to get this environment up and running
|
# which are actually needed to get this environment up and running
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV CLUSTER_MODE=${CLUSTER_MODE}
|
ENV CLUSTER_MODE=${CLUSTER_MODE}
|
||||||
|
ENV SERVICE=worker-service
|
||||||
|
|
||||||
CMD ["./docker_run.sh"]
|
CMD ["./docker_run.sh"]
|
||||||
|
|
|
@ -26,6 +26,8 @@ async function init() {
|
||||||
ACCOUNT_PORTAL_API_KEY: "budibase",
|
ACCOUNT_PORTAL_API_KEY: "budibase",
|
||||||
PLATFORM_URL: "http://localhost:10000",
|
PLATFORM_URL: "http://localhost:10000",
|
||||||
APPS_URL: "http://localhost:4001",
|
APPS_URL: "http://localhost:4001",
|
||||||
|
SERVICE: "worker-service",
|
||||||
|
DEPLOYMENT_ENVIRONMENT: "development",
|
||||||
}
|
}
|
||||||
let envFile = ""
|
let envFile = ""
|
||||||
Object.keys(envFileJson).forEach(key => {
|
Object.keys(envFileJson).forEach(key => {
|
||||||
|
|
Loading…
Reference in New Issue