* devel: update composer config Update some of the config for the docker-compose file since there have been a few changes and the config is slightly out of date. Additionally, a refresh_token parameter was added to the oauth_url since this is used by composer's mock openid provider to generate the `rh-id-org` key in the jwt token. * distribution: update frontend entrypoint Update the command for spinning up the frontend to match the new script command. * devel: remove offline token Remove the offline token and replace with a client secret instead. * devel: add metrics profile Only launch the metrics containers when explictly requested. This helps decrease the logging output when the metrics are not required. The metrics can be called with `docker-compose --profile metrics up`
79 lines
2.4 KiB
Markdown
79 lines
2.4 KiB
Markdown
# devtools
|
|
|
|
Development Tools for Image Builder
|
|
|
|
## Setup
|
|
|
|
To start local development, first clone the image builder stack:
|
|
|
|
```bash
|
|
git clone git@github.com:osbuild/osbuild.git
|
|
git clone git@github.com:osbuild/osbuild-composer.git
|
|
git clone git@github.com:osbuild/image-builder.git
|
|
git clone git@github.com:osbuild/image-builder-frontend.git
|
|
```
|
|
|
|
The folder structure should look like:
|
|
|
|
```
|
|
.
|
|
├── image-builder
|
|
├── image-builder-frontend
|
|
├── osbuild
|
|
└── osbuild-composer
|
|
```
|
|
Secondly redirect a few domains to localhost. One for each environment
|
|
of cloud.redhat.com that exists. You only need the ones you will be
|
|
developing against. If you are outside the Red Hat VPN, only `prod` is
|
|
available:
|
|
|
|
```bash
|
|
echo "127.0.0.1 prod.foo.redhat.com" >> /etc/hosts
|
|
echo "127.0.0.1 qa.foo.redhat.com" >> /etc/hosts
|
|
echo "127.0.0.1 ci.foo.redhat.com" >> /etc/hosts
|
|
echo "127.0.0.1 stage.foo.redhat.com" >> /etc/hosts
|
|
```
|
|
|
|
Lastly run the setup tool from image-builder-frontend to generate TLS certs
|
|
and extract the Grafana dashboards from the image-builder and osbuild-composer
|
|
repos.
|
|
|
|
```bash
|
|
cd image-builder-frontend/devel
|
|
./setup.sh
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
For the Image Builder backend to upload successfully, you need to set some environment variables. For AWS, for example, set the following environment variables in the `.env` file:
|
|
|
|
```
|
|
OSBUILD_AWS_REGION
|
|
OSBUILD_AWS_ACCESS_KEY_ID
|
|
OSBUILD_AWS_SECRET_ACCESS_KEY
|
|
OSBUILD_AWS_S3_BUCKET
|
|
```
|
|
|
|
And then add to the list of environment variables for the backend container in the `docker-compose.yml` file.
|
|
|
|
The config variables for the Image Builder backend can be found [here](https://github.com/osbuild/image-builder/blob/main/internal/config/config.go).
|
|
|
|
## Run
|
|
|
|
```bash
|
|
docker-compose up --build
|
|
```
|
|
|
|
Access the service through the GUI:
|
|
[https://prod.foo.redhat.com:1337/beta/insights/image-builder](https://prod.foo.redhat.com:1337/beta/insights/image-builder), or
|
|
directly through the API:
|
|
[https://prod.foo.redhat.com:1337/docs/api/image-builder](https://prod.foo.redhat.com:1337/docs/api/image-builder).
|
|
|
|
The metrics containers are only launched when explicitly required. The command for this is below:
|
|
|
|
```bash
|
|
docker-compose --profile metrics up
|
|
```
|
|
|
|
Access the Grafana dashboard on [https://localhost:3000](https://localhost:3000). The default username is `admin` and the password is set to `foobar`.
|
|
The prometheus instance can be accessed on [https://localhost:9000](https://localhost:9000)
|