Skip to content

[hma] Docker deployment improvements #1830

@ThisIsMissEm

Description

@ThisIsMissEm

This may be a documentation issue, or perhaps it's just how the containers are built, but when trying to work with HMA using the container image, I found that I was having problems with the bash executing things part. I wasn't using the docker-compose file, as I already had postgresql running within docker, and wanted to connect to that.

I ended up with something like:

docker run --net development_default -p 5001:5000 -e OMM_DATABASE_URI="postgresql://postgres:@postgresql/hma_media_match" -e OMM_CONFIG="/build/reference_omm_configs/development_omm_config.py" -e OMM_SQLALCHEMY_ENGINE_LOG_LEVEL="DEBUG" -it ghcr.io/facebook/threatexchange/hma:latest '/bin/bash -c "MIGRATION_COMMAND=0 OMM_CONFIG=/build/reference_omm_configs/development_omm_config.py flask --app OpenMediaMatch.app run --host=0.0.0.0 --debug"'

Which felt rather complex. I also needed to run with migrations 0 instead of 1 after the initial migration for some reason (but I can't recall why)

I think the dockerfile can definitely be improved and use a script to do multiple things on startup, for example, bluesky's ozone uses a small node.js script as it's command in its dockerfile

So we could probably do something similar for HMA. Usually you want to use dumb-init or tini or something similar as PID 0 inside docker containers too.

Perhaps it'd also be worth having a python tool that could be a wizard to generate the configuration required?

Metadata

Metadata

Assignees

No one assigned

    Labels

    hmaItems related to the hasher-matcher-actioner system

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions