Skip to content

topcoder-platform/tc-bus-api

Repository files navigation

Topcoder Bus API Server

Overview

A meta service, Topcoder Bus API server provides information about other services offered by Topcoder.

This server was generated initially by the swagger-codegen project. We then copied over changes that existed in the older version over to version 5

Requirements

Nodejs: Version ~8

Configuration

The following Kafka configurations must be set in the environment variables:

  • KAFKA_URL the Kafka url
  • KAFKA_CLIENT_CERT the SSL client cert, can be string or file path
  • KAFKA_CLIENT_CERT_KEY the SSL client cert key, can be string or file path

Example:

export KAFKA_URL="kafka+ssl://ec2-34-205-227-216.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-233-75-247.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-198-118-170.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-231-150-104.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-233-209-20.compute-1.amazonaws.com:9096,kafka+ssl://ec2-34-233-131-252.compute-1.amazonaws.com:9096,kafka+ssl://ec2-52-205-198-73.compute-1.amazonaws.com:9096,kafka+ssl://ec2-52-4-109-80.compute-1.amazonaws.com:9096"

export KAFKA_CLIENT_CERT="-----BEGIN CERTIFICATE-----
MIIDQzCCAiugAwIBAgIBADANBgkqhkiG9w0BAQsFADAyMTAwLgYDVQQDDCdjYS1j
YmJiNGVkZi1mNDFhLTRjNzMtYTg5OC01NDYyMjhkNmQyNDIwHhcNMTcwOTI3MDUw
MTIyWhcNMjcwOTI3MDUwMTIyWjAZMRcwFQYDVQQDDA51ODFvcjFsdTl2dTB1bzCC
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKjkcV/BXD13Q09bRKohN/sK
iDMGFA2QZ57TGd7svX7iZQIk9HmXEPd5zCTHZ6nZBbcGDQ9P+zGlJIGZQuRVKLOn
ZPilaeUHRGrvCWGJZ6lVPNqInC1STHTfFJhcUNMG6qaD2ayBAw16f13vD1wGEWCm
/DRfvrjIp3JIetGdKctmdiGLYH7CQecRW88Czx9e3Vpl1nxGcNAPDDCj0nRwuPse
fVrg5on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/iM
bZpxAoGAEnJFUEGCB1ta3RQpI5L4nH2Rex0Avv8rkXGK2T/t5z2h8Ujg4WW3J7DD
Jp8xItVz3sqz5aCg+EvcewSGZ18AC+9cbxrbI2I83jQDHw+DQmVUyR6rl5+r+S6O
69wdZ08Y/jYkltb5PbhPqs0Kfr86cUqBuKEptRtto6Wto3k/Za4=
-----END RSA PRIVATE KEY-----"

Other Configurations

The other configurations can be changed in config/default.js or by setting environment variables.

  • LOG_LEVEL the logging level, error or debug
  • PORT the port on that app listens
  • API_VERSION the api version
  • JWT_TOKEN_SECRET the secret to sign JWT tokens
  • TC_EMAIL_URL the email service URL (http://localhost:4001, if deployed locally)
  • TC_EMAIL_TOKEN the email service authentication token (see tc-email README for details link should be added later)
  • TC_EMAIL_CACHE_PERIOD the period to cache template placeholders from email service (60 min default)

Deploying the server

To deploy the server locally, run:

npm install
npm start

To view the Swagger UI interface visit http://localhost:3000/docs

This project leverages the mega-awesome swagger-tools middleware which does most all the work.