MISP/docker
Luciano Righetti ca58366491 new: [wip] migrate taxonomies to 3.x 2023-12-13 15:37:43 +01:00
..
misp new: [wip] migrate taxonomies to 3.x 2023-12-13 15:37:43 +01:00
nginx chg: increase timeout 2023-11-08 15:17:25 +01:00
.env.dev.dist add: configure gnupg, add gnupg tests 2023-10-10 10:54:23 +02:00
.env.dist add: configure gnupg, add gnupg tests 2023-10-10 10:54:23 +02:00
.env.test fix: change passphrase, always export public key if store is re-created 2023-10-11 16:13:58 +02:00
.gitignore chg: remove branch from actions 2023-05-10 08:31:42 +02:00
README.md chg: [docker:readme] Fixed typo 2023-11-27 13:59:53 +01:00

README.md

Docker

The Dockerfiles have a multi-stage build to help serve both a dev and prod image for all of the services required for running MISP.

The dev image includes additional packages for debugging, test suites and volume mappings to help the developer directly modify the files in the host machine and automatically reflect this changes in the container environment.

The prod image has the minimum required packages to safely run MISP on a production enviroment. It fetches the code from github from a given tag or branch name instead of using a local copy of the codebase.

Development environment

  1. Create a copy of ./docker/.env.dev.dist, update the variables values only if you need so and know what your are doing.
    cp ./docker/.env.dev.dist ./docker/.env.dev
    
  2. Build the dev images:
    docker-compose -f docker-compose.yml -f docker-compose.dev.yml --env-file="./docker/.env.dev" build
    
  3. Run the application in dev mode:
    docker-compose -f docker-compose.yml -f docker-compose.dev.yml --env-file="./docker/.env.dev" up
    

Debugging

For debugging the PHP code with XDebug and VSCODE use the following configuration file: launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "pathMappings": {
                "/var/www/html": "${workspaceRoot}",
            },
        },
    ]
}

NOTE: Add XDEBUG_SESSION_START query parameter or XDEBUG_SESION=VSCODE cookie to debug your requests.

Troubleshooting

Logs

You can find the MISP logs in the ./docker/logs directory.

Interactive shell

If you need a shell into the MISP container, run:

docker-compose -f docker-compose.yml -f docker-compose.dev.yml --env-file="./docker/.env.dev" exec --user www-data misp bash

Permission denied

If you have permissions errors when trying to edit files from your host machine:

  1. Verify your UID and GID:
$ id
uid=1000(myuser) gid=1000(myuser) groups=1000(myuser)...
  1. Update your .env.dev file with the correct a UID and GID.
  2. Rebuild your misp service:
docker-compose -f docker-compose.yml -f docker-compose.dev.yml --env-file="./docker/.env.dev" build misp

Testing

docker-compose -f docker-compose.yml -f docker-compose.test.yml --env-file="./docker/.env.test" build
docker-compose -f docker-compose.yml -f docker-compose.test.yml --env-file="./docker/.env.test" up -d
docker-compose --env-file="./docker/.env.test" exec --user www-data misp vendor/bin/phpunit

Production

  1. Create a copy of ./docker/.env.dist, update the variables values with your production values and secrets.
    cp ./docker/.env.dist ./docker.env
    
  2. Build the prod images:
    docker-compose --env-file="./docker/.env" build
    
  3. Run the application in prod mode:
    docker-compose --env-file="./docker/.env" up -d