Skip to content
Snippets Groups Projects
README.md 2.46 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 contain utility functions
nguyed99's avatar
nguyed99 committed
- `tasks`: a task can be composed of many jobs
nguyed99's avatar
nguyed99 committed

## Getting started with development tools
nguyed99's avatar
nguyed99 committed

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

[docker](https://docs.docker.com/) is used in this project to build, share, and run container applications. Ensure you've it!
nguyed99's avatar
nguyed99 committed

#### Do this once
1. Install [python](https://www.python.org/downloads/) (version 3.11.5)
2. Install [poetry](https://python-poetry.org/docs/#installation) (version 1.7.1)
3. Install [docker](https://docs.docker.com/engine/install/). If you want to run docker as non-root user then you need to add it to the docker group (see [documentation](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user)).
nguyed99's avatar
nguyed99 committed
4. From the root directory of this repo, run
 
        make init
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
#### Do this happily ever after
nguyed99's avatar
nguyed99 committed
1. Start a (new) shell and activate the virtual environment
nguyed99's avatar
nguyed99 committed

        poetry shell
        
nguyed99's avatar
nguyed99 committed
2. We are storing Docker images at GitLab's integrated container registry by running:

        docker login git.imp.fu-berlin.de:5000 -u <GITLAB_USERNAME> -p <TOKEN> 
nguyed99's avatar
nguyed99 committed
*Some Project Access Tokens are available and will be provided to members.*
nguyed99's avatar
nguyed99 committed

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

nguyed99's avatar
nguyed99 committed
Jobs and tasks are run inside of docker containers. There is a docker build script (`Dockerfile`) and can be run in `dev` mode via `docker run`. Please be aware it can take a while to build the initial image. At root directory, to build the image run:
nguyed99's avatar
nguyed99 committed
    bash build/build-image.sh
nguyed99's avatar
nguyed99 committed
The image is built now and ready to be used! The tests in the Docker container built from the image can be sanity-checked via :
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    docker run -it --rm git.imp.fu-berlin.de:5000/comp-sci-project/jobs-n-tasks:local python jobs/tests/test_a_job.py
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
or for testing a task:
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    docker run -it --rm git.imp.fu-berlin.de:5000/comp-sci-project/jobs-n-tasks:local python tasks/tests/test_a_task.py
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
For live experience (meaning you enter the container), run:
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
    docker run -it --rm git.imp.fu-berlin.de:5000/comp-sci-project/jobs-n-tasks:local /bin/bash
nguyed99's avatar
nguyed99 committed

nguyed99's avatar
nguyed99 committed
If you change code in `src`, you need to rebuild the image with `bash build/build_image_local.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
*Free and open-source software for all souls! Technical support is, unfortunately, only for group members.*