Skip to content

Commit

Permalink
Develop (#49)
Browse files Browse the repository at this point in the history
* Incorporate all historical changes to align with mojaloop.

* Tested locally with provided scripts - passed
Tested with Postman - passed
To be fixed: Credentials on tests for SMTP

* Fixed Emailing test with a valid user

* fixes for unit test issues

* re-added sidecar enabled

* fixes and updates to tests and package

* fixes for functional tests

* fixing unit tests, stubbing smtp server

* settlement coverage

* unit testing for settlements and csv

* removed console.logs

* code working except for test

* fixes for some tests

* updates for validation working

* fixing reorder

* reverting

* fix file path

* added updated config.yml script

* testing

* unit test fixes and changes. coverage failing

* fixes for coverage tests only setup.js left now

* fixes for docker version and updated onboarding doc

* removing fs-extra

* reverting default json for sidecar

* Fix src/setup/setup.js tests

* updated code for functional tests and integration tests

* files for integration and functional tests

* fixes for testing

* sodium build issues

* issues with sodium

* removed global install of sodium and argon which is breaking circleci build. build is currently cached so it may break again because of cache

* version upgrade

* added local install of tape and tap-xunit to config.yml and test.dockerfile

* version change so that cache refreshes

* dependency issue for tape and tap-xunit

* added tape and tap-xunit for test.docker file back for testing to pass
  • Loading branch information
rmothilal authored Mar 11, 2018
1 parent be3ff36 commit 385d9ea
Show file tree
Hide file tree
Showing 116 changed files with 2,465 additions and 2,441 deletions.
135 changes: 71 additions & 64 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defaults_working_directory: &defaults_working_directory

defaults_docker_node: &defaults_docker_node
docker:
- image: dwolla/alpine-node-make
- image: mhart/alpine-node:8.9.4

defaults_docker_helm_kube: &defaults_docker_helm_kube
docker:
Expand All @@ -18,13 +18,14 @@ defaults_docker_helm_kube: &defaults_docker_helm_kube
# # - TAG_EXP_SNAPSHOT: 'v[0-9]+(\.[0-9]+)*\-SNAPSHOT'
# # - TAG: v1.0

defaults_Dependencies: &defaults_Dependencies |
defaults_Dependencies: &defaults_Dependencies |
apk --no-cache add git
apk --no-cache add ca-certificates
apk --no-cache add curl
apk --no-cache add openssh-client
apk add --no-cache -t build-dependencies make gcc g++ python libtool autoconf automake

defaults_awsCliDependencies: &defaults_awsCliDependencies |
defaults_awsCliDependencies: &defaults_awsCliDependencies |
apk --no-cache add \
python \
py-pip \
Expand Down Expand Up @@ -76,7 +77,7 @@ defaults_deploy_config_kubernetes_credentials: &defaults_deploy_config_kubernete
command: |
echo "Configure Kubernetes credentails ${K8_USER_NAME}"
kubectl config set-credentials $K8_USER_NAME --client-certificate=$CIRCLE_WORKING_DIRECTORY/$AWS_S3_DIR_DEVOPS_DEPLOYMENT_CONFIG_KEYS/$K8_USER_PEM_CERT_FILENAME --client-key=$CIRCLE_WORKING_DIRECTORY/$AWS_S3_DIR_DEVOPS_DEPLOYMENT_CONFIG_KEYS/$K8_USER_PEM_KEY_FILENAME
defaults_deploy_config_kubernetes_context: &defaults_deploy_config_kubernetes_context
name: Confi gure Kubernetes context
command: |
Expand All @@ -100,13 +101,13 @@ defaults_deploy_install_or_upgrade_helm_chart: &defaults_deploy_install_or_upgra
echo "Install or Upgrade Chart ${K8_RELEASE_NAME} for Docker Image ${DOCKER_ORG}/${CIRCLE_PROJECT_REPONAME}:${CIRCLE_TAG}"
if [ -z "$(helm list -q | grep ${K8_RELEASE_NAME})" ] && [ "$(helm list -q | grep ${K8_RELEASE_NAME})" != "Error: Unauthorized" ];
then
echo "Installing ${K8_RELEASE_NAME} new release"
echo "Installing ${K8_RELEASE_NAME} new release"
helm install --namespace=$K8_NAMESPACE --name=$K8_RELEASE_NAME --repo=$K8_HELM_REPO $HELM_VALUE_SET_VALUES -f $CIRCLE_WORKING_DIRECTORY/$AWS_S3_DIR_DEVOPS_DEPLOYMENT_CONFIG_HELM/$HELM_VALUE_FILENAME $K8_HELM_CHART_NAME
else
echo "Upgrading ${K8_RELEASE_NAME} release"
echo "Upgrading ${K8_RELEASE_NAME} release"
helm upgrade $K8_RELEASE_NAME --repo=$K8_HELM_REPO --reuse-values $HELM_VALUE_SET_VALUES $K8_HELM_CHART_NAME
fi
jobs:
setup:
<<: *defaults_working_directory
Expand All @@ -117,25 +118,28 @@ jobs:
command: *defaults_Dependencies
- checkout
- run:
name: Install interledgerjs/five-bells-ledger-api-tests
command: npm install github:interledgerjs/five-bells-ledger-api-tests
name: Access npm folder as root
command: cd $(npm root -g)/npm
- run:
name: Link NPM sodium
command: npm link sodium
name: Install node-gyp globally
command: npm install -g node-gyp
- run:
name: Link NPM argon2
command: npm link argon2
name: Install interledgerjs/five-bells-ledger-api-tests
command: npm install github:interledgerjs/five-bells-ledger-api-tests
- run:
name: Update NPM install
command: npm install
- run:
name: Delete build dependencies
command: apk del build-dependencies
# - run:
# name: Update NPM install
# command: npm link sodium && npm link argon2 && npm install --production
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- node_modules

test-unit:
<<: *defaults_working_directory
<<: *defaults_docker_node
Expand All @@ -146,18 +150,21 @@ jobs:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
- run:
name: Install tape and tap-xunit
command: npm install -g tape tap-xunit
- run:
name: Create dir for test results
command: mkdir -p ./test/results
- run:
- run:
name: Execute unit tests
command: npm -s run test:xunit > ./test/results/tape.xml
- store_artifacts:
path: ./test/results
prefix: test
- store_test_results:
path: ./test/results

test-coverage:
<<: *defaults_working_directory
<<: *defaults_docker_node
Expand All @@ -171,7 +178,7 @@ jobs:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
- run:
name: Execute code coverage check
command: npm -s run test:coverage-check
- store_artifacts:
Expand All @@ -184,36 +191,36 @@ jobs:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ];
then
echo "Sending lcov.info to SonarQube..."
echo "Sending lcov.info to SonarQube..."
aws s3 cp coverage/lcov.info $AWS_S3_DIR_SONARQUBE/central-ledger/lcov.info
else
echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube."
fi
echo "Not a release (env CIRCLE_BRANCH != 'master'), skipping sending lcov.info to SonarQube."
fi
test-integration:
machine: true
<<: *defaults_working_directory
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
- run:
name: Create dir for test results
command: mkdir -p ./test/results
- run:
- run:
name: Execute unit tests
command: npm -s run test:integration
- store_artifacts:
path: ./test/results
prefix: test
- store_test_results:
path: ./test/results

