1
0
Fork 0
mirror of synced 2024-06-18 18:35:37 +12:00

Add awareness of deployment environment

This commit is contained in:
Rory Powell 2022-06-01 14:10:00 +01:00
parent 429f379431
commit bf9c6cbc42
11 changed files with 19 additions and 4 deletions

View file

@ -28,6 +28,8 @@ spec:
- env:
- name: BUDIBASE_ENVIRONMENT
value: {{ .Values.globals.budibaseEnv }}
- name: DEPLOYMENT_ENVIRONMENT
value: "kubernetes"
- name: COUCH_DB_URL
{{ if .Values.services.couchdb.url }}
value: {{ .Values.services.couchdb.url }}

View file

@ -27,6 +27,8 @@ spec:
spec:
containers:
- env:
- name: DEPLOYMENT_ENVIRONMENT
value: "kubernetes"
- name: CLUSTER_PORT
value: {{ .Values.services.worker.port | quote }}
{{ if .Values.services.couchdb.enabled }}

View file

@ -1,5 +1,6 @@
FROM couchdb
ENV DEPLOYMENT_ENVIRONMENT=docker
ENV COUCHDB_PASSWORD=budibase
ENV COUCHDB_USER=budibase
ENV COUCH_DB_URL=http://budibase:budibase@localhost:5984

View file

@ -52,8 +52,10 @@ const env: any = {
process.env.GLOBAL_CLOUD_BUCKET_NAME || "prod-budi-tenant-uploads",
USE_COUCH: process.env.USE_COUCH || true,
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
SERVICE: process.env.SERVICE || "budibase",
DEFAULT_LICENSE: process.env.DEFAULT_LICENSE,
SERVICE: process.env.SERVICE || "budibase",
DEPLOYMENT_ENVIRONMENT:
process.env.DEPLOYMENT_ENVIRONMENT || "docker-compose",
_set(key: any, value: any) {
process.env[key] = value
module.exports[key] = value

View file

@ -1,4 +1,3 @@
import { UserPermissionAssignedEvent } from "./../../../types/src/events/user"
import {
Event,
BackfillMetadata,
@ -18,7 +17,7 @@ import {
AppPublishedEvent,
UserCreatedEvent,
RoleAssignedEvent,
RowsCreatedEvent,
UserPermissionAssignedEvent,
} from "@budibase/types"
import * as context from "../context"
import { CacheKeys } from "../cache/generic"
@ -173,7 +172,7 @@ const getEventKey = (event?: Event, properties?: any) => {
const custom = CUSTOM_PROPERTY_SUFFIX[event]
const suffix = custom ? custom(properties) : undefined
if (suffix) {
eventKey = `${event}:${suffix}`
eventKey = `${eventKey}:${suffix}`
}
} else {
eventKey = `${CacheKeys.EVENTS}:${tenantId}:*`

View file

@ -23,6 +23,7 @@ export default class PosthogProcessor implements EventProcessor {
): Promise<void> {
properties.version = pkg.version
properties.service = env.SERVICE
properties.environment = env.DEPLOYMENT_ENVIRONMENT
const appId = context.getAppId()
if (appId) {

View file

@ -10,6 +10,7 @@ WORKDIR /app
ENV PORT=4001
ENV COUCH_DB_URL=https://couchdb.budi.live:5984
ENV BUDIBASE_ENVIRONMENT=PRODUCTION
ENV SERVICE=app-service
# copy files and install dependencies
COPY . ./

View file

@ -54,6 +54,8 @@ async function init() {
DISABLE_ACCOUNT_PORTAL: "",
MULTI_TENANCY: "",
DISABLE_THREADING: 1,
SERVICE: "app-service",
DEPLOYMENT_ENVIRONMENT: "development",
}
let envFile = ""
Object.keys(envFileJson).forEach(key => {

View file

@ -153,6 +153,7 @@ export enum Event {
export interface BaseEvent {
version?: string
service?: string
environment?: string
appId?: string
installationId?: string
tenantId?: string

View file

@ -21,4 +21,6 @@ EXPOSE 4001
# which are actually needed to get this environment up and running
ENV NODE_ENV=production
ENV CLUSTER_MODE=${CLUSTER_MODE}
ENV SERVICE=worker-service
CMD ["./docker_run.sh"]

View file

@ -26,6 +26,8 @@ async function init() {
ACCOUNT_PORTAL_API_KEY: "budibase",
PLATFORM_URL: "http://localhost:10000",
APPS_URL: "http://localhost:4001",
SERVICE: "worker-service",
DEPLOYMENT_ENVIRONMENT: "development",
}
let envFile = ""
Object.keys(envFileJson).forEach(key => {