Skip to content
Snippets Groups Projects
README.md 1.97 KiB
Newer Older
nguyed99's avatar
nguyed99 committed
## Repository structure
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
All folders are isolated projects. `cd` into the folder to run/build them.
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
- `jobs`: jobs to be built as docker images (`build/build_image.sh` in each job)
- `tasks`: a task can be composed of many jobs
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
## Getting Started
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
[poetry](https://python-poetry.org/docs/) is used as package manager. Ensure you've it! Also please have Python 3.11 installed.
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
#### Do this once
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    curl -sSL https://install.python-poetry.org | python3 -
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
To get started you need Poetry's bin directory (~/.local/bin) in your `PATH` environment variable. Add `export PATH="~/.local/bin:$PATH"` to your shell configuration file.
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    make init
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
#### Do this happily ever after
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    poetry shell
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
We are storing Docker images at GitLab's integrated container registry. Make sure Docker is aware of your GitLab token. If you do not have one, make one [here](https://docs.gitlab.com/ee/security/token_overview.html) (with scope `read_registry` and `write_registry`). Then enter:
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    docker login registry.example.com -u <username> -p <token>
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
## Local development
### jobs
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
Jobs are run inside of docker containers. Each job has a docker build script and can be run in `dev` mode via `docker run`. Please be aware it can take a while to build the initial image.
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    cd jobs/a-job
    build/build_image.sh
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
The image is built now and ready to be used by tasks. This image can be sanity-checked via (test implementation without minio-s3-parameter transport):
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    docker run -it --rm registry.example.com/group/project/image:local unit-test
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
If you change code in `src`, you need to rebuild the image with `build/build_image.sh`. The `src` folder can also be mounted in the image, but the assumption is that life is already difficult as it is...
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
### tasks
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
Tasks are python scripts that can spawn jobs which run in docker containers. Before calling a task, make sure you have built the related job-image. 
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    python -B src/a-task.py local --config=docker.yaml --IN0 demo-inputs/system.json --OUT /tmp/test-a-task