Install Lerna
yarn global add lerna
Install dependencies of all packages
lerna bootstrap
Create .env in repos
yarn start
inside a package's directory to run itgcloud auth login
and login with your overmindbots.com accountgcloud config set project overmind-bots
gcloud container clusters get-credentials staging
to setup staging accessgcloud container clusters get-credentials production
to setup staging accesskubectx
in the Terminal to get a list of contextskubectx <contexName>
to switch to that contextkubens overmindbots
to set the namespace (otherwise you wont see running
components)kubectl get pods
to get the list of running podskubectl logs -f pods/<podId>
to get realtime logs of a podYou can also visit Our cluster in the browser
development
gets a new commitmaster
gets a new commitYou should have access to Our CircleCI. You can see how the deployments are doing there
Setting up local kubernetes (osx)
Installing Helm
helm init --tiller-namespace overmindbots
Setting Kubernetes Secrets
mongodb://dev:dev@overmindbots-mongodb-mongodb.overmindbots.svc.cluster.local:27017/overmindbots
Local deploy
yarn deploy:dev
to build and deploy to local kubernetesyarn deploy:dev --no-build
to only update the kubernetes configCommiting
Use yarn commit
to trigger the commitizen prompt. A pre-commit hook will
ensure that the message is compliant with the conventional-commits
standard.
Continuous Delivery and Branching Model
master
are deployed to productiondevelopment
are deployed to staging (pending beta
branch to control staging)Releases feature is pending since it was causing deployments to fail
Updated dependencies in app-bots-web-panel-web-client
. If anything fails, these were the old ones:
"relay-compiler": "https://github.com/alloy/relay/releases/download/v1.5.0-plugin.3/relay-compiler-1.5.0-plugin.3.tgz",
"relay-runtime": "https://github.com/alloy/relay/releases/download/v1.5.0-plugin.3/relay-runtime-1.5.0-plugin.3.tgz",
"babel-plugin-relay": "https://github.com/alloy/relay/releases/download/v1.5.0-plugin.3/babel-plugin-relay-1.5.0-plugin.3.tgz",
"react-relay": "https://github.com/alloy/relay/releases/download/v1.5.0-plugin.3/react-relay-1.5.0-plugin.3.tgz"
For the sake of simplicity we are going to refer to service/package as S/P.
To add tests to your S/P:
jest.config.js
file in your S/P folder that extends from jest.base.js
config file located in this repo's root path. See example below.test
script in your package.json
to call jest ("test": "jest"
).test
folder next to your S/P src
folder.// jest.config.js
const baseConfig = require('../../jest.base');
module.exports = {
...baseConfig,
// Code to extend base config goes here
};
This is a work in progress, but these are the base testing conventions ATM:
spec
, test
, etc.describe
block with a #
followed by the name of the method. Example: describe('Array#sort', () => {})
.describe
block with a .
followed by the name of the method. Example: describe('Object.keys', () => {})
.See service-bot-manager test folder for further info.
To run just your service/package's tests:
cd
into your service/packageyarn test
If you want to run your tests each time a file changes, remember to add
--watch
flag toyarn test
command.
You can also run your S/P tests from the root by calling:
lerna run --scope @overmindbots/my-service test
If you want to run tests of every service/package on the repo, run this command from the root:
lerna run test
Remember you can also pass
scope
flag multiple times in order to run one or multiple tests likelerna run --scope @overmindbots/service-bot-manager --scope @overmindbots/bot-* test
IMPORTANT: All the following instructions considers that we are standing on the S/P folder.
You will need to create a .env.test
file. Then, we need to create a setupTests.ts
file inside your test
folder with the following content:
import dotenv from 'dotenv';
dotenv.config();
dotenv.config({ path: '.env.test' });
// You can also mute winston by adding:
// import logger from 'winston';
// logger.remove(logger.transports.Console);
Now that we created our setup file, we need to tell jest to load this setup file before running any test, this will be achieved by adding the setupTestFrameworkScriptFile
config.
Example:
const baseConfig = require('../../jest.base');
module.exports = {
...baseConfig,
setupTestFrameworkScriptFile: '<rootDir>/test/setupTests.ts', // <-
};