Set up docker with dispatcherd for local development#18
Conversation
19a6fc5 to
ad9b029
Compare
|
Hi @abikouo, I couldn't get the migrate command to work with manage.py inside src/pattern_service/. I tested moving manage.py to the src/ directory and adjusting its references, which fixed all the builds (docker build and docker compose) and migration. Is there a step I'm overlooking, or should manage.py be located in the src/ directory? |
hakbailey
left a comment
There was a problem hiding this comment.
In addition to the inline comments, I would suggest we remove the following from this PR:
- Movement of code to the
srcdirectory. There are ongoing conversations org-wide about how we want to standardize platform service repository structure; let's hold off on making big changes in this regard until we know what those decisions are. - Dependency management with Poetry. This isn't standard for platform services either; let's stick with pyproject.toml for now.
- Bash files to run tests and mypy, this shouldn't be necessary.
- Addition of copyright statements to individual files. We may want to do this; however I would suggest we do it in a single PR to all existing files because adding it in this PR to only some files is introducing inconsistency across the repo. I would also like to verify what the org-wide guideline is for this.
| @@ -0,0 +1,51 @@ | |||
| # Docker Compose for Development | |||
There was a problem hiding this comment.
There is a push to move towards podman over docker within Red Hat generally; let's try to refer either to podman or just containers generally instead of specifying docker.
|
@hakbailey I have updated the PR based on what you did on #25. #25 has to be merged first. |
|
|
||
| ENV PATTERN_SERVICE_MODE=development | ||
|
|
||
| RUN python3.11 manage.py migrate |
There was a problem hiding this comment.
I suggest you run the migration when the container starts because this adds a read-only layer.
There was a problem hiding this comment.
I was able to create a read-write file for the db, what is the error on your side?
There was a problem hiding this comment.
I wasn't able to add anything else to the db because the migration was run in a read only layer. When creating a pattern I was getting something like "read-only database".
There was a problem hiding this comment.
django.db.utils.OperationalError: attempt to write a readonly database
|
d3a5a50 to
4be3cad
Compare
hakbailey
left a comment
There was a problem hiding this comment.
It would be good to have the test endpoint submit a task to the dispatcher worker so we can verify this functionality; something simple like this would be fine.
I think it would also be valuable to update the logging section of the development settings to include dispatcherd DEBUG logs.
| @@ -0,0 +1,84 @@ | |||
| x-environment: &common-env | |||
| PATTERN_SERVICE_DB_HOST: postgres | |||
There was a problem hiding this comment.
Are these env variables used for anything?
There was a problem hiding this comment.
These environment variables will be part of the settings without the PATTERN_SERVICE prefix. They are used to configure the DB.
| image: localhost/ansible-pattern-service-worker | ||
| environment: | ||
| << : *common-env | ||
| PATTERN_SERVICE_DISPATCHER_NODE_ID: pattern-service-worker |
There was a problem hiding this comment.
Does this env variable get used for anything?
There was a problem hiding this comment.
This is the node ID that will be set in the dispatcher config.
hakbailey
left a comment
There was a problem hiding this comment.
Looks good and works as expected!
beeankha
left a comment
There was a problem hiding this comment.
Tested locally, works as documented!

Refer to AAP-47113
Note: #25 has to be merged first