Django-based core of ADCM: API, Ansible plugins, container init and task runner components.
Other dev docs:
docs/ARCHITECTURE.md- how the project is structured and organizeddocs/CODESTYLE.md- conventions to follow when writing codedocs/NOTES.md- commentary on non-obvious feature implementations
ADCM is shipped as container and dev pipelines rely on Makefile.
So based on your task:
- prepare environment / your code for push -
make prettythenmake lint - run tests -
make unittests - validate end-to-end behavior - build image & run container
Actions described above are up to date and reliable, but some tasks require more control. General approach here is to do these steps (in order until problem is solved):
- Read docs in this project (mostly answers generic questions, navigate to problem)
- Read sources:
- startup script for steps required for setup (
startup.shor seeDockerfileentrypoint) Makefileto know how linters/tests are launched with what configuration and so onpyproject.tomlcontains information about environment, optional dependency groups and linter settings
- startup script for steps required for setup (
- Read official user documentation
- Ask other developers for insight
- Create branch with task ID in name (like
ADCM-4952orbug/ADCM-3910, etc.) - Prepare/sync environment
(easiest is to run
make prettyto install all major dependencies; otherwise, you can run installation parts from this command) - Write code and tests following codestyle and architecture
- Ensure
make prettyandmake lintpass - (optional) Run tests with
make unittests - Push to remote branch
In all cases you'll need running PostgreSQL: you can connect to existing local/remote instance or run one in container (e.g. how it's done in make unittests).
Passing code to existing image allows you to skip rebuilding image, but will still require container restart OR restarting services inside container on code change. In other ways it's the closest to what final result will look like.
Running Django server will require some preparations.
Exact commands should be found in entrypoint (with adjustment of local launch and file structure),
but general steps are:
- Prepare secrets file (
application/scripts/manage_secrets.py init) - Apply database migrations (
manage.py migrate) - Prepare various system records (
init_db.py) - Upgrade roles (
manage.py upgraderole) - Run server (
manage.py runserver)
Don't forget to set up environment variables for DB connection.
Also you may need to specify settings module for Django.
Data directory management is also important since files from previous launches may conflict with the new ones (mostly bundles, maybe files in run subdir).
Running other entrypoints (scheduler, celery worker, task runner, ansible plugins) is trickier, but generally will require same steps as for running API server and some extra environment (like filled database, ansible execution environment, etc.).
Do that only if other approaches failed to meet your task.