Loading .deploy/api/Dockerfile +2 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ ARG DB_USER ARG DB_PASS ARG DB_TYPE ARG DB_SSL_MODE ARG DB_CA_CERT ARG DEMO ARG HOST ARG PORT Loading Loading @@ -110,6 +111,7 @@ ENV DB_USER=${DB_USER} ENV DB_PASS=${DB_PASS} ENV DB_TYPE=${DB_TYPE:-mongodb} ENV DB_SSL_MODE=${DB_SSL_MODE} ENV DB_CA_CERT=${DB_CA_CERT} ENV HOST=${HOST:-0.0.0.0} ENV PORT=${PORT:-5500} ENV DEMO=${DEMO:-false} Loading .deploy/api/entrypoint.prod.sh +1 −4 Original line number Diff line number Diff line Loading @@ -3,7 +3,4 @@ set -ex # This Entrypoint used when we run Docker container outside of Docker Compose (e.g. in k8s) # Temporary run Mongo inside same container mongod --bind_ip 0.0.0.0 --fork --syslog exec "$@" .deploy/k8s/k8s-manifest.demo.yaml +18 −2 Original line number Diff line number Diff line Loading @@ -102,16 +102,32 @@ spec: value: '5555' - name: GQLPORT_SUBSCRIPTIONS value: '5050' - name: DB_URI value: 'mongodb://localhost/ever_development' - name: ADMIN_PASSWORD_RESET value: 'true' - name: FAKE_DATA_GENERATOR value: 'true' - name: LOG_LEVEL value: 'info' - name: SENTRY_DSN value: 'https://7cd381188b6f446ca0e69185227b9031@o51327.ingest.sentry.io/4397292' - name: DB_URI value: $DB_URI - name: DB_HOST value: $DB_HOST - name: DB_SSL_MODE value: $DB_SSL_MODE - name: DB_CA_CERT value: $DB_CA_CERT - name: DB_USER value: $DB_USER - name: DB_PASS value: $DB_PASS - name: DB_TYPE value: 'mongodb' - name: DB_NAME value: 'ever_demo' - name: DB_PORT value: '27017' ports: - containerPort: 5500 protocol: TCP Loading .github/workflows/deploy-do.yml +8 −1 Original line number Diff line number Diff line Loading @@ -28,8 +28,15 @@ jobs: - name: Apply k8s manifests changes in DigitalOcean k8s cluster (if any) run: | export DB_HOST=yoyoyoyo envsubst < $GITHUB_WORKSPACE/.deploy/k8s/k8s-manifest.demo.yaml | kubectl --context do-sfo2-k8s-ever apply -f - env: DB_URI: ${{ secrets.DB_URI }} DB_HOST: ${{ secrets.DB_HOST }} DB_USER: ${{ secrets.DB_USER }} DB_PASS: ${{ secrets.DB_PASS }} DB_NAME: 'ever_demo' DB_CA_CERT: ${{ secrets.DB_CA_CERT }} DB_SSL_MODE: 'true' # we need this step because for now we just use :latest tag # note: for production we will use different strategy later Loading packages/core/src/app.module.ts +16 −3 Original line number Diff line number Diff line Loading @@ -2,9 +2,7 @@ import { MiddlewareConsumer, Module, NestModule, OnModuleInit, HttpServer, Inject, OnModuleInit } from '@nestjs/common'; import mongoose from 'mongoose'; import { GraphQLSchema } from 'graphql'; Loading Loading @@ -87,9 +85,24 @@ export const EventHandlers = []; const entities = ServicesApp.getEntities(); const isSSL = process.env.DB_SSL_MODE && process.env.DB_SSL_MODE !== 'false'; let sslCert; if (isSSL) { sslCert = process.env.DB_CA_CERT; } const connectionSettings: TypeOrmModuleOptions = { type: 'mongodb', url: env.DB_URI, ssl: isSSL, sslCert: isSSL ? sslCert : undefined, host: process.env.DB_HOST || 'localhost', username: process.env.DB_USER, password: process.env.DB_PASS, database: process.env.DB_NAME || 'ever_development', port: process.env.DB_PORT ? parseInt(process.env.DB_PORT, 10) : 27017, entities, synchronize: true, useNewUrlParser: true, Loading Loading
.deploy/api/Dockerfile +2 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ ARG DB_USER ARG DB_PASS ARG DB_TYPE ARG DB_SSL_MODE ARG DB_CA_CERT ARG DEMO ARG HOST ARG PORT Loading Loading @@ -110,6 +111,7 @@ ENV DB_USER=${DB_USER} ENV DB_PASS=${DB_PASS} ENV DB_TYPE=${DB_TYPE:-mongodb} ENV DB_SSL_MODE=${DB_SSL_MODE} ENV DB_CA_CERT=${DB_CA_CERT} ENV HOST=${HOST:-0.0.0.0} ENV PORT=${PORT:-5500} ENV DEMO=${DEMO:-false} Loading
.deploy/api/entrypoint.prod.sh +1 −4 Original line number Diff line number Diff line Loading @@ -3,7 +3,4 @@ set -ex # This Entrypoint used when we run Docker container outside of Docker Compose (e.g. in k8s) # Temporary run Mongo inside same container mongod --bind_ip 0.0.0.0 --fork --syslog exec "$@"
.deploy/k8s/k8s-manifest.demo.yaml +18 −2 Original line number Diff line number Diff line Loading @@ -102,16 +102,32 @@ spec: value: '5555' - name: GQLPORT_SUBSCRIPTIONS value: '5050' - name: DB_URI value: 'mongodb://localhost/ever_development' - name: ADMIN_PASSWORD_RESET value: 'true' - name: FAKE_DATA_GENERATOR value: 'true' - name: LOG_LEVEL value: 'info' - name: SENTRY_DSN value: 'https://7cd381188b6f446ca0e69185227b9031@o51327.ingest.sentry.io/4397292' - name: DB_URI value: $DB_URI - name: DB_HOST value: $DB_HOST - name: DB_SSL_MODE value: $DB_SSL_MODE - name: DB_CA_CERT value: $DB_CA_CERT - name: DB_USER value: $DB_USER - name: DB_PASS value: $DB_PASS - name: DB_TYPE value: 'mongodb' - name: DB_NAME value: 'ever_demo' - name: DB_PORT value: '27017' ports: - containerPort: 5500 protocol: TCP Loading
.github/workflows/deploy-do.yml +8 −1 Original line number Diff line number Diff line Loading @@ -28,8 +28,15 @@ jobs: - name: Apply k8s manifests changes in DigitalOcean k8s cluster (if any) run: | export DB_HOST=yoyoyoyo envsubst < $GITHUB_WORKSPACE/.deploy/k8s/k8s-manifest.demo.yaml | kubectl --context do-sfo2-k8s-ever apply -f - env: DB_URI: ${{ secrets.DB_URI }} DB_HOST: ${{ secrets.DB_HOST }} DB_USER: ${{ secrets.DB_USER }} DB_PASS: ${{ secrets.DB_PASS }} DB_NAME: 'ever_demo' DB_CA_CERT: ${{ secrets.DB_CA_CERT }} DB_SSL_MODE: 'true' # we need this step because for now we just use :latest tag # note: for production we will use different strategy later Loading
packages/core/src/app.module.ts +16 −3 Original line number Diff line number Diff line Loading @@ -2,9 +2,7 @@ import { MiddlewareConsumer, Module, NestModule, OnModuleInit, HttpServer, Inject, OnModuleInit } from '@nestjs/common'; import mongoose from 'mongoose'; import { GraphQLSchema } from 'graphql'; Loading Loading @@ -87,9 +85,24 @@ export const EventHandlers = []; const entities = ServicesApp.getEntities(); const isSSL = process.env.DB_SSL_MODE && process.env.DB_SSL_MODE !== 'false'; let sslCert; if (isSSL) { sslCert = process.env.DB_CA_CERT; } const connectionSettings: TypeOrmModuleOptions = { type: 'mongodb', url: env.DB_URI, ssl: isSSL, sslCert: isSSL ? sslCert : undefined, host: process.env.DB_HOST || 'localhost', username: process.env.DB_USER, password: process.env.DB_PASS, database: process.env.DB_NAME || 'ever_development', port: process.env.DB_PORT ? parseInt(process.env.DB_PORT, 10) : 27017, entities, synchronize: true, useNewUrlParser: true, Loading