test-functional:
machine: true
<<: *defaults_working_directory
steps:
- run:
- run:
name: Add the Postgres 9.6 binaries to the path.
command: echo ‘/usr/lib/postgresql/9.6/bin/:$PATH’ >> $BASH_ENV
- run:
Expand All @@ -225,10 +232,10 @@ jobs:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
- run:
name: Create dir for test results
command: mkdir -p ./test/results
- run:
- run:
name: Execute unit tests
command: npm -s run test:functional
- store_artifacts:
Expand All @@ -240,28 +247,28 @@ jobs:

# test-spec:
# machine: true
# # <<: *defaults
# # <<: *defaults
# steps:
# # - run:
# # name: Install general dependencies
# # command: *defaultDependencies
# # - run:
# # name: Add the Postgres 9.6 binaries to the path.
# # command: apk --no-cache add postgresql-client
# # - setup_remote_docker
# # - run:
# # name: Add docker
# # command: apk --no-cache add docker
# # - run:
# # name: Add docker compose
# # command: |
# # apk --no-cache add py-pip
# # pip install docker-compose
# # - run:
# # name: Install Docker Compose
# # command: |
# # curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose; chmod +x /usr/local/bin/docker-compose
# - run:
# # - run:
# # name: Install general dependencies
# # command: *defaultDependencies
# # - run:
# # name: Add the Postgres 9.6 binaries to the path.
# # command: apk --no-cache add postgresql-client
# # - setup_remote_docker
# # - run:
# # name: Add docker
# # command: apk --no-cache add docker
# # - run:
# # name: Add docker compose
# # command: |
# # apk --no-cache add py-pip
# # pip install docker-compose
# # - run:
# # name: Install Docker Compose
# # command: |
# # curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose; chmod +x /usr/local/bin/docker-compose
# - run:
# name: Add the Postgres 9.6 binaries to the path.
# command: echo ‘/usr/lib/postgresql/9.6/bin/:$PATH’ >> $BASH_ENV
# - run:
Expand All @@ -273,10 +280,10 @@ jobs:
# - checkout
# - restore_cache:
# key: dependency-cache-{{ checksum "package.json" }}
# - run:
# - run:
# name: Create dir for test results
# command: mkdir -p ./test/results
# - run:
# - run:
# name: Execute unit tests
# command: npm -s run test:spec
# - store_artifacts:
Expand Down Expand Up @@ -316,7 +323,7 @@ jobs:
<<: *defaults_build_docker_build
- run:
<<: *defaults_build_docker_publish

