You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docker compose is not intended for production use.
4
4
If you want to deploy a containerized DefectDojo to a production environment,
5
5
use the [Default installation](setup/README.md) approach.
6
6
7
-
##Prerequisites
7
+
# Prerequisites
8
8
* Docker version
9
9
* Installing with docker-compose requires at least docker 18.09.4 and docker-compose 1.24.0. See "Checking Docker versions" below for version errors during running docker-compose.
10
10
* Proxies
11
11
* If you're behind a corporate proxy check https://docs.docker.com/network/proxy/ .
12
12
13
13
14
-
##Setup via Docker Compose - introduction
14
+
# Setup via Docker Compose - introduction
15
15
16
16
DefectDojo needs several docker images to run. Two of them depend on DefectDojo code:
17
17
@@ -28,8 +28,8 @@ When running the application without building images, the application will run b
##Setup via Docker Compose - building and running the application
32
-
###Building images
31
+
# Setup via Docker Compose - building and running the application
32
+
## Building images
33
33
34
34
To build images and put them in your local docker cache, run:
35
35
@@ -40,7 +40,7 @@ docker-compose build
40
40
To build a single image, run:
41
41
42
42
```zsh
43
-
docker-compose build django
43
+
docker-compose build uwsgi
44
44
```
45
45
or
46
46
@@ -49,7 +49,7 @@ docker-compose build nginx
49
49
```
50
50
51
51
52
-
###Run with Docker compose in release mode
52
+
## Run with Docker compose in release mode
53
53
To run the application based on previously built image (or based on dockerhub images if none was locally built), run:
54
54
55
55
```zsh
@@ -62,7 +62,7 @@ This will run the application based on docker-compose.yml only.
62
62
In this setup, you need to rebuild django and/or nginx images after each code change and restart the containers.
63
63
64
64
65
-
###Run with Docker compose in development mode with hot-reloading
65
+
## Run with Docker compose in development mode with hot-reloading
66
66
67
67
For development, use:
68
68
@@ -82,7 +82,7 @@ This will run the application based on merged configurations from docker-compose
82
82
* Hot-reloading for the **celeryworker** container is not yet implemented. When working on deduplication for example, restart the celeryworker container with:
83
83
84
84
```
85
-
docker restart django-defectdojo_celeryworker_1
85
+
docker-compose restart celeryworker
86
86
```
87
87
88
88
* The mysql port is forwarded to the host so that you can access your database from outside the container.
@@ -100,32 +100,66 @@ To update changes in static resources, served by nginx, just refresh the browser
100
100
id -u
101
101
```
102
102
103
-
### Access the application
104
-
Navigate to <http://localhost:8080> where you can log in with username admin.
105
-
To find out the admin password, check the very beginning of the console
106
-
output of the initializer container, typically name 'django-defectdojo_initializer_1', or run the following:
103
+
## Run with Docker compose in development mode with ptvsd (remote debug)
104
+
105
+
If you want to be able to step in your code, you can activate ptvsd.Server.
106
+
107
+
You can launch your local dev instance of DefectDojo as
This will run the application based on merged configurations from docker-compose.yml and docker-compose.override.ptvsd.yml.
116
+
117
+
The default configuration assumes port 3000 by default for ptvsd, and you should access the DefectDojo UI on port 8000 instead of port 8080, as the uwsgi container will serve directly.
118
+
119
+
### VS code
120
+
Add the following python debug configuration (You would have to install the `ms-python.python`. Other setup may work.)
121
+
122
+
```
123
+
{
124
+
"name": "Remote DefectDojo",
125
+
"type": "python",
126
+
"request": "attach",
127
+
"pathMappings": [
128
+
{
129
+
"localRoot": "${workspaceFolder}",
130
+
"remoteRoot": "/app"
131
+
}
132
+
],
133
+
"port": 3000,
134
+
"host": "localhost"
135
+
}
136
+
```
137
+
138
+
You can now launch the remote debug from VS Code, place your breakpoints and step through the code.
139
+
140
+
> At present, 2 caveats:
141
+
> - Static will not be present. You would have to `docker cp` them over from the nginx container
142
+
> - For some reason, the page loading may hang. You can stop the loading and reload, the page will ultimately appear.
143
+
144
+
145
+
## Access the application
146
+
Navigate to <http://localhost:8080> where you can log in with username admin.
147
+
To find out the admin password, check the very beginning of the console
- update `docker-compose.override.https.yml` or set DD_PORT in the environment)
234
+
- restart the application
235
+
236
+
NB: some third party software may require to change the exposed port in Dockerfile.nginx as they use docker-compose declarations to discover which ports to map when publishing the application.
237
+
238
+
239
+
# Run the unit-tests with docker
240
+
## Introduction
170
241
The unit-tests are under `dojo/unittests`
171
242
172
243
173
244
174
-
####Running the unit-tests
245
+
## Running the unit-tests
175
246
This will run all the tests and leave the uwsgi container up:
176
247
177
248
```
@@ -182,7 +253,7 @@ docker-compose up
182
253
Enter the container to run more tests:
183
254
184
255
```
185
-
docker exec -it django-defectdojo_uwsgi_1 bash
256
+
docker-compose exec uwsgi bash
186
257
```
187
258
Rerun all the tests:
188
259
@@ -202,7 +273,7 @@ Run a single test. Example:
202
273
python manage.py test dojo.unittests.test_dependency_check_parser.TestDependencyCheckParser.test_parse_without_file_has_no_findings --keepdb
203
274
```
204
275
205
-
##Checking Docker versions
276
+
# Checking Docker versions
206
277
207
278
Run the following to determine the versions for docker and docker-compose:
0 commit comments