Commit graph

2132 commits

Author SHA1 Message Date
Julian Brost
d337826415 Containerfile: allow running the binary without absolute path
This sets the PATH environment variable so that the binary installed to the
container image can be found by just its name. This makes it nicer to manually
provide a command by the container, so for example, now "docker run --rm -it
icinga/icingadb:dev icingadb --version" works. The binary is still installed
under the same path, so it can still be invoked using the same absolute path as
before.
2025-04-02 11:22:15 +02:00
Eric Lippmann
5d43cb20d9
Merge pull request #917 from Icinga/dependabot/go_modules/github.com/mattn/go-sqlite3-1.14.25
build(deps): bump github.com/mattn/go-sqlite3 from 1.14.24 to 1.14.25
2025-04-01 17:11:12 +02:00
dependabot[bot]
8dc8fc496f
build(deps): bump github.com/mattn/go-sqlite3 from 1.14.24 to 1.14.25
Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.24 to 1.14.25.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](https://github.com/mattn/go-sqlite3/compare/v1.14.24...v1.14.25)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-01 16:48:32 +02:00
Eric Lippmann
dea6b57fa9
Merge pull request #916 from Icinga/dont-push-attestations-to-image-registries
`container-image` workflow: Don't push attestations to image registries
2025-04-01 11:26:29 +02:00
Eric Lippmann
b6167ab609
Merge pull request #915 from Icinga/container-image-tag-latest-only-on-release
`container-image` workflow: Tag `latest` only on release
2025-04-01 10:39:58 +02:00
Eric Lippmann
4de9259009 container-image workflow: Don't push attestations to image registries
Without further investigation, this only seems to push the image with the
digest as a tag, which only pollutes the registry.
2025-04-01 09:47:21 +02:00
Eric Lippmann
f1dafb6e86 container-image workflow: Tag latest only on release 2025-04-01 09:37:10 +02:00
Eric Lippmann
fdc20ac0db
Merge pull request #914 from Icinga/Al2Klimov-patch-4
Containerfile: order layers by how likely they change over time
2025-04-01 09:25:44 +02:00
Eric Lippmann
a7144ff5b2
Merge pull request #885 from Icinga/icingadb-migrate-sql-explicit-as-i884
icingadb-migrate: Explicit AS in SELECT
2025-03-31 16:31:30 +02:00
Eric Lippmann
15d4ac421e
Merge pull request #912 from Icinga/containerfile
Create and publish container images from this repository
2025-03-31 16:31:10 +02:00
Alexander Aleksandrovič Klimov
ad18f9fd5b
Containerfile: order layers by how likely they change over time
This caches more layers users don't have to download.
2025-03-31 15:08:31 +02:00
Alvar Penning
8ea9d01aa1 Containerfile: Fix vcs info not stamped when listing .go files directly
See https://github.com/golang/go/issues/51279 for reference.

Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
2025-03-31 13:58:26 +02:00
Alvar Penning
aee2d315ba Containerfile: Add and auto-import database schema
Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
2025-03-31 13:58:26 +02:00
Eric Lippmann
0647813c65 GitHub Actions: Add container-image workflow
This workflow builds and publishes container images directly from this
repository. Here is a summary of its initial setup for reference:

The Build and Publish Container Image workflow builds container images and
pushes them to both GitHub Container Registry (GHCR) and Docker Hub. It sets up
QEMU and Docker Buildx for cross-platform builds, and builds the container
images using the Containerfile. Upon pushes to the main branch or when releases
are published, it logs into GHCR and Docker Hub using credentials from GitHub
secrets, tags and pushes the images to both registries, and generates and
pushes signed build provenance attestations to each registry. The workflow also
triggers for pull requests to the main branch, verifying only the image build.
2025-03-31 13:58:26 +02:00
Eric Lippmann
7abdec86ad GitHub Actions: Remove docker workflow
The workflow using https://github.com/Icinga/docker-icingadb for building and
publishing container images is now obsolete. We will replace it with a new
workflow that builds and pushes container images directly from this repository.
2025-03-31 13:58:26 +02:00
Eric Lippmann
e0f20bfa0e Add Containerfile
Previously, we used https://github.com/Icinga/docker-icingadb to build and push
container images because Icinga DB did not support features necessary for
containerization, such as automatic schema import and configuration via
environment variables. These were handled by a specific entrypoint in that
repository. Now that these features are implemented directly in Icinga DB, the
repository is no longer needed, and container images can be built and pushed
directly from this repository.
2025-03-31 13:58:26 +02:00
Eric Lippmann
6cbab3f23f
Merge pull request #901 from Icinga/auto-schema-import
Auto Import Database Schema
2025-03-31 09:26:33 +02:00
Alvar Penning
48d4305e92
Auto Import Database Schema
To get rid of docker-icingadb and its additional entry point, the schema
import functionality has been implemented directly in Icinga DB. Using
the new --database-auto-import command line argument will result in an
automatic schema import if no schema is found.

The implementation is split between the already existing CheckSchema
function and the introduced ImportSchema function.

The CheckSchema function is now able to distinguish between the absence
of a schema and an incorrect schema version. Both situations return a
separate error type.

As before, CheckSchema is called in the main function. If the error type
now implies the absence of a schema (ErrSchemaNotExists) and the
--database-auto-import flag is set, the auto-import is started.

The schema import itself is performed in the new ImportSchema function,
which loads the schema from a given file and inserts it within a
transaction, allowing to rollback in case of an error.

Fixes #896.
2025-03-28 10:39:16 +01:00
Alvar
eb0b947e3f
Merge pull request #909 from Icinga/dependabot/go_modules/github.com/icinga/icinga-go-library-0.6.2
build(deps): bump github.com/icinga/icinga-go-library from 0.6.1 to 0.6.2
2025-03-27 07:32:09 +00:00
dependabot[bot]
d73552cbb3
build(deps): bump github.com/icinga/icinga-go-library
Bumps [github.com/icinga/icinga-go-library](https://github.com/icinga/icinga-go-library) from 0.6.1 to 0.6.2.
- [Commits](https://github.com/icinga/icinga-go-library/compare/v0.6.1...v0.6.2)

---
updated-dependencies:
- dependency-name: github.com/icinga/icinga-go-library
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-26 18:36:17 +00:00
Eric Lippmann
d0ef6cf84b
Merge pull request #897 from Icinga/docs-03-configuration-env-support
doc/03-Configuration.md: Environment Variables
2025-03-26 13:22:09 +01:00
Eric Lippmann
1ca18cfdce
Merge pull request #831 from Icinga/config-from-environment-variables
Support loading configuration from both YAML files and env vars
2025-03-26 13:21:58 +01:00
Alvar
412a460c17
Merge pull request #908 from Icinga/dependabot/github_actions/golangci/golangci-lint-action-7
build(deps): bump golangci/golangci-lint-action from 6 to 7
2025-03-25 06:54:28 +00:00
dependabot[bot]
d224f8b74f
build(deps): bump golangci/golangci-lint-action from 6 to 7
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 6 to 7.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 18:36:43 +00:00
Alvar
38866bd285
Merge pull request #907 from Icinga/dependabot/go_modules/tests/github.com/go-sql-driver/mysql-1.9.1
build(deps): bump github.com/go-sql-driver/mysql from 1.9.0 to 1.9.1 in /tests
2025-03-21 11:34:39 +00:00
Alvar
c584fa9969
Merge pull request #906 from Icinga/dependabot/go_modules/github.com/icinga/icinga-go-library-0.6.1
build(deps): bump github.com/icinga/icinga-go-library from 0.5.0 to 0.6.1
2025-03-21 11:34:30 +00:00
Alvar
7a38fab5ea
Merge pull request #905 from Icinga/dependabot/go_modules/github.com/redis/go-redis/v9-9.7.3
build(deps): bump github.com/redis/go-redis/v9 from 9.7.0 to 9.7.3
2025-03-21 11:34:01 +00:00
Alvar
276cd9d41b
Merge pull request #904 from Icinga/dependabot/go_modules/tests/github.com/redis/go-redis/v9-9.7.3
build(deps): bump github.com/redis/go-redis/v9 from 9.7.1 to 9.7.3 in /tests
2025-03-21 11:33:49 +00:00
Alvar
68cbb66aec
Merge pull request #902 from Icinga/dependabot/go_modules/tests/golang.org/x/net-0.36.0
build(deps): bump golang.org/x/net from 0.26.0 to 0.36.0 in /tests
2025-03-21 11:33:41 +00:00
dependabot[bot]
90fbbde6d9
build(deps): bump github.com/go-sql-driver/mysql in /tests
Bumps [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/go-sql-driver/mysql/releases)
- [Changelog](https://github.com/go-sql-driver/mysql/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-sql-driver/mysql/compare/v1.9.0...v1.9.1)

---
updated-dependencies:
- dependency-name: github.com/go-sql-driver/mysql
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-21 10:39:26 +00:00
dependabot[bot]
84c9f1cb7e
build(deps): bump github.com/icinga/icinga-go-library
Bumps [github.com/icinga/icinga-go-library](https://github.com/icinga/icinga-go-library) from 0.5.0 to 0.6.1.
- [Commits](https://github.com/icinga/icinga-go-library/compare/v0.5.0...v0.6.1)

---
updated-dependencies:
- dependency-name: github.com/icinga/icinga-go-library
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-21 10:35:09 +00:00
dependabot[bot]
e33012bbe0
build(deps): bump github.com/redis/go-redis/v9 from 9.7.0 to 9.7.3
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.7.0 to 9.7.3.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.7.0...v9.7.3)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-20 18:53:38 +00:00
dependabot[bot]
2d03d1cb18
build(deps): bump github.com/redis/go-redis/v9 in /tests
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.7.1 to 9.7.3.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.7.1...v9.7.3)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-20 18:46:32 +00:00
Alvar Penning
701983add5
doc/03-Configuration.md: Environment Variables
New ways to configure Icinga DB were introduced in [icingadb-831] and
[igl-113]. The first change allows configuring Icinga DB using
environment variables instead of or next to the YAML configuration file.
In addition, the second change allows setting certificates and keys as
PEM-encoded strings next to referencing files. This was now documented.

As a structural change, the order of the Database and Redis sections
were changed to reflect the order in the example configuration file.

Some words about the Logging Components were written, as the
documentation previously that they exist.

[icingadb-831]: https://github.com/Icinga/icingadb/pull/831
[igl-113]: https://github.com/Icinga/icinga-go-library/pull/113
2025-03-17 12:33:13 +01:00
Eric Lippmann
d9fdf99376 Test loading logging and retention options from YAML and env 2025-03-17 09:41:46 +01:00
Alvar Penning
fe94784511 history: YAML Decoding For RetentionOptions
For YAML decoding, the yaml.InterfaceUnmarshaler interface needs to be
implemented. To not mix value and pointer receiving methods for
RetentionOptions, the signature of Validate was updated.

It is important to set the internally type to map[string]uint16 instead
of RetentionOptions, as otherwise the method would be called in an
endless loop until the stack is full.
2025-03-17 09:32:01 +01:00
Eric Lippmann
c3f9b4a854 Support loading config#RetentionConfig from environment variables 2025-03-17 09:32:01 +01:00
Eric Lippmann
1369a674ab Adjust config tests to reflect loading from YAML, env and both 2025-03-17 09:32:01 +01:00
Eric Lippmann
a8856c40f3 Use config#Load from our library 2025-03-17 09:32:01 +01:00
Eric Lippmann
8c77756c79 Support loading configuration from both YAML files and env vars 2025-03-17 09:32:01 +01:00
dependabot[bot]
583f42408f
build(deps): bump golang.org/x/net from 0.26.0 to 0.36.0 in /tests
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.26.0 to 0.36.0.
- [Commits](https://github.com/golang/net/compare/v0.26.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-13 00:58:15 +00:00
dependabot[bot]
e72762a29e
build(deps): bump golang.org/x/sync from 0.11.0 to 0.12.0 in /tests (#898)
* build(deps): bump golang.org/x/sync from 0.11.0 to 0.12.0 in /tests

Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.11.0 to 0.12.0.
- [Commits](https://github.com/golang/sync/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump go.mod's go version

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alvar Penning <alvar.penning@icinga.com>
2025-03-06 09:22:57 +00:00
dependabot[bot]
45461f9de3
build(deps): bump golang.org/x/sync from 0.11.0 to 0.12.0 (#899)
* build(deps): bump golang.org/x/sync from 0.11.0 to 0.12.0

Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.11.0 to 0.12.0.
- [Commits](https://github.com/golang/sync/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump go.mod's go version

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alvar Penning <alvar.penning@icinga.com>
2025-03-06 08:59:03 +00:00
Alvar Penning
f94a65f459
icingadb-migrate: Explicit AS in SELECT
By introducing an explicit "AS" to set output names in the SELECT column
list, there are no issues with reserved names. Unfortunately, this
happened on PostgreSQL in the older version 13 with the reserved name
"name". Adding "AS" mitigates this issue.

Furthermore, I have put each column name in its own line for the SELECT
queries to ease the readability of the query itself and of future diffs.

Fixes #884.
2025-03-05 14:02:01 +01:00
alvar
635e43c220
Merge pull request #892 from Icinga/dependabot/go_modules/github.com/google/go-cmp-0.7.0
build(deps): bump github.com/google/go-cmp from 0.6.0 to 0.7.0
2025-03-05 08:00:44 +00:00
alvar
fb79efcada
Merge pull request #891 from Icinga/dependabot/go_modules/tests/github.com/redis/go-redis/v9-9.7.1
build(deps): bump github.com/redis/go-redis/v9 from 9.7.0 to 9.7.1 in /tests
2025-03-05 08:00:35 +00:00
alvar
9421d96631
Merge pull request #890 from Icinga/dependabot/go_modules/tests/github.com/go-sql-driver/mysql-1.9.0
build(deps): bump github.com/go-sql-driver/mysql from 1.8.1 to 1.9.0 in /tests
2025-03-05 08:00:26 +00:00
dependabot[bot]
5fcc71f9b6
build(deps): bump github.com/google/go-cmp from 0.6.0 to 0.7.0
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-24 18:41:30 +00:00
dependabot[bot]
0973ea8a8d
build(deps): bump github.com/redis/go-redis/v9 in /tests
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.7.0 to 9.7.1.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.7.0...v9.7.1)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-21 19:05:16 +00:00
dependabot[bot]
f6290cb339
build(deps): bump github.com/go-sql-driver/mysql in /tests
Bumps [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) from 1.8.1 to 1.9.0.
- [Release notes](https://github.com/go-sql-driver/mysql/releases)
- [Changelog](https://github.com/go-sql-driver/mysql/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-sql-driver/mysql/compare/v1.8.1...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/go-sql-driver/mysql
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-18 18:35:38 +00:00