-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved local installation documentation (#585)
* Update docker-compose.md (#501) fix path error for restAPI image * Update changelog.md * Added more detailed installation and local dev document * edits to installation setup * update local-dev.md and readme.md --------- Co-authored-by: Mike Cunningham <[email protected]> Co-authored-by: Jared Ondricek <[email protected]> Co-authored-by: Erin Hall <[email protected]>
- Loading branch information
1 parent
0082edb
commit 1a0cfda
Showing
2 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# Local Development Documentation | ||
|
||
This document outlines how to set up ATT&CK Workbench for local development. For information on installing and deploying the full application using Docker, please refer to the [docker install instructions](https://github.com/center-for-threat-informed-defense/attack-workbench-frontend/blob/master/docs/docker-compose.md). | ||
|
||
## Prerequisites | ||
|
||
Before running the application locally, ensure you have the following set up: | ||
|
||
1. Clone the required repositories | ||
- [attack-workbench-frontend](https://github.com/center-for-threat-informed-defense/attack-workbench-frontend) repository | ||
- [attack-workbench-rest-api](https://github.com/center-for-threat-informed-defense/attack-workbench-rest-api) repository alongside the frontend | ||
|
||
2. Install [Node.js](https://nodejs.org/) v18 or greater | ||
|
||
3. Install MongoDB | ||
|
||
Follow the official [MongoDB installation guide](https://www.mongodb.com/docs/manual/installation/) to install MongoDB on your operating system. | ||
|
||
|
||
## Configure and Run the REST API | ||
|
||
#### 1. Install dependencies | ||
|
||
Navigate to the `attack-workbench-rest-api` directory and run | ||
|
||
``` | ||
npm install | ||
``` | ||
|
||
#### 2. Configure the system | ||
|
||
Configure the application using environment variables, a configuration file, or a combination. Please refer to the documentation on how to [Configure the System](https://github.com/center-for-threat-informed-defense/attack-workbench-rest-api?tab=readme-ov-file#step-3-configure-the-system) for more details. | ||
|
||
For example, you can use a custom configuration to adapt to your specific environment: | ||
|
||
- Create a `.rest-api-env` file: | ||
|
||
```bash | ||
export DATABASE_URL=mongodb://localhost/attack-workspace | ||
export JSON_CONFIG_PATH="resources/sample-configurations/multiple-apikey-services.json" | ||
export WB_REST_SERVICE_ACCOUNT_CHALLENGE_APIKEY_ENABLE=true | ||
export NODE_EXTRA_CA_CERTS="path/to/cert.crt" | ||
``` | ||
|
||
- Ensure this file is sourced when starting the backend: | ||
|
||
```bash | ||
source .rest-api-env | ||
``` | ||
|
||
#### 3. Run the REST API | ||
|
||
``` | ||
node ./bin/www | ||
``` | ||
Or to run it in the background: | ||
``` | ||
node ./bin/www & | ||
``` | ||
## Setting Up the Frontend | ||
#### 1. Install dependencies | ||
Navigate to the `attack-workbench-frontend/app` directory and run | ||
``` | ||
npm install | ||
``` | ||
#### 2. Run the frontend locally | ||
``` | ||
ng serve | ||
``` | ||
Open your browser and navigate to `http://localhost:4200` | ||
## Note: Recommended setup using Visual Studio Code Workspaces | ||
To streamline your development workflow, you can configure a Visual Studio Code workspace for easier management of both the frontend and REST API repositories. Open VS Code in the `attack-workbench-frontend` directory, add the directory for the REST API repository, and save the workspace. | ||
To automate terminal setups, ensure the "Restore Terminals" extension is installed in VS Code. Open the `.code-workspace` file in a text editor other than VS Code and configure the `restoreTerminals.runOnStartup` and `restoreTerminals.terminals` settings. | ||
Example VS Code Workspace configuration: | ||
```json | ||
{ | ||
"folders": [ | ||
{ | ||
"name": "attack-workbench-rest-api", | ||
"path": "attack-workbench-rest-api" | ||
}, | ||
{ | ||
"name": "attack-workbench-frontend", | ||
"path": "attack-workbench-frontend" | ||
} | ||
], | ||
"settings": { | ||
"terminal.integrated.env.osx": { | ||
"DATABASE_URL": "mongodb://localhost/attack-workspace", | ||
"JSON_CONFIG_PATH": "resources/sample-configurations/multiple-apikey-services.json", | ||
"WB_REST_SERVICE_ACCOUNT_CHALLENGE_APIKEY_ENABLE": "true", | ||
"NODE_EXTRA_CA_CERTS": "path/to/cert.crt" | ||
}, | ||
"restoreTerminals.runOnStartup": true, | ||
"restoreTerminals.terminals": [ | ||
{ | ||
"splitTerminals": [ | ||
{ | ||
"name": "rest-api", | ||
"commands": [ | ||
"cd ../attack-workbench-rest-api/", | ||
"git checkout develop", | ||
"git pull", | ||
"npm ci", | ||
"source /path/to/.rest-api-env", | ||
"node bin/www" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"splitTerminals": [ | ||
{ | ||
"name": "frontend", | ||
"commands": [ | ||
"cd ../attack-workbench-frontend/app/", | ||
"git checkout develop", | ||
"git pull", | ||
"npm ci", | ||
"ng serve --open" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
``` |