From 7998250193cb0c21f0c5d1d12315a31c3d43790b Mon Sep 17 00:00:00 2001 From: Dominiek Ter Heide Date: Sat, 28 Oct 2023 08:51:21 -0400 Subject: [PATCH] Revert ""Bedrock Create"" This reverts commit 5260999bf075a320acdcca42c5ac833c99792515. --- CONTRIBUTING.md | 21 +++++++ LICENSE | 21 +++++++ README.md | 2 +- deployment/README.md | 12 ++-- .../environments/production/config.json | 4 +- .../data/backup-monitor-deployment.yml | 8 +-- .../bucket-storage-backups-deployment.yml | 4 +- .../data/mongo-backups-deployment.yml | 4 +- .../production/provisioning/variables.tf | 4 +- .../services/api-cli-deployment.yml | 12 ++-- .../production/services/api-deployment.yml | 56 ++++++++++++------- .../production/services/api-ingress.yml | 10 ++-- .../services/api-jobs-deployment.yml | 6 +- .../production/services/web-deployment.yml | 6 +- .../production/services/web-ingress.yml | 10 ++-- deployment/environments/staging/config.json | 4 +- .../data/backup-monitor-deployment.yml | 8 +-- .../bucket-storage-backups-deployment.yml | 4 +- .../staging/data/mongo-backups-deployment.yml | 4 +- .../staging/provisioning/variables.tf | 4 +- .../staging/services/api-cli-deployment.yml | 10 ++-- .../staging/services/api-deployment.yml | 45 ++++++++------- .../staging/services/api-ingress.yml | 10 ++-- .../staging/services/api-jobs-deployment.yml | 6 +- .../staging/services/web-deployment.yml | 6 +- .../staging/services/web-ingress.yml | 10 ++-- docker-compose.yml | 2 +- services/api/.env | 20 +++---- services/api/README.md | 16 +++--- services/api/fixtures/organizations/index.js | 6 +- services/api/openapi.json | 2 +- services/api/package.json | 4 +- services/web/.env | 4 +- services/web/README.md | 2 +- services/web/package.json | 2 +- services/web/src/stores/README.md | 2 +- 36 files changed, 207 insertions(+), 144 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..aba1d9e30 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,21 @@ +# Contribution Guide + +(work in progress) + +## What should live in this repo? + +Something like npm plugins might become useful, but the overhead for having to think about what to separate, not to mention maintenance and dependencies has its own cost. + +For now we should allow code that is potentially useful as long as it is: + +- Well coded (don't toss junk in). +- Documented, at least minimally (think about people using it for the first time). +- Organized somewhere that makes sense. +- Isn't a dependency out of the box but can be opted into. +- Isn't short lived (ie. is the code likely to become obsolete as the browser landscape changes?). +- Ideally production tested. + +## Potential criteria for creating an npm package + +- The code has usefulness on its own outside Bedrock (?). +- The code requires multiple files or a complex structure that should be isolated from Bedrock (?). \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..f0a618325 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Bedrock.io, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 662dd2ee5..1c73f224c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Peachtree Platform +# Bedrock Platform More documentation about specific services and components can be found in the following sections: diff --git a/deployment/README.md b/deployment/README.md index 024703e30..e325ea9d6 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -104,8 +104,8 @@ Each environment can be configured in `environments//config.json`: { "gcloud": { "envName": "staging", // - Name of the environment, e.g. staging - "bucketPrefix": "peachtree", // - Bucket prefix used for GCS bucket creation - "project": "peachtree", // - Google Cloud project id for this environment + "bucketPrefix": "bedrock-foundation", // - Bucket prefix used for GCS bucket creation + "project": "bedrock-foundation", // - Google Cloud project id for this environment "computeZone": "us-east1-c", // - Default compute zone for project "kubernetes": { "clusterName": "cluster-1" // - Name of Kubernetes cluster for deployment @@ -144,8 +144,8 @@ gcloud auth configure-docker Create a Google Cloud project (in the [GC dashboard](https://console.cloud.google.com/home/dashboard)) or: ```bash -gcloud projects create peachtree-staging --name="Peachtree Staging" -gcloud config set project peachtree-staging +gcloud projects create bedrock-staging --name="Bedrock Staging" +gcloud config set project bedrock-staging ``` Configure: `environments//config.json`. @@ -157,7 +157,7 @@ There is a bootstrap command that automatically takes care of the remaining step The following command takes an environment variable and Google Project ID: ```bash -bedrock cloud bootstrap staging peachtree-staging +bedrock cloud bootstrap staging bedrock-staging ``` ### Directory Structure @@ -426,7 +426,7 @@ We do not want to & should not check in sensitive keys into git. We therefore us We are using env files to attach secrets to our deployment. For example to create one we would enter the key/value pairs into a text file and create it like follows. -Peachtree has the following secret commands: +Bedrock has the following secret commands: ```bash get [environment] [name] Get Secret from cluster and store in local .conf file diff --git a/deployment/environments/production/config.json b/deployment/environments/production/config.json index 49a9c1d1c..de40dc9af 100644 --- a/deployment/environments/production/config.json +++ b/deployment/environments/production/config.json @@ -1,8 +1,8 @@ { "gcloud": { "envName": "production", - "bucketPrefix": "peachtree", - "project": "", + "bucketPrefix": "bedrock-foundation", + "project": "bedrock-foundation-production", "computeZone": "us-east1-c", "kubernetes": { "clusterName": "cluster-1", diff --git a/deployment/environments/production/data/backup-monitor-deployment.yml b/deployment/environments/production/data/backup-monitor-deployment.yml index ae4c70fe4..604985506 100644 --- a/deployment/environments/production/data/backup-monitor-deployment.yml +++ b/deployment/environments/production/data/backup-monitor-deployment.yml @@ -22,14 +22,14 @@ spec: # memory: "4Gi" env: - name: GS_BUCKETS - value: "peachtree-uploads-backup peachtree-mongodb-backups" + value: "bedrock-foundation-uploads-backup bedrock-foundation-mongodb-backups" - name: POSTMARK_API_KEY value: "abc" - name: POSTMARK_FROM - value: "admin@ptre.dev" + value: "admin@bedrock.foundation" - name: EMAIL_ALERT - value: "admin@ptre.dev" + value: "admin@bedrock.foundation" - name: EMAIL_HEALTH_CHECK - value: "admin@ptre.dev" + value: "admin@bedrock.foundation" - name: ENVIRONMENT value: "production" diff --git a/deployment/environments/production/data/bucket-storage-backups-deployment.yml b/deployment/environments/production/data/bucket-storage-backups-deployment.yml index 84ae9152d..f2fb7ef76 100644 --- a/deployment/environments/production/data/bucket-storage-backups-deployment.yml +++ b/deployment/environments/production/data/bucket-storage-backups-deployment.yml @@ -22,6 +22,6 @@ spec: # memory: "4Gi" env: - name: SOURCE_GS_BUCKET - value: "peachtree-uploads" + value: "bedrock-foundation-uploads" - name: DESTINATION_GS_BUCKET - value: "peachtree-uploads-backup" + value: "bedrock-foundation-uploads-backup" diff --git a/deployment/environments/production/data/mongo-backups-deployment.yml b/deployment/environments/production/data/mongo-backups-deployment.yml index f8f4e5115..ecc9aa246 100644 --- a/deployment/environments/production/data/mongo-backups-deployment.yml +++ b/deployment/environments/production/data/mongo-backups-deployment.yml @@ -24,6 +24,6 @@ spec: - name: MONGO_HOST value: "mongo" - name: MONGO_DB - value: "peachtree_production" + value: "bedrock_production" - name: BACKUPS_GS_BUCKET - value: "peachtree-mongodb-backups" + value: "bedrock-foundation-mongodb-backups" diff --git a/deployment/environments/production/provisioning/variables.tf b/deployment/environments/production/provisioning/variables.tf index 6282f1cc7..508ab5173 100644 --- a/deployment/environments/production/provisioning/variables.tf +++ b/deployment/environments/production/provisioning/variables.tf @@ -1,5 +1,5 @@ variable "project" { - default = "" + default = "bedrock-foundation-production" } variable "environment" { @@ -19,7 +19,7 @@ variable "multi_region" { } variable "bucket_prefix" { - default = "peachtree-production" + default = "bedrock-production" } variable "cluster_name" { diff --git a/deployment/environments/production/services/api-cli-deployment.yml b/deployment/environments/production/services/api-cli-deployment.yml index 56daa3c83..32adb70ea 100644 --- a/deployment/environments/production/services/api-cli-deployment.yml +++ b/deployment/environments/production/services/api-cli-deployment.yml @@ -13,7 +13,7 @@ spec: app: api-cli spec: containers: - - image: gcr.io/peachtree/peachtree-services-api-cli + - image: gcr.io/bedrock-foundation/bedrock-core-services-api-cli imagePullPolicy: Always name: api-cli # resources: @@ -26,19 +26,19 @@ spec: - name: NODE_ENV value: "production" - name: MONGO_URI - value: "mongodb://mongo:27017/peachtree_production" + value: "mongodb://mongo:27017/bedrock_production" - name: APP_URL - value: "https://ptre.dev" + value: "https://bedrock.foundation" - name: ADMIN_EMAIL - value: "admin@ptre.dev" + value: "admin@bedrock.foundation" - name: ADMIN_PASSWORD value: "development.now" - name: POSTMARK_FROM - value: "no-reply@ptre.dev" + value: "no-reply@bedrock.foundation" - name: UPLOADS_STORE value: "gcs" - name: UPLOADS_GCS_BUCKET - value: "peachtree-production-uploads" + value: "bedrock-production-uploads" # The `bedrock cloud` command in the CLI will help with # the creation and storing of secrets for production. - name: JWT_SECRET diff --git a/deployment/environments/production/services/api-deployment.yml b/deployment/environments/production/services/api-deployment.yml index 6a5efae44..42dc75ed0 100644 --- a/deployment/environments/production/services/api-deployment.yml +++ b/deployment/environments/production/services/api-deployment.yml @@ -4,10 +4,10 @@ metadata: name: api-deployment spec: strategy: - type: RollingUpdate + type: RollingUpdate # New pods are added gradually, and old pods are terminated gradually rollingUpdate: - maxSurge: 1 - maxUnavailable: 1 + maxSurge: 1 # The number of pods that can be created above the desired amount of pods during an update + maxUnavailable: 1 # The number of pods that can be unavailable during the update process selector: matchLabels: app: api @@ -17,42 +17,58 @@ spec: app: api spec: containers: - - image: gcr.io/peachtree/peachtree-services-api + - image: gcr.io/bedrock-foundation/bedrock-core-services-api imagePullPolicy: Always name: main + # resources: + # limits: + # cpu: "1000m" + # memory: "4Gi" + # requests: + # cpu: "250m" + # memory: "100Mi" env: - name: ENV_NAME - value: production + value: "production" - name: NODE_ENV - value: production + value: "production" - name: MONGO_URI - value: mongodb://mongo:27017/peachtree_production + value: "mongodb://mongo:27017/bedrock_production" - name: APP_URL - value: https://ptre.dev + value: "https://bedrock.foundation" - name: POSTMARK_FROM - value: no-reply@ptre.dev + value: "no-reply@bedrock.foundation" - name: UPLOADS_STORE - value: gcs + value: "gcs" - name: UPLOADS_GCS_BUCKET - value: peachtree-production-uploads + value: "bedrock-production-uploads" - name: LOG_LEVEL - value: debug + value: "debug" + # The `bedrock cloud` command in the CLI will help with + # the creation and storing of secrets for production. - name: JWT_SECRET - value: GEK7yqjO5LuCmfFyku8i5Iw6GTeNBLXP2OZC9tdF + valueFrom: + secretKeyRef: + name: secrets + key: JWT_SECRET - name: POSTMARK_API_KEY - value: "" + valueFrom: + secretKeyRef: + name: secrets + key: POSTMARK_API_KEY ports: - name: http-server containerPort: 2300 - readinessProbe: - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 2 - failureThreshold: 2 + # https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ + readinessProbe: # readiness probes to know when a container is ready to start accepting traffic + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness or readiness probes are initiated. Defaults to 0 seconds. + periodSeconds: 5 # How often (in seconds) to perform the probe. Default to 10 seconds + timeoutSeconds: 2 # Number of seconds after which the probe times out. Defaults to 1 second + failureThreshold: 2 # When a probe fails, Kubernetes will try failureThreshold times before giving up. httpGet: path: /1/status/mongodb port: 2300 - livenessProbe: + livenessProbe: # liveness probes to know when to restart a container httpGet: path: /1/status/mongodb port: 2300 diff --git a/deployment/environments/production/services/api-ingress.yml b/deployment/environments/production/services/api-ingress.yml index 77d88b218..f9f6cfc92 100644 --- a/deployment/environments/production/services/api-ingress.yml +++ b/deployment/environments/production/services/api-ingress.yml @@ -11,7 +11,7 @@ spec: port: number: 80 # rules: - # - host: api.ptre.dev + # - host: api.bedrock.foundation # http: # paths: # - path: /* @@ -28,7 +28,7 @@ spec: # name: api-long-timeout # port: # number: 80 - # - host: ptre.dev + # - host: bedrock.foundation # http: # paths: # - path: /* @@ -50,15 +50,15 @@ spec: # apiVersion: v1 # kind: Service # metadata: -# name: peachtree-api-long-timeout +# name: bedrock-api-long-timeout # labels: -# name: peachtree-api-long-timeout +# name: bedrock-api-long-timeout # annotations: # cloud.google.com/backend-config: '{"ports": {"80":"long-timeout-backendconfig"}}' # spec: # type: NodePort # selector: -# app: peachtree-api +# app: bedrock-api # ports: # - port: 80 # targetPort: 2300 diff --git a/deployment/environments/production/services/api-jobs-deployment.yml b/deployment/environments/production/services/api-jobs-deployment.yml index fc3bf2a3c..43bb033da 100644 --- a/deployment/environments/production/services/api-jobs-deployment.yml +++ b/deployment/environments/production/services/api-jobs-deployment.yml @@ -13,7 +13,7 @@ spec: app: api-jobs spec: containers: - - image: gcr.io/peachtree/peachtree-services-api-jobs + - image: gcr.io/bedrock-foundation/bedrock-core-services-api-jobs imagePullPolicy: Always name: main # resources: @@ -30,8 +30,8 @@ spec: - name: NODE_ENV value: "production" - name: MONGO_URI - value: "mongodb://mongo:27017/peachtree_production" + value: "mongodb://mongo:27017/bedrock_production" - name: POSTMARK_FROM - value: "no-reply@ptre.dev" + value: "no-reply@bedrock.foundation" - name: POSTMARK_API_KEY value: "abc" diff --git a/deployment/environments/production/services/web-deployment.yml b/deployment/environments/production/services/web-deployment.yml index fa759baf6..6f8990146 100644 --- a/deployment/environments/production/services/web-deployment.yml +++ b/deployment/environments/production/services/web-deployment.yml @@ -13,7 +13,7 @@ spec: app: web spec: containers: - - image: gcr.io/peachtree/peachtree-services-web + - image: gcr.io/bedrock-foundation/bedrock-core-services-web imagePullPolicy: Always name: main # resources: @@ -26,9 +26,9 @@ spec: - name: NODE_ENV value: "production" - name: DOMAIN - value: ptre.dev + value: bedrock.foundation - name: API_URL - value: "https://api.ptre.dev" + value: "https://api.bedrock.foundation" ports: - name: http-server containerPort: 2200 diff --git a/deployment/environments/production/services/web-ingress.yml b/deployment/environments/production/services/web-ingress.yml index 9fcccdc17..5e5f9c419 100644 --- a/deployment/environments/production/services/web-ingress.yml +++ b/deployment/environments/production/services/web-ingress.yml @@ -11,7 +11,7 @@ spec: port: number: 80 # rules: - # - host: api.ptre.dev + # - host: api.bedrock.foundation # http: # paths: # - path: /* @@ -28,7 +28,7 @@ spec: # name: api-long-timeout # port: # number: 80 - # - host: ptre.dev + # - host: bedrock.foundation # http: # paths: # - path: /* @@ -50,15 +50,15 @@ spec: # apiVersion: v1 # kind: Service # metadata: -# name: peachtree-api-long-timeout +# name: bedrock-api-long-timeout # labels: -# name: peachtree-api-long-timeout +# name: bedrock-api-long-timeout # annotations: # cloud.google.com/backend-config: '{"ports": {"80":"long-timeout-backendconfig"}}' # spec: # type: NodePort # selector: -# app: peachtree-api +# app: bedrock-api # ports: # - port: 80 # targetPort: 2300 diff --git a/deployment/environments/staging/config.json b/deployment/environments/staging/config.json index 3a63326ae..99667b798 100644 --- a/deployment/environments/staging/config.json +++ b/deployment/environments/staging/config.json @@ -1,8 +1,8 @@ { "gcloud": { "envName": "staging", - "bucketPrefix": "peachtree", - "project": "", + "bucketPrefix": "bedrock-foundation", + "project": "bedrock-foundation-staging", "computeZone": "us-east1-c", "kubernetes": { "clusterName": "cluster-1", diff --git a/deployment/environments/staging/data/backup-monitor-deployment.yml b/deployment/environments/staging/data/backup-monitor-deployment.yml index d6af443cb..a5b472149 100644 --- a/deployment/environments/staging/data/backup-monitor-deployment.yml +++ b/deployment/environments/staging/data/backup-monitor-deployment.yml @@ -22,14 +22,14 @@ spec: # memory: "4Gi" env: - name: GS_BUCKETS - value: "peachtree-staging-uploads peachtree-staging-mongodb-backups" + value: "bedrock-staging-uploads bedrock-staging-mongodb-backups" - name: POSTMARK_API_KEY value: "abc" - name: POSTMARK_FROM - value: "admin@ptre.dev" + value: "admin@bedrock.foundation" - name: EMAIL_ALERT - value: "admin@ptre.dev" + value: "admin@bedrock.foundation" - name: EMAIL_HEALTH_CHECK - value: "admin@ptre.dev" + value: "admin@bedrock.foundation" - name: ENVIRONMENT value: "staging" diff --git a/deployment/environments/staging/data/bucket-storage-backups-deployment.yml b/deployment/environments/staging/data/bucket-storage-backups-deployment.yml index dba239ac3..40cf6e317 100644 --- a/deployment/environments/staging/data/bucket-storage-backups-deployment.yml +++ b/deployment/environments/staging/data/bucket-storage-backups-deployment.yml @@ -22,6 +22,6 @@ spec: # memory: "4Gi" env: - name: SOURCE_GS_BUCKET - value: "peachtree-staging-uploads" + value: "bedrock-staging-uploads" - name: DESTINATION_GS_BUCKET - value: "peachtree-staging-uploads-backup" + value: "bedrock-staging-uploads-backup" diff --git a/deployment/environments/staging/data/mongo-backups-deployment.yml b/deployment/environments/staging/data/mongo-backups-deployment.yml index da0b021d3..fee13db9c 100644 --- a/deployment/environments/staging/data/mongo-backups-deployment.yml +++ b/deployment/environments/staging/data/mongo-backups-deployment.yml @@ -24,6 +24,6 @@ spec: - name: MONGO_HOST value: "mongo" - name: MONGO_DB - value: "peachtree_staging" + value: "bedrock_staging" - name: BACKUPS_GS_BUCKET - value: "peachtree-staging-mongodb-backups" + value: "bedrock-staging-mongodb-backups" diff --git a/deployment/environments/staging/provisioning/variables.tf b/deployment/environments/staging/provisioning/variables.tf index 1a86a8715..3640b1408 100644 --- a/deployment/environments/staging/provisioning/variables.tf +++ b/deployment/environments/staging/provisioning/variables.tf @@ -1,5 +1,5 @@ variable "project" { - default = "" + default = "bedrock-foundation-staging" } variable "environment" { @@ -19,7 +19,7 @@ variable "multi_region" { } variable "bucket_prefix" { - default = "peachtree-staging" + default = "bedrock-staging" } variable "cluster_name" { diff --git a/deployment/environments/staging/services/api-cli-deployment.yml b/deployment/environments/staging/services/api-cli-deployment.yml index d68b557b5..ac39c428d 100644 --- a/deployment/environments/staging/services/api-cli-deployment.yml +++ b/deployment/environments/staging/services/api-cli-deployment.yml @@ -13,7 +13,7 @@ spec: app: api-cli spec: containers: - - image: gcr.io/peachtree/peachtree-services-api-cli + - image: gcr.io/bedrock-foundation/bedrock-core-services-api-cli imagePullPolicy: Always name: api-cli # resources: @@ -26,14 +26,14 @@ spec: - name: NODE_ENV value: "production" - name: MONGO_URI - value: "mongodb://mongo:27017/peachtree_staging" + value: "mongodb://mongo:27017/bedrock_staging" - name: APP_URL - value: "https://ptre.dev" + value: "https://bedrock.foundation" - name: POSTMARK_FROM - value: "no-reply@ptre.dev" + value: "no-reply@bedrock.foundation" - name: POSTMARK_API_KEY value: "abc" - name: UPLOADS_STORE value: "gcs" - name: UPLOADS_GCS_BUCKET - value: "peachtree-staging-uploads" + value: "bedrock-staging-uploads" diff --git a/deployment/environments/staging/services/api-deployment.yml b/deployment/environments/staging/services/api-deployment.yml index 3a180c842..3db3fb174 100644 --- a/deployment/environments/staging/services/api-deployment.yml +++ b/deployment/environments/staging/services/api-deployment.yml @@ -5,10 +5,10 @@ metadata: spec: replicas: 2 strategy: - type: RollingUpdate + type: RollingUpdate # New pods are added gradually, and old pods are terminated gradually rollingUpdate: - maxSurge: 1 - maxUnavailable: 1 + maxSurge: 1 # The number of pods that can be created above the desired amount of pods during an update + maxUnavailable: 1 # The number of pods that can be unavailable during the update process selector: matchLabels: app: api @@ -18,42 +18,47 @@ spec: app: api spec: containers: - - image: gcr.io/peachtree/peachtree-services-api + - image: gcr.io/bedrock-foundation/bedrock-core-services-api imagePullPolicy: Always name: main + # resources: + # limits: + # cpu: "1000m" + # memory: "4Gi" env: - name: ENV_NAME - value: staging + value: "staging" - name: NODE_ENV - value: production + value: "production" - name: MONGO_URI - value: mongodb://mongo:27017/peachtree_staging + value: "mongodb://mongo:27017/bedrock_staging" - name: JWT_SECRET - value: NIAJ2+H3UjhGxjCBFIIqLl2Fbnvy6iGr/P+9/duu + value: "changeme1234" - name: APP_URL - value: https://ptre.dev + value: "https://bedrock.foundation" - name: POSTMARK_FROM - value: no-reply@ptre.dev + value: "no-reply@bedrock.foundation" - name: POSTMARK_API_KEY - value: abc + value: "abc" - name: UPLOADS_STORE - value: gcs + value: "gcs" - name: UPLOADS_GCS_BUCKET - value: peachtree-staging-uploads + value: "bedrock-staging-uploads" - name: LOG_LEVEL - value: debug + value: "debug" ports: - name: http-server containerPort: 2300 - readinessProbe: - initialDelaySeconds: 5 - periodSeconds: 5 - timeoutSeconds: 2 - failureThreshold: 2 + # https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/ + readinessProbe: # readiness probes to know when a container is ready to start accepting traffic + initialDelaySeconds: 5 # Number of seconds after the container has started before liveness or readiness probes are initiated. Defaults to 0 seconds. + periodSeconds: 5 # How often (in seconds) to perform the probe. Default to 10 seconds + timeoutSeconds: 2 # Number of seconds after which the probe times out. Defaults to 1 second + failureThreshold: 2 # When a probe fails, Kubernetes will try failureThreshold times before giving up. httpGet: path: /1/status/mongodb port: 2300 - livenessProbe: + livenessProbe: # liveness probes to know when to restart a container httpGet: path: /1/status/mongodb port: 2300 diff --git a/deployment/environments/staging/services/api-ingress.yml b/deployment/environments/staging/services/api-ingress.yml index 77d88b218..f9f6cfc92 100644 --- a/deployment/environments/staging/services/api-ingress.yml +++ b/deployment/environments/staging/services/api-ingress.yml @@ -11,7 +11,7 @@ spec: port: number: 80 # rules: - # - host: api.ptre.dev + # - host: api.bedrock.foundation # http: # paths: # - path: /* @@ -28,7 +28,7 @@ spec: # name: api-long-timeout # port: # number: 80 - # - host: ptre.dev + # - host: bedrock.foundation # http: # paths: # - path: /* @@ -50,15 +50,15 @@ spec: # apiVersion: v1 # kind: Service # metadata: -# name: peachtree-api-long-timeout +# name: bedrock-api-long-timeout # labels: -# name: peachtree-api-long-timeout +# name: bedrock-api-long-timeout # annotations: # cloud.google.com/backend-config: '{"ports": {"80":"long-timeout-backendconfig"}}' # spec: # type: NodePort # selector: -# app: peachtree-api +# app: bedrock-api # ports: # - port: 80 # targetPort: 2300 diff --git a/deployment/environments/staging/services/api-jobs-deployment.yml b/deployment/environments/staging/services/api-jobs-deployment.yml index d1e9cf4aa..5548db8fa 100644 --- a/deployment/environments/staging/services/api-jobs-deployment.yml +++ b/deployment/environments/staging/services/api-jobs-deployment.yml @@ -13,7 +13,7 @@ spec: app: api-jobs spec: containers: - - image: gcr.io/peachtree/peachtree-services-api-jobs + - image: gcr.io/bedrock-foundation/bedrock-core-services-api-jobs imagePullPolicy: Always name: main # resources: @@ -30,8 +30,8 @@ spec: - name: NODE_ENV value: "production" - name: MONGO_URI - value: "mongodb://mongo:27017/peachtree_staging" + value: "mongodb://mongo:27017/bedrock_staging" - name: POSTMARK_FROM - value: "no-reply@ptre.dev" + value: "no-reply@bedrock.foundation" - name: POSTMARK_API_KEY value: "abc" diff --git a/deployment/environments/staging/services/web-deployment.yml b/deployment/environments/staging/services/web-deployment.yml index a578e4ba6..6b28e8856 100644 --- a/deployment/environments/staging/services/web-deployment.yml +++ b/deployment/environments/staging/services/web-deployment.yml @@ -13,7 +13,7 @@ spec: app: web spec: containers: - - image: gcr.io/peachtree/peachtree-services-web + - image: gcr.io/bedrock-foundation/bedrock-core-services-web imagePullPolicy: Always name: main # resources: @@ -26,9 +26,9 @@ spec: - name: NODE_ENV value: "production" - name: DOMAIN - value: ptre.dev + value: bedrock.foundation - name: API_URL - value: "https://api.ptre.dev" + value: "https://api.bedrock.foundation" ports: - name: http-server containerPort: 2200 diff --git a/deployment/environments/staging/services/web-ingress.yml b/deployment/environments/staging/services/web-ingress.yml index 9fcccdc17..5e5f9c419 100644 --- a/deployment/environments/staging/services/web-ingress.yml +++ b/deployment/environments/staging/services/web-ingress.yml @@ -11,7 +11,7 @@ spec: port: number: 80 # rules: - # - host: api.ptre.dev + # - host: api.bedrock.foundation # http: # paths: # - path: /* @@ -28,7 +28,7 @@ spec: # name: api-long-timeout # port: # number: 80 - # - host: ptre.dev + # - host: bedrock.foundation # http: # paths: # - path: /* @@ -50,15 +50,15 @@ spec: # apiVersion: v1 # kind: Service # metadata: -# name: peachtree-api-long-timeout +# name: bedrock-api-long-timeout # labels: -# name: peachtree-api-long-timeout +# name: bedrock-api-long-timeout # annotations: # cloud.google.com/backend-config: '{"ports": {"80":"long-timeout-backendconfig"}}' # spec: # type: NodePort # selector: -# app: peachtree-api +# app: bedrock-api # ports: # - port: 80 # targetPort: 2300 diff --git a/docker-compose.yml b/docker-compose.yml index 2ec470c3d..396283ad2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: "3.8" services: api: environment: - - MONGO_URI=mongodb://mongo/peachtree_dev + - MONGO_URI=mongodb://mongo/bedrock_dev build: context: ./services/api args: diff --git a/services/api/.env b/services/api/.env index a41c4beea..a02aa7d4e 100644 --- a/services/api/.env +++ b/services/api/.env @@ -4,19 +4,19 @@ SERVER_HOST=0.0.0.0 SERVER_PORT=2300 # Main DB Config -MONGO_URI=mongodb://localhost/peachtree_dev +MONGO_URI=mongodb://localhost/bedrock_dev MONGO_DEBUG=false # Default admin account for dashboard login ADMIN_NAME=Marlon Brando -ADMIN_EMAIL=admin@ptre.dev -ADMIN_PASSWORD=1d146bb7de3a9ba6 +ADMIN_EMAIL=admin@bedrock.foundation +ADMIN_PASSWORD=development.now # JWT Secret to sign and encrypt tokens -JWT_SECRET=LEBLDZN/RnsaRL4t10D1ktCyZgjKBvO4fNrkfUFO +JWT_SECRET=m6bv7!m|E:7:*X3Mx7I)2+Y>B70+&K # Postmark mail delivery -POSTMARK_FROM=no-reply@ptre.dev +POSTMARK_FROM=no-reply@bedrock.foundation POSTMARK_API_KEY= POSTMARK_DEV_TO= @@ -25,11 +25,11 @@ TWILIO_ACCOUNT_SID= TWILIO_MESSAGING_SERVICE_SID= # App details for emails -APP_NAME=Peachtree +APP_NAME=Bedrock APP_URL=http://localhost:2200 -APP_SUPPORT_EMAIL=support@ptre.dev -APP_COMPANY_ADDRESS= -APP_COMPANY_NAME=The Peachtree foundation +APP_SUPPORT_EMAIL=support@bedrock.foundation +APP_COMPANY_ADDRESS=Bedrock Inc, 3 Abbey Road, San Francisco CA 94102 +APP_COMPANY_NAME=The Bedrock foundation APP_PRIMARY_COLOR=#3869d4 # Needs to be a public url that points to png/jpeg (no svg) APP_LOGO_URL= @@ -38,7 +38,7 @@ API_URL=http://localhost:2300 # Uploads (local|gcs) UPLOADS_STORE=local -UPLOADS_GCS_BUCKET=peachtree-staging-uploads +UPLOADS_GCS_BUCKET=bedrock-staging-uploads # Sentry Error Tracking SENTRY_DSN= diff --git a/services/api/README.md b/services/api/README.md index ced6feb57..992daca0c 100644 --- a/services/api/README.md +++ b/services/api/README.md @@ -1,6 +1,6 @@ -# Peachtree API +# Bedrock API -![Run Tests](https://github.com//workflows/Tests/badge.svg) +![Run Tests](https://github.com/bedrockio/bedrock-core/workflows/Tests/badge.svg) ## API Documentation @@ -77,14 +77,14 @@ variables. - `SERVER_HOST` - Host to bind to, defaults to `"0.0.0.0"` - `SERVER_PORT` - Port to bind to, defaults to `2300` -- `MONGO_URI` - MongoDB URI to connect to, defaults to `mongodb://localhost/peachtree_dev` +- `MONGO_URI` - MongoDB URI to connect to, defaults to `mongodb://localhost/bedrock_dev` - `JWT_SECRET` - JWT secret used for token signing and encryption - `ADMIN_NAME` - Default dashboard admin user name `admin` -- `ADMIN_EMAIL` - Default dashboard admin user `admin@ptre.dev` +- `ADMIN_EMAIL` - Default dashboard admin user `admin@bedrock.foundation` - `ADMIN_PASSWORD` - Default dashboard admin password -- `APP_NAME` - Default product name to be used in emails `Peachtree` +- `APP_NAME` - Default product name to be used in emails `Bedrock` - `APP_URL` - URL for app defaults to `http://localhost:2200` -- `POSTMARK_FROM` - Reply email address `no-reply@ptre.dev` +- `POSTMARK_FROM` - Reply email address `no-reply@bedrock.foundation` - `POSTMARK_API_KEY` - APIKey for Postmark - `POSTMARK_DEV_TO` - Email recipient to send development mails for debugging. - `UPLOADS_STORE` - Method for uploads. `local` or `gcs` (Google Cloud Storage) @@ -124,7 +124,7 @@ jobs: To build the container: ``` -docker build -t peachtree-api-jobs -f Dockerfile.jobs . +docker build -t bedrock-api-jobs -f Dockerfile.jobs . ``` Different job configurations can be specified by changing the entry point when running the container. E.g in Kubernetes: @@ -284,7 +284,7 @@ with `LOG_LEVEL`. In Google Cloud environments all levels are output. ## Documentation Good API documentation needs love, so make sure to take the time to describe parameters, create examples, etc. The -[Peachtree CLI](https://github.com/bedrockio/bedrock-cli) can generate documentation using the command: +[Bedrock CLI](https://github.com/bedrockio/bedrock-cli) can generate documentation using the command: ``` bedrock generate docs diff --git a/services/api/fixtures/organizations/index.js b/services/api/fixtures/organizations/index.js index f8eda5e0a..3a4851090 100644 --- a/services/api/fixtures/organizations/index.js +++ b/services/api/fixtures/organizations/index.js @@ -1,11 +1,11 @@ module.exports = { default: { - name: 'Peachtree', + name: 'Bedrock', }, 'bedrock-institute': { - name: 'Peachtree Institute', + name: 'Bedrock Institute', }, 'bedrock-university': { - name: 'Peachtree University', + name: 'Bedrock University', }, }; diff --git a/services/api/openapi.json b/services/api/openapi.json index ec356d02d..b35b1c6b2 100644 --- a/services/api/openapi.json +++ b/services/api/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "info": { "version": "0.0.1", - "title": "Peachtree API" + "title": "Bedrock API" }, "servers": [ { diff --git a/services/api/package.json b/services/api/package.json index d6feee2dd..8b804f45e 100644 --- a/services/api/package.json +++ b/services/api/package.json @@ -1,6 +1,6 @@ { - "name": "peachtree-api", - "description": "Peachtree API", + "name": "bedrock-api", + "description": "Bedrock API", "version": "0.0.1", "license": "MIT", "engines": { diff --git a/services/web/.env b/services/web/.env index c941207f9..b4743ae68 100644 --- a/services/web/.env +++ b/services/web/.env @@ -16,11 +16,11 @@ HTTP_BASIC_AUTH_PASS= ENV_NAME=development -APP_NAME=Peachtree +APP_NAME=Bedrock APP_URL=http://localhost:2200 API_URL=http://localhost:2300 API_KEY=web -APP_SUPPORT_EMAIL=support@ptre.dev +APP_SUPPORT_EMAIL=support@bedrock.foundation # Sentry Error Tracking SENTRY_DSN= diff --git a/services/web/README.md b/services/web/README.md index e669850b0..cc6272335 100644 --- a/services/web/README.md +++ b/services/web/README.md @@ -1,4 +1,4 @@ -# Peachtree Web +# Bedrock Web - [Components Documentation](src/components) - [Utils Documentation](src/utils) diff --git a/services/web/package.json b/services/web/package.json index bd4e4197c..7b4b8fb6d 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -1,5 +1,5 @@ { - "name": "peachtree-web", + "name": "bedrock-web", "version": "0.0.1", "license": "MIT", "engines": { diff --git a/services/web/src/stores/README.md b/services/web/src/stores/README.md index 0367839ab..e02b7bcea 100644 --- a/services/web/src/stores/README.md +++ b/services/web/src/stores/README.md @@ -11,7 +11,7 @@ Components can inject a session store, allowing them to access and react to chan Class based components can be injected with the session store using the HOC `withSession`, and accessed with `this.context`. -Peachtree by default shows a loader while the session is bootstrapping. This means that you can use `withSession` and depend on the `user` object to exist when the wrapped component is mounted if the user is logged in. In most cases this is acceptable, however if the app needs to be more responsive (ie. display non-user specific content while bootstrapping), it can be removed (see [App.js](../App.js)) which will allow the wrapped component to render before the session is loaded. For most cases, `withSession` can still be used as the wrapped component will re-render when the session is loaded. For the less common case when components need to load data on `componentDidMount` another HOC `withLoadedSession` is provided. This will wait to mount the wrapped component until the session has been bootstrapped. +Bedrock by default shows a loader while the session is bootstrapping. This means that you can use `withSession` and depend on the `user` object to exist when the wrapped component is mounted if the user is logged in. In most cases this is acceptable, however if the app needs to be more responsive (ie. display non-user specific content while bootstrapping), it can be removed (see [App.js](../App.js)) which will allow the wrapped component to render before the session is loaded. For most cases, `withSession` can still be used as the wrapped component will re-render when the session is loaded. For the less common case when components need to load data on `componentDidMount` another HOC `withLoadedSession` is provided. This will wait to mount the wrapped component until the session has been bootstrapped. ```jsx import { withSession } from 'stores';