Skip to content

Developers Page

Alchemist edited this page Sep 8, 2018 · 1 revision

Quick Note

As the Unfetter Team grows, we are trying to be more thoughtful in describing what Developers should know.

The below is a list of tools, standards, and processes we follow.

Tools

These are the tools we use and how we use them.

Version Control

  • We use GitHub for our version control
  • Our main branches are the Master branch and the Develop branch
    • The Master branch is where our releases are tagged from.
    • The develop branch is where any working code is pushed to. It should not break Unfetter
    • We are following the Git Flow process.
    • Feature Branches are either named as "issue-" based on the GitHub issue it corresponds to.
    • Larger feature branches, that incorporate multiple Issues, can be named "descriptive-title" using "-" to separate words. Don't make it too big.
    • Feature Branches are rebased, usually merged onto develop branch.
    • Feature branches are merged, via Pull Requests.
    • When a PR is approved and merged, we try and use the squash commit options. This gives a cleaner, linear commit history.
    • Commit messages should be detailed. If a commit fixes a particular Issue, then the commit message should specifically say " Fixes unfetter-discover/unfetter#issuenumber", which will automatically link the commit to the issue, and will close the issue when that commit is merged to the develop branch.

Issue Tracking

  • We use the GitHub Issue tracker for all issues. All pull requests will have at least one accompanying Issue.
  • All issues for Unfetter-Discover are in the Unfetter repo of the Unfetter Discover GitHub organization.

User Interface

Building The UI

Unfetter uses Angular CLI to bundle, zip, and transpile its user interface into deployable javascript and assets.

Deployment

Unfetter is built as a set of Docker containers. Deployment of the multiple containers is orchestrated by Docker Compose

The Docker images extends the Alpine Linux for a minimal footprint

Proxy Load Balance

Unfetter uses the NGINX web server to load balance UI asset and micro service requests. If running locally for demo, Unfetter generates self signed SSL certificates. For production deployment, a valid SSL certificate is highly recommended

Microservice architecture with Docker

  • Uses RESTful inspired webservices
  • API built on the the JSON API standard.
  • Uses Node 9.X or 8.X LTS to run its backend web services.
  • Uses Swagger to document is forward facing endpoints.

Testing

Unfetter uses test driven development methods. More information will be coming.

Linting

  • Unfetter uses Linting, extending the 'airbnb-base' for its javascript projects.
  • Angular CLI UI linting extends Codelyzer.

Database

  • There are two Mongo collections. One for all the STIX and MitreAttackPattern data, the other is for configuration of Unfetter.
  • Unfetter makes use of Mongodb.

Debugging

  • Here is how you debug node in docker with vs code
  1. Go to the debug tab
  2. Click the gear to bring up launch.json
  3. Add the following configuration to the list:
{
  "type": "node",
  "request": "attach",
  "name": "unfetter API",
  "address": "localhost",
  "port": 5555,
  "localRoot": "${workspaceRoot}/(place route to unfetter store here)/unfetter-discover-api",
  "remoteRoot": "/usr/share/unfetter-discover-api",
  "protocol": "inspector"
}

More Details On GitHub

  • Create a Github issue in unfetter-discover/unfetter
  • From the latest develop branch, checkout a new feature branch. Prefix the branch with an issue- or just give the branch a descriptive name.
git checkout develop
git fetch --all -p && git pull
git checkout -b issue-000
  • Edit your files, add them to the index and commit them as you normally would. When adding a commit message you can specify the issue number.
git add .
git commit -m "unfetter-discover/unfetter#<issue-num>"
  • Push your files to the remote origin
git push --set-upstream origin issue-000
  • Optionally, rebase against the latest develop branch
git checkout develop
git fetch --all -p && git pull
git checkout -
git rebase develop
git status
git push [-f]
  • Check lint and tests
npm run lint
npm run test
npm run build:aot:prod # ui only
  • Open a Pull Request in the respective project. ie; ui, store, or unfetter Be sure to select develop as the base branch and issue-<num> as the compare branch.

For external developers

External developers use a Git fork vs. Git branch model. You are welcome to do a Pull Request back to our repo. But please make sure there is an issue that states what is needed and how its done.