feedhenry / fh-mbaas

FeedHenry MBaaS Management Service
Apache License 2.0
2 stars 33 forks source link

fh-mbaas - FeedHenry MBaaS Management Service

Email Configuration

To configure email sending from fh-mbaas, the email.transport configuration property must be set to:

  "auth": {
      "api_user": "SENDGRID_USER",
      "api_key": "SENDGRID_PASSWORD"
    }

"smtps://user:password@smtp.example.com"

OSE3

For OSE3 images, fh-mbaas will use smtp by default. An administrator must add an Environment variable to configure fh-mbaas to use a local SMTP relay/server - the name of this environment variable is FH_EMAIL_SMTP and it should be set to an SMTP URL:

e.g.

smtps://user:password@smtp.example.com

Testing (grunt fh:test)

Developing on OpenShift

For development purposes, we can build a CentOS based Docker image and watch for changes in the local filesystem which would be reflected in the running image.

Build the development image

  1. Generate the config file: grunt fh-generate-dockerised-config
  2. docker build -t docker.io/my-Username/fh-mbaas:dev -f Dockerfile.dev .
  3. docker push docker.io/my-Username/fh-mbaas:dev
  4. oc edit dc fh-mbaas
  5. Replace the image with the tagged version above.

Hot Deployment

The development image will allow you to sync local code changes to the running container without the need for rebuilding or redeploying the image.

From the root of the `fh-mbaas directory, run the following:

oc rsync --no-perms=true --watch ./lib $(oc get po | grep fh-mbaas | grep Running | awk '{print $1}'):/opt/app-root/src

Debugging with VS Code

  1. Open Visual Studio Code
  2. oc set probe dc fh-mbaas --liveness --readiness --remove=true
  3. oc port-forward $(oc get po | grep fh-mbaas | grep Running | awk '{print $1}') :5858. - This will forward port 5858 from the running Pod to a local port. Note the port.
  4. Select the debug option and choose Node.js as the runtime.
  5. Set the launch.json file similar to the following, using the port obtained above via the port forward command:
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "Attach to Remote",
      "address": "localhost",
      "port": 59180,
      "localRoot": "${workspaceRoot}",
      "remoteRoot": "/opt/app-root/src/"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "program": "${workspaceRoot}/fh-mbaas.js"
    }
  ]
}
  1. Click Attach to Remote.

License

fh-mbaas is licensed under the Apache License, Version 2.0.