Skip to content

Commit 6d4cc0f

Browse files
committed
Dev version of compose, mysql volume and utf8mb4 support
1 parent 87650f8 commit 6d4cc0f

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

DOCKER.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ If you ran DefectDojo with compose before and you want to prevent the
2424
initializer container from running again, define an environment variable
2525
DD_INITIALIZE=false to prevent re-initialization.
2626

27+
### Develop with Docker Compose
28+
29+
For developing the easiset way to make changes is to startup DefectDojo in debug by running `docker-compose -f docker-compose.yml up`. This starts the DefectDojo (uwsgi) container with manage.py and shares the local source directory so that changes to the code immediately restart the process.
30+
31+
Navigate to the container directly, <http://localhost:8000>
32+
33+
The initializer container can be disabled by exporting: `export DD_INITIALIZE=false`
34+
2735
### Build Images Locally
2836

2937
Build the docker containers locally for testing purposes.
@@ -36,6 +44,14 @@ docker build -t defectdojo/defectdojo-nginx -f Dockerfile.nginx .
3644

3745
### Clean up Docker Compose
3846

47+
Removes all containers
48+
49+
```zsh
50+
docker-compose down
51+
```
52+
53+
Removes all containers, networks and the database volume
54+
3955
```zsh
4056
docker-compose down --volumes
4157
```

docker-compose.override.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
version: '3.7'
3+
services:
4+
uwsgi:
5+
image: defectdojo/defectdojo-django:latest
6+
depends_on:
7+
- mysql
8+
entrypoint: ['/wait-for-it.sh', 'mysql:3306', '-t', '30', '--', '/entrypoint-uwsgi.sh']
9+
environment:
10+
DD_DEBUG: 'on'
11+
DD_ALLOWED_HOSTS: ${DD_ALLOWED_HOSTS:-*}
12+
DD_DATABASE_URL: ${DD_DATABASE_URL:-mysql://defectdojo:defectdojo@mysql:3306/defectdojo}
13+
DD_CELERY_BROKER_USER: ${DD_CELERY_BROKER_USER:-guest}
14+
DD_CELERY_BROKER_PASSWORD: ${DD_CELERY_BROKER_USER:-guest}

docker-compose.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@ services:
1111
protocol: tcp
1212
mode: host
1313
uwsgi:
14-
image: defectdojo/defectdojo-django:latest
14+
build:
15+
context: ./
16+
dockerfile: Dockerfile.django
1517
depends_on:
1618
- mysql
17-
entrypoint: ['/wait-for-it.sh', 'mysql:3306', '-t', '30', '--', '/entrypoint-uwsgi.sh']
19+
entrypoint: ['/wait-for-it.sh', 'mysql:3306', '-t', '30', '--', 'python', 'manage.py', 'runserver 0.0.0.0:8000']
20+
volumes:
21+
- '.:/app'
22+
ports:
23+
- 8000:8000
1824
environment:
1925
DD_DEBUG: 'on'
2026
DD_ALLOWED_HOSTS: ${DD_ALLOWED_HOSTS:-*}
@@ -52,13 +58,19 @@ services:
5258
DD_ADMIN_MAIL: ${DD_ADMIN_USER:[email protected]}
5359
DD_ADMIN_FIRST_NAME: ${DD_ADMIN_FIRST_NAME:-Admin}
5460
DD_ADMIN_LAST_NAME: ${DD_ADMIN_LAST_NAME:-User}
61+
DD_INITIALIZE: ${DD_INITIALIZE:-true}
5562
mysql:
5663
image: mysql:5.7
64+
volumes:
65+
- defectdojo_data:/var/lib/mysql
5766
environment:
5867
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
5968
DD_DATABASE_URL: ${DD_DATABASE_URL:-mysql://defectdojo:defectdojo@mysql:3306/defectdojo}
6069
MYSQL_USER: ${DD_DATABASE_USER:-defectdojo}
6170
MYSQL_PASSWORD: ${DD_DATABASE_PASSWORD:-defectdojo}
6271
MYSQL_DATABASE: ${DD_DATABASE_NAME:-defectdojo}
72+
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
6373
rabbitmq:
6474
image: rabbitmq:3.7
75+
volumes:
76+
defectdojo_data: {}

0 commit comments

Comments
 (0)