Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadMe and GitHub Actions #111

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build_docker_dependencies_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ on:
- 'v*'
paths:
- dockerfiles/microservices-dependencies.dockerfile

pull_request:
types: [closed]
branches:
- develop

workflow_dispatch:

jobs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
- 'v*'
paths:
- Dockerfile
pull_request:
types: [closed]
branches:
- develop

workflow_dispatch:

Expand Down
27 changes: 22 additions & 5 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,36 @@

To run one of the provided microservices in this repo, the basic command is the following:
```
docker run --rm -e MICROSERVICE=<name of microservice> ghcr.io/dune-daq/microservices:9685
docker run --rm -e MICROSERVICE=<name of microservice> ghcr.io/dune-daq/microservices:develop
```

There are a couple of points to note:
* The value of MICROSERVICE should be the name of a given microservice's subdirectory in this repo. As of Oct-6-2023, the available subdirectories are: `config-service`, `ers-dbwriter`, `ers-protobuf-dbwriter`, `logbook`, `opmon-dbwriter`, `runnumber-rest` and `runregistry-rest`.
* Most microservices require additional environment variables to be set, which can be passed using the usual docker syntax: `-e VARIABLE_NAME=<variable value>`
* If you don't know what these additional environment variables are, you can just run the `docker` command as above without setting them; the container will exit out almost immediately but only after telling you what variables are missing
* The `9685` tag for the image in the example above just refers to the first four characters of the git commit of the microservices repo whose `dockerfiles/Dockerfile.microservices` Docker file was used to create the image. Currently [Dec-08-2023] this is the head of a branch soon to be merged in develop with a PR.
* The microservices image tag will be `microservices:<name-of-branch>` or `microservices:<version-tag>`, i.e. `microservices:develop`.
* The microservices dependency image tag is `microservices_dependencies:<name-of-branch>` or `microservices_dependencies:<version-tag>`

For details on a given microservice, look at its own README file (format is `docs/README_<microservice name>.md`). They may or may not be up to date, however.

## building images
When building from a branch that is not develop you need to specify the branch you want to use to build the code, e.g.:
## Building images
There are two workflow actions on GitHub to build the `microservices` and `microservices_dependencies` images. This can be run on GitHub directly and will create the images, tag them and push them for use.

The `microservices_dependencies` image is used as the base image for `microservies` and so any changes to the `requirements.txt` file requires rebuilding the `microservices_dependencies` image.

If you do not wish to to push your changes to the repo when testing, you can also use:

```bash
docker build -f Dockerfile.microservices -t ghcr.io/dune-daq/microservices:user-my-branch --build-arg BRANCH=my-branch .
docker build -f Dockerfile -t ghcr.io/dune-daq/microservices:user-my-branch .

docker push ghcr.io/dune-daq/microservices:user-my-branch
```
and

```bash
docker build -f dockerfiles/microservices-dependencies.dockerfile -t ghcr.io/dune-daq/microservices_dependencies:user-my-branch /dockerfiles

docker push ghcr.io/dune-daq/microservices_dependencies:user-my-branch
```

This will copy your current microservices directory.
Loading