-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Dockerfile for the frontend project and a Docker Compose file f…
…or all of the ATT&CK Workbench services. Modify the method for obtaining URLs for the rest-api and collection-manager. Add instructions for a Docker Compose deployment.
- Loading branch information
Showing
13 changed files
with
177 additions
and
34 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
npm-debug.log |
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,32 @@ | ||
FROM node:10 as build | ||
|
||
# Create app directory | ||
WORKDIR /usr/src/app | ||
|
||
# Install app dependencies | ||
# A wildcard is used to ensure both package.json AND package-lock.json are copied | ||
# where available (npm@5+) | ||
COPY ./app/package*.json ./ | ||
|
||
RUN npm install | ||
# If you are building your code for production | ||
# RUN npm ci --only=production | ||
|
||
# Bundle app source | ||
COPY ./app . | ||
|
||
# Build the bundle | ||
RUN npm run build-prod | ||
|
||
FROM nginx:1.19 | ||
|
||
# Remove the default nginx website | ||
RUN rm -rf /usr/share/nginx/html/* | ||
|
||
# Copy the nginx config file | ||
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Copy the application bundles | ||
COPY --from=build /usr/src/app/dist/app /usr/share/nginx/html | ||
|
||
|
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
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
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
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,36 @@ | ||
version: "3.9" | ||
services: | ||
frontend: | ||
container_name: attack-workbench-frontend | ||
build: . | ||
depends_on: | ||
- rest-api | ||
- collection-manager | ||
ports: | ||
- "80:80" | ||
|
||
rest-api: | ||
container_name: attack-workbench-rest-api | ||
build: ../rest-api | ||
depends_on: | ||
- mongodb | ||
ports: | ||
- "3000:3000" | ||
environment: | ||
- DATABASE_URL=mongodb://attack-workbench-database/attack-workspace | ||
|
||
collection-manager: | ||
container_name: attack-workbench-collection-manager | ||
build: ../collection-manager | ||
depends_on: | ||
- rest-api | ||
ports: | ||
- "3001:3001" | ||
environment: | ||
- WORKBENCH_HOST=http://attack-workbench-rest-api | ||
|
||
mongodb: | ||
container_name: attack-workbench-database | ||
image: mongo | ||
ports: | ||
- "27017:27017" |
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,43 @@ | ||
# Docker Compose Installation | ||
|
||
This document describes how to install the ATT&CK Workbench components using Docker Compose. | ||
|
||
## Project Structure | ||
|
||
This project (ATT&CK Workbench Frontend) includes a `docker-compose.yml` file that configures the Docker Compose installation. | ||
In addition to this project, the ATT&CK Workbench REST API and ATT&CH Workbench Collection Manager projects must be pulled from the github repository. | ||
These projects must be placed under a common parent directory: | ||
|
||
``` | ||
|-- <common parent directory> | ||
|-- frontend | ||
|-- rest-api | ||
|-- collection-manager | ||
``` | ||
|
||
## Install Process | ||
|
||
1. Navigate to the `frontend` directory (containing the `docker-compose.yml` file) | ||
2. Run the command: | ||
```shell | ||
docker-compose up | ||
``` | ||
|
||
This command will build all of the necessary Docker images and run the corresponding Docker containers. | ||
|
||
### Containers | ||
|
||
When deployed using Docker Compose, an ATT&CK Workbench installation will include four containers: | ||
* frontend | ||
* rest-api | ||
* collection-manager | ||
* mongodb | ||
|
||
These containers will communicate as illustrated in the diagram below. | ||
The `nginx` instance (part of the `frontend` container) is responsible for serving the statically built code for the ATT&CK Workbench web application. | ||
It also acts as a reverse proxy for the `rest-api` and `collection-manager` services. | ||
|
||
![Workbench Configuration](images/workbench-configuration-docker-compose.png) | ||
|
||
Note that the `docker-compose.yml` file exposes the ATT&CK Workbench web application on port 80. | ||
The `nginx` configuration file (`nginx/nginx.conf`) can be modified to use HTTPS and port 443, depending on your operational requirements. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,33 @@ | ||
worker_processes 1; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
include /etc/nginx/mime.types; | ||
|
||
gzip on; | ||
gzip_min_length 1000; | ||
gzip_proxied expired no-cache no-store private auth; | ||
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
location /api { | ||
proxy_pass http://attack-workbench-rest-api:3000; | ||
} | ||
|
||
location /cm-api { | ||
proxy_pass http://attack-workbench-collection-manager:3001; | ||
} | ||
} | ||
} |