Development, Test and Production¶
This document describes:
- How to setup the development/test environment for this project;
- How to release it as a standalone application, run it with docker-compose.
Prerequisite for Development, Test and Production¶
This is a NodeJS project, implemented with TypeScript, applied LoopBack 4 framework to provide RESTful APIs.
To run or test it, you need to install the following dependencies in your sandbox.
Follow the steps to setup your developing/testing sandbox.
- Fork this code repository to your own repository.
- Clone your repository to local sandbox.
- Change directory to <localrepo>/app/waf.
- Run command
npm installto install all package dependencies.
- Source codes are under <localrepo>/app/waf/src.
- Use your preferred IDE(VIM or VSCode) for the development.
VSCode is recommended because it’s easy to debug the typescript after
tasks.json for the debug. See
- Manually testing requires a set of containers to be started: ASG, DO and POSTGRES.
Refer to the docker-compose command from Run ADCaaS as Standalone Application of this document.
The testing code(include acceptance and unit test) is under <localrepo>/app/waf/test.
npm run prettier:fix && npm run buildto compile it.
npm run prettier:fix is to apply tslint to the code.
npm testto to trigger all test cases.
npm run coverageto check the code coverages.
The code coverage should be fulfilled before check in.
More details about development and test, see <localrepo>/app/waf/packages.json.
ADCaaS is supported to be released as a docker image which users can pull from a docker repository.
The docker repository is owed by either users themselves or F5Networks.
Release Docker Image Locally¶
- Go to folder <localrepo>/app/waf, where locates the
- Run docker build command mentioned in <localrepo>/app/waf/Dockerfile.
docker build . -t f5devcentral/f5-openstack-services:latest
Note that: Change f5devcentral/f5-openstack-services to your own [repo/tag:version].
Publish ADCaaS Image To Docker Repository¶
docker push [repo/tag:version] to push your generated image to
the public repository(after docker login).
Run ADCaaS as Standalone Application¶
You can use <localrepo>/scripts/start_all.sh to start all. The script is responsible for:
- run the container initialization.
- enable environment settings.
docker-compose up -d -f <localrepo>/deploy/docker-compose.ymlto start ADCAAS container and its dependent containers, see that docker-compose.yml file.
Note: on MacOSX, running
start_all.sh may get the error:
ERROR: for ASG Cannot start service ASG: Mounts denied: The path /var/tmp/ASGExtensions is not shared from OS X and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> File Sharing. See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info.
to the settings as it mentions.
Note that for development and test, the ADCAAS container should be
stopped and removed since we run ADCaaS application locally instead of
the container. Use
docker rm --force ADCAAS to remove it after
docker-compose up -d.
We have already included the auto deployment in
docker compose'. After running 'start_all.sh, run
docker ps to
check the containers. Images of EFK described above should be present.
In order to read logs, follow the instruction below.
- With a browser, go to the Kibana port address (aka.
http://localhost:5601/) listed by running
Discoveron the left and you will be prompted to create index pattern.
Success! Your index pattern matches # index.following a tick should show up. Press
Time Filter field nameand press
Create index pattern.
- After configuring an index pattern, you can go to
Discoverto view the logs.
Sometimes when there are multiple processes running, it is likely that
logs for them are mixed together, causing diagnosis difficult. To deal
with this scenario, we have incorporated the request ID generated by
each unique api call in logs it triggers. IDs are enclosed in
together with the name of component generating the log, indicated in the
beginning of each log message. Users of F5 ADCaaS and EFK can filter
logs by request ID as following:
- Upon making an api call successfully, a piece of log should read
Authentication OK: Request IDfollowed by the id. Save this information.
- In Kibana Discover search bar, type
message:followed by the request ID enclosed in quotation marks (e.g.
message: "9a8d2730-ad33-11e9-b5c0-d312442f5dc4") and press