deploy-snapshot:
<<: *defaults_working_directory
<<: *defaults_docker_helm_kube
Expand Down Expand Up @@ -385,7 +392,7 @@ workflows:
tags:
only: /.*/
branches:
ignore:
ignore:
- /feature*/
- /bugfix*/
- test-unit:
Expand All @@ -396,9 +403,9 @@ workflows:
tags:
only: /.*/
branches:
ignore:
ignore:
- /feature*/
- /bugfix*/
- /bugfix*/
- test-coverage:
context: org-global
requires:
Expand All @@ -407,7 +414,7 @@ workflows:
tags:
only: /.*/
branches:
ignore:
ignore:
- /feature*/
- /bugfix*/
- test-integration:
Expand All @@ -418,7 +425,7 @@ workflows:
tags:
only: /.*/
branches:
ignore:
ignore:
- /feature*/
- /bugfix*/
- test-functional:
Expand All @@ -429,7 +436,7 @@ workflows:
tags:
only: /.*/
branches:
ignore:
ignore:
- /feature*/
- /bugfix*/
# - test-spec:
Expand All @@ -438,9 +445,9 @@ workflows:
# - setup
# filters:
# tags:
# only: /.*/
# only: /.*/
# branches:
# ignore:
# ignore:
# - /feature*/
# - /bugfix*/
- build-snapshot:
Expand All @@ -456,7 +463,7 @@ workflows:
tags:
only: /v[0-9]+(\.[0-9]+)*\-snapshot/
branches:
ignore:
ignore:
- /.*/
- deploy-snapshot:
context: org-global
Expand All @@ -466,7 +473,7 @@ workflows:
tags:
only: /v[0-9]+(\.[0-9]+)*\-snapshot/
branches:
ignore:
ignore:
- /.*/
- build:
context: org-global
Expand All @@ -481,7 +488,7 @@ workflows:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore:
ignore:
- /.*/
- deploy:
context: org-global
Expand All @@ -491,5 +498,5 @@ workflows:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
ignore:
ignore:
- /.*/
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
FROM dwolla/alpine-node-make
FROM mhart/alpine-node:8.9.4

WORKDIR /opt/central-ledger
COPY . /opt/central-ledger

RUN npm link sodium && \
npm link argon2 && \
npm install --production && \
RUN apk add --no-cache -t build-dependencies make gcc g++ python libtool autoconf automake \
&& cd $(npm root -g)/npm \
&& npm install -g node-gyp

RUN npm install --production && \
npm uninstall -g npm

RUN apk del build-dependencies

EXPOSE 3000
CMD node src/api/index.js
6 changes: 3 additions & 3 deletions Onboarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ Download the nvm install script via cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
```
* Ensure that nvm was installed correctly with `nvm --version`, which should return the version of nvm installed
* Install the version of Node.js you want:
* Install the version (8.9.4 current LTS) of Node.js you want:
* Install the latest LTS version with `nvm install --lts`
* Use the latest LTS verison with `nvm use --lts`
* Install the latest version with `nvm install node`
* Use the latest version with `nvm use node`
* If necessary, fallback to `nvm install 6.5.0` and `nvm use 6`
* If necessary, fallback to `nvm install 8.9.4` and `nvm use 0.33.6`

##### Setup nvm
Create a *.bash_profile* file with `touch ~/.bash_profile`, then `nano ~/.bash_profile` and *write*:
Expand Down Expand Up @@ -192,4 +192,4 @@ export CLEDG_DATABASE_URI=postgres://central_ledger:cVq8iFqaLuHy8jjKuA@localhost
* `./src/argon2_node.cpp:6:10: fatal error: 'tuple' file not found`
- resolved by running `CXX='clang++ -std=c++11 -stdlib=libc++' npm rebuild`
* sodium v1.2.3 can't compile during npm install
- resolved by installing v2.0.3 `npm install [email protected]`
- resolved by installing v2.0.3 `npm install [email protected]`
Loading

0 comments on commit 385d9ea

Please sign in to comment.