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

Issue 234 redis cache #235

Merged
merged 7 commits into from
Nov 28, 2023
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
46 changes: 40 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ the [`local-config.yaml`][config] can be used to set the variables.
| `GIT_COMMITTER_NAME` | | Name of the user used to create the Git commits. |
| `GIT_COMMITTER_EMAIL` | | E-Mail of the user used to create the Git commits. |
| | | |
| `KAFKA_USERNAME` | | Leave ALL of the following `KAFKA_` fields empty to skip the Kafka integration. |
| `KAFKA_PASSWORD` | | Leave ALL of the following `KAFKA_` fields empty to skip the Kafka integration. |
| `KAFKA_TOPIC` | | |
| `KAFKA_SEED_BROKERS` | | A comma separated list of Kafka brokers, e.g. first-kafka-broker.domain.com:9092,second-kafka-broker.domain.com:9092 |
| `KAFKA_TOPICS_CONFIG` | | A Json configuration for a Kafka Topic to publish updates to. Leave empty to skip the Kafka integration. See below for details and an example. |
| `KAFKA_GROUP_ID_OVERRIDE` | | Override the kafka group id for local development to avoid creating lots of consumer groups. If unset, derived from local IP address so each k8s pod gets their own group. |
| | | |
| `AUTH_OIDC_KEY_SET_URL` | | URL to the [OpenID Connect Keyset][openid] for validating JWTs. See [authentication](#authentication) for more details. |
Expand Down Expand Up @@ -90,6 +87,9 @@ the [`local-config.yaml`][config] can be used to set the variables.
| `REPOSITORY_KEY_SEPARATOR` | `.` | Single character used to separate repository name from repository type. repository name and repository type must not contain separator. |
| | | |
| `ALLOWED_FILE_CATEGORIES` | | List of allowed keys for the filecategory field in repositories. Parsed as a json array, example value: `["key1","key2"]`. All keys not in this list are rejected on writes, and silently dropped when reading. |
| | | |
| `REDIS_URL` | | Url to an optional Redis instance to use as a shared cache. Will use in-memory cache if left blank |
| `REDIS_PASSWORD` | | Password for the Redis instance. Can be read from Vault via `VAULT_SECRETS_CONFIG` |

## Datastore

Expand Down Expand Up @@ -187,6 +187,41 @@ _If you are a client subscribing to our Kafka update notifications, and you want
state following an update notification, you must compare the commit hash and timestamp to see if you got the
correct version. If not, wait a bit and try again, you landed on an instance that isn't consistent yet._

### Kafka configuration

If you wish to use a Kafka topic, set the environment variable `KAFKA_TOPICS_CONFIG` to a JSON document
as follows (displayed in prettyprinted form for readability):

```
{
"metadata-change-events": {
"topic": "metadata-change-events",
"brokers": [
"kafka-seed-broker1.example.com:9092",
"kafka-seed-broker2.example.com:9092"
],
"username": "<username used to connect>",
"passwordEnvVar": "METADATA_CHANGE_EVENTS_PASSWORD",
"authType": "PLAIN"
}
}
```

This assumes of course that the password is provided in the specified environment variable. On Localhost, you
can simply set "password" in the JSON.

AuthType sets the SASL authentication method, possible values are `PLAIN`, `SCRAM-SHA-256`, `SCRAM-SHA-512`.

Note: You can use the Vault integration configuration to read the password from Vault by including it in
`VAULT_SECRETS_CONFIG`, similar to:

```
[...]
"some/vault/path": [
{"vaultKey": "METADATA_CHANGE_EVENTS_PASSWORD"}
],
```

## architecture

![software architecture](docs/architecture-export.png)
Expand Down Expand Up @@ -241,8 +276,7 @@ Clear the test cache:
### Goland terminal configuration

Goland has the annoying habit of limiting line width on the output terminal to 80 characters no matter how wide the
window is.
You can fix this. Menu: Help -> Find Action... -> search for "Registry"
window is. You can fix this. Menu: Help -> Find Action... -> search for "Registry"

Uncheck `go.run.processes.with.pty`.

Expand Down
28 changes: 24 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Interhyp/metadata-service

go 1.21
go 1.21.4

// exclude actually unused dependencies (mostly of pact-go, which is testing only anyway)
// because our scanner fails to understand they are not in use
Expand Down Expand Up @@ -52,6 +52,9 @@ exclude (
)

require (
github.com/IBM/sarama v1.42.1
github.com/Roshick/go-autumn-kafka v0.4.0
github.com/Roshick/go-autumn-synchronisation v0.2.0
github.com/StephanHCB/go-autumn-config-api v0.2.1
github.com/StephanHCB/go-autumn-config-env v0.2.2
github.com/StephanHCB/go-autumn-logging v0.3.0
Expand All @@ -69,10 +72,10 @@ require (
github.com/lestrrat-go/jwx/v2 v2.0.17
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.17.0
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/robfig/cron/v3 v3.0.1
github.com/rs/zerolog v1.31.0
github.com/stretchr/testify v1.8.4
github.com/twmb/franz-go v1.15.2
gopkg.in/yaml.v3 v3.0.1
)

Expand All @@ -90,6 +93,10 @@ require (
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/eapache/go-resiliency v1.4.0 // indirect
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/elastic/go-sysinfo v1.7.1 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
Expand All @@ -98,7 +105,16 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
Expand All @@ -116,23 +132,27 @@ require (
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/redis/go-redis/v9 v9.3.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
github.com/skeema/knownhosts v1.2.0 // indirect
github.com/sony/gobreaker v0.5.0 // indirect
github.com/tidwall/tinylru v1.2.1 // indirect
github.com/twmb/franz-go/pkg/kmsg v1.7.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
go.elastic.co/apm/module/apmchiv5/v2 v2.4.5 // indirect
go.elastic.co/apm/module/apmhttp/v2 v2.4.5 // indirect
go.elastic.co/apm/v2 v2.4.5 // indirect
go.elastic.co/fastjson v1.1.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
Expand Down
Loading
Loading