Compare commits

...
422 Commits
Author SHA1 Message Date
riabovvo 821f4c8046 MSP-9033 2026-11-20 13:41:49 +03:00
Рябов Владислав Олегович d45f814d6a Merge branch 'MSP-9033' into 'main'
update deps

Closes MSP-9033

See merge request isp/isp-config-service!23
2026-11-20 09:15:19 +00:00
riabovvo 1ff499ace3 update deps 2026-11-20 12:12:39 +03:00
Рябов Владислав Олегович b481c2a45e Merge branch 'MSP-9033' into 'main'
Resolve MSP-9033

Closes MSP-9033

See merge request isp/isp-config-service!22
2026-11-20 07:46:26 +00:00
riabovvo dde6c49b92 MSP-9033 update Dockerfile 2026-11-20 10:26:44 +03:00
riabovvo 9a66bd060a MSP-9033 bump version to 3.12.1 2026-11-20 10:11:31 +03:00
riabovvo d669c65038 MSP-9033 update local.go 2026-11-20 10:11:17 +03:00
komissarovyv c9ee296835 Merge branch 'module-leader-election' into 'main'
Module leader election: derivation, event narrowing and observation API

See merge request isp/isp-config-service!21
2026-11-19 13:21:17 +03:00
komissarovyv 53dff62759 Update release notes for the leader logging change 2026-11-19 12:57:41 +03:00
komissarovyv 439e6f5ebf Drop the module leader recompute event
The queue event did two things: set the routing-changed flag, which the lifecycle
event of the same change already sets, and deliver the leader-change info log. It
cost an extra raft INSERT per connect/disconnect, two GetForLeaderElection reads per
lifecycle event used for nothing else, a payload kind, a compaction key and a
subscription-service method that only logged.

The leader is now logged where it is published: the address-list emission logs the
leader it just sent, and the routing rebuild logs one summary line with the leaders
it published. Modules without election stay silent, as before.

A future self-election needs a recompute trigger that also re-broadcasts the address
list; that event will be added when the requirement exists, not carried as a no-op.
2026-11-19 12:57:28 +03:00
komissarovyv a8a475435c Bump version to 3.12.0 2026-11-19 12:14:34 +03:00
komissarovyv b36cb1cd0e Update kit to 1.76.0 2026-11-19 12:13:00 +03:00
komissarovyv 06ec2c6a87 Fix flaky leader flag assertion in module leader mode test 2026-11-18 22:05:09 +03:00
komissarovyv 45d7ea443f Show module leader flag in the observation API 2026-11-18 21:59:30 +03:00
komissarovyv 2bb06ffb8e Share module leader derivation by module 2026-11-18 21:49:35 +03:00
komissarovyv 45de1d1b12 Log module leader changes on the recompute event
The event handler maps the leader recompute onto the routing map rebuild with
the ready and disconnected events of the batch, so a leader change reaches the
routing map of every config service node.

The address list is not re-broadcast from it: the ready and disconnected event
of the same change already broadcasts it, and an extra snapshot per connect
broke the acceptance test on the exact number of host lists a module receives.

An info is written when the leader address in the payload differs from the
address before the change, naming the module, both addresses and the reason.
An event that changed nothing is silent, so the log stays readable.
2026-11-18 21:29:29 +03:00
komissarovyv 6cd0b2c712 Add internal module leader recompute event
The queue gets a payload kind of its own to recompute a module leader, with the
compaction key module_leader_<moduleId> so the collapse of ready and
disconnected into one module_lifecycle_<moduleId> event cannot swallow it.

The event is inserted next to the events of the same change: on a connect, on a
disconnect by WebSocket close, and on the phantom cleanup of the own node.
Graceful shutdown by DeleteOwnBackends keeps inserting no events. The payload
carries the leader address before and after the change, derived from the module
instances that are already loaded, so the event worker reads nothing from the
database. No new columns, no new tables, no new migrations.
2026-11-18 21:29:23 +03:00
komissarovyv 3d04dd2df7 Narrow module events to the module leader 2026-11-18 20:00:09 +03:00
komissarovyv 6cfa1955ea Derive module leader from connected instances 2026-11-18 20:00:09 +03:00
komissarovyv 9e24122e75 Cover module leader mode storage in acceptance tests 2026-11-18 19:31:14 +03:00
komissarovyv 71997dc438 Expose rqlite db handle for tests 2026-11-18 19:31:14 +03:00
komissarovyv bd8a1b2de4 Add module_leader_mode column to connected instances 2026-11-18 19:31:10 +03:00
komissarovyv 7b0108a358 Pin leader contract fields in the acceptance harness 2026-11-18 19:12:53 +03:00
komissarovyv a195c76799 Local isp-kit replace for module leader contract 2026-11-18 19:06:10 +03:00
komissarovyv 780c2232fb Merge branch 'fix-variable-links-persist' into 'main'
Fix: variable links not saved when a variable is used multiple times in config

See merge request isp/isp-config-service!20
2026-10-28 11:37:27 +03:00
Hermes Agent ef0978e064 Bump version to 3.11.1, add changelog 2026-10-28 11:29:32 +03:00
Hermes Agent c464393e93 Drop link self-healing paths, fix linter findings
- Remove link resync on module reconnect, link resave on no-op config
  update, and link backfill on variable create/upsert: links are
  formed only on config save
- Disable exhaustruct_v5 and goconst linters
- Fix golangci-lint findings: noinlineerr, slices.Backward,
  wrapcheck for ConfigValidationError (errors.As in controller keeps
  working via %w), funlen nolint on acceptance test
2026-10-28 11:22:59 +03:00
Hermes Agent 7f4e3ef028 Fix variable links not persisted when variable is used multiple times in config
- Dedupe extracted variable names (duplicate INSERTs aborted the
  config_has_variable transaction on PK conflict)
- Check per-statement rqlite errors in ExecTransaction: a failed
  statement silently returned success before
- Make link upserts idempotent (insert or ignore) and add link
  backfill on variable create/upsert from existing configs
- Validate config variables before insert (no orphaned configs)
- Resync active config links on module reconnect and on no-op
  config update (self-healing)
2026-10-28 10:34:45 +03:00
Синельник Тимур Романович 5c8a554d4f Merge branch 'MSP-8394' into 'main'
Resolve MSP-8394

Closes MSP-8394

See merge request isp/isp-config-service!19
2026-09-25 14:11:50 +03:00
Синельник Тимур Романович 5bdb4813b5 MSP-8394 Guard returning errors.WithMessage with err != nil check 2026-09-25 14:08:18 +03:00
Синельник Тимур Романович 17ec4bdce9 MSP-8394 Use slices.Backward for cycle 2026-09-25 14:06:15 +03:00
Синельник Тимур Романович 428de36857 MSP-8394 Up deps & use isp-kit/errors 2026-09-25 13:45:02 +03:00
Синельник Тимур Романович fc9c4f956f MSP-8394 Bump version to 3.11.0 2026-08-24 12:23:43 +03:00
Синельник Тимур Романович 44961d8416 MSP-8394 Add required admin permission 2026-08-24 12:22:33 +03:00
komissarovyv 2a846c67e4 MODULE_READY can be handled several times 2026-08-09 12:45:52 +03:00
komissarovyv 481f06bfec Bump dependencies 2026-07-27 16:21:37 +03:00
komissarovyv 3b99380a62 Disable migrate tool build 2026-07-07 12:41:50 +03:00
komissarovyv ffa09db7b2 Merge branch 'MSP-8007' into 'main'
Resolve MSP-8007

Closes MSP-8007

See merge request isp/isp-config-service!18
2026-07-07 11:44:22 +03:00
kochanovrv 94af308030 MSP-8007 fix threads 2026-07-07 11:24:09 +03:00
kochanovrv 36e320af28 MSP-8007 up sqlite 2026-07-06 16:21:06 +03:00
kochanovrv c2d7aea679 MSP-8007 up version to v3.9.2 2026-07-06 15:02:33 +03:00
kochanovrv aebd33e5cb MSP-8007 update isp-kit 2026-07-06 15:02:15 +03:00
Кузьмин Игорь Александрович 45b28e46e6 Edit .gitlab-ci.yml 2026-05-13 11:23:17 +00:00
Грязнов Денис Владимирович 48ccd130b2 Merge branch 'MSP-7572' into 'main'
Resolve MSP-7572

Closes MSP-7572

See merge request isp/isp-config-service!17
2026-04-23 14:17:35 +00:00
nglmq 7eb341856d MSP-7572 edit endpoint to inner 2026-04-22 12:36:48 +03:00
nglmq 38fe10f3a1 MSP-7572 bump version to 3.9.1 2026-04-22 12:36:48 +03:00
nglmq fa327ecf5c MSP-7572 edit go version in Dockerfiles 2026-04-22 12:36:48 +03:00
nglmq 6c3e8a632e MSP-7572 linter fixes 2026-04-21 12:35:50 +03:00
nglmq 03fcb26473 MSP-7572 swagger update 2026-04-21 11:57:23 +03:00
nglmq 7f4a1c8131 MSP-7572 new andpoint for required modules 2026-04-21 11:57:00 +03:00
komissarovyv 416f9307c3 Bump isp-kit 2026-02-20 19:26:48 +03:00
Грязнов Денис Владимирович 1273869b07 Merge branch 'dev' into 'main'
Dev

See merge request isp/isp-config-service!16
2026-02-11 13:45:59 +00:00
Синельник Тимур Романович 1839a18bb4 up deps 2026-02-11 16:14:03 +03:00
Синельник Тимур Романович 34d7fabf61 MSP-7042 Bump version to 3.9.0 2026-02-11 16:13:27 +03:00
Синельник Тимур Романович c295bda53b MSP-7042 Up deps & support http methods and transport 2026-02-11 16:13:03 +03:00
komissarovyv f97795bd90 Fix migrate 2026-02-10 17:35:55 +03:00
Кузьмин Игорь Александрович f7931b1d83 Edit .gitlab-ci.yml 2026-02-09 09:06:25 +00:00
Кузьмин Игорь Александрович 245cf8852d Edit .gitlab-ci.yml 2026-02-06 08:11:25 +00:00
Кузьмин Игорь Александрович 7b09eb3a07 Edit Dockerfile.dit 2026-02-05 14:45:18 +00:00
Кузьмин Игорь Александрович e45900fbaa Revert "Replace .gitlab-ci.yml"
This reverts commit aefc14ece9
2026-02-05 14:41:25 +00:00
Кузьмин Игорь Александрович b0330e80f3 Revert "Delete Dockerfile.dit"
This reverts commit 5a3d4fffea
2026-02-05 14:38:46 +00:00
Синельник Тимур Романович 9a2cdd0662 Merge branch 'sprint_dev' into 'main'
Sprint dev

Closes MSP-6930

See merge request isp/isp-config-service!13
2026-01-26 15:48:59 +03:00
Синельник Тимур Романович 9b577e96b1 Merge branch 'MSP-6930' into 'sprint_dev'
Resolve MSP-6930

See merge request isp/isp-config-service!14
2025-12-18 13:33:21 +03:00
Синельник Тимур Романович 7873c57c8e MSP-6930 Bump version to 3.8.0 2025-12-18 12:21:17 +03:00
Синельник Тимур Романович 38fdb65ec2 MSP-6930 Update updated_at 2025-12-18 12:21:17 +03:00
Синельник Тимур Романович 9ebf03a15a MSP-6930 Add /schema/update_by_module_name endpoint 2025-12-18 12:12:22 +03:00
Лихачев Алексей Михайлович 8101f9a8c8 Merge branch 'MSP-6703' into 'main'
MSP-6703

See merge request isp/isp-config-service!12
2025-12-01 13:37:18 +00:00
likhachevam 924d1cf6fe MSP-6703 up version to v3.7.0 2025-12-01 12:34:15 +03:00
likhachevam de3e456617 MSP-6703 fix 'enabled' config field 2025-12-01 12:34:05 +03:00
likhachevam fc5a21d6bb MSP-6703 add AutoOptimizeInterval to config.yml 2025-11-24 15:21:15 +03:00
likhachevam 4763d88628 MSP-6703 remove unused utils 2025-11-21 16:10:27 +03:00
likhachevam a6d72ec1a4 MSP-6703 add rqlite backup proxy 2025-11-21 16:03:57 +03:00
likhachevam 99d4aaca45 MSP-6703 fix race conditions 2025-11-21 13:24:48 +03:00
likhachevam 2f614a5c75 MSP-6703 update clearInterval format 2025-11-21 13:24:32 +03:00
likhachevam 960b87d86d MSP-6703 update waitForLeaderTimeout 2025-11-20 18:37:44 +03:00
likhachevam 35e15b7ae1 MSP-6703 update config.yml 2025-11-20 15:23:25 +03:00
likhachevam 392e5f5cff MSP-6703 fix go version 2025-11-20 14:58:18 +03:00
likhachevam 451d277644 MSP-6703 add backup_cleaner 2025-11-20 11:04:25 +03:00
likhachevam 2caed6b3f0 MSP-6703 up rqlite & add backups 2025-11-20 11:04:02 +03:00
likhachevam a349df7b05 MSP-6703 up dependencies 2025-11-20 11:01:43 +03:00
Лихачев Алексей Михайлович efed09bb92 Merge branch 'MSP-6459' into 'main'
MSP-6459

See merge request isp/isp-config-service!11
2025-10-09 12:25:11 +00:00
likhachevam a2c222dfd9 MSP-6459 up version to v3.6.0 2025-10-08 11:31:16 +03:00
likhachevam 129ce7c2c6 MSP-6459 update /purge_versions endpoint 2025-10-08 11:31:11 +03:00
likhachevam cde261cf5d MSP-6459 up go version to v1.25 2025-10-07 17:49:10 +03:00
likhachevam 8ef12f8b11 MSP-6459 update /purge_version endpoint 2025-10-07 17:27:58 +03:00
likhachevam 99782ef3bb MSP-6459 update linter 2025-10-07 16:46:34 +03:00
likhachevam 6a36603b5d MSP-6459 add PurgeConfigVersions endpoint 2025-10-07 16:46:18 +03:00
Кузьмин Игорь Александрович 5a3d4fffea Delete Dockerfile.dit 2025-09-17 14:41:30 +00:00
Грязнов Денис Владимирович 7a585711f6 Merge branch 'MSP-6078' into 'main'
Resolve MSP-6078

Closes MSP-6078

See merge request isp/isp-config-service!10
2025-08-21 12:03:53 +00:00
Кузнецов Иван Александрович d024e038c2 MSP-6078 update deps 2025-08-21 14:20:59 +03:00
Кузнецов Иван Александрович 7b329a8c73 MSP-6078 update deps 2025-08-21 13:45:43 +03:00
Кузнецов Иван Александрович e62089f019 MSP-6078 bump version to 3.5.0 2025-08-20 14:09:46 +03:00
Кузнецов Иван Александрович c3ed4a0e27 MSP-6078 update deps 2025-08-20 14:06:40 +03:00
komissarovyv 846129b1af Bump dependencies 2025-07-08 11:30:51 +03:00
komissarovyv 66edb03aa4 Bump dependencies 2025-07-08 11:20:46 +03:00
komissarovyv d56d6613bb Call upsert variables in any case 2025-07-08 11:19:04 +03:00
Кузьмин Игорь Александрович 5a67d0cc4f Edit README.md 2025-06-23 08:56:31 +00:00
Кузьмин Игорь Александрович 803b067278 Edit README.md 2025-06-23 07:58:36 +00:00
Рябов Кирилл Александрович 78eeee0bc6 Merge branch 'MSP-5579' into 'main'
MSP-5579

See merge request isp/isp-config-service!9
2025-06-10 13:09:48 +07:00
Kirill Ryabov c6f2c3a813 MSP-5579 bump version to 3.4.0 2025-06-09 16:10:30 +03:00
Kirill Ryabov 441702a180 MSP-5579 update swagger 2025-06-09 16:10:30 +03:00
Kirill Ryabov de85ffa726 MSP-5579 add test for autodiscovery functionality 2025-06-09 16:10:30 +03:00
Kirill Ryabov 1482636ad8 MSP-5579 enable metrics autodiscovery 2025-06-09 16:10:30 +03:00
Kirill Ryabov b62b0eef8b MSP-5579 include internal metrics autodiscovery method to locator & setup route 2025-06-09 16:10:30 +03:00
Kirill Ryabov 37f85f56fa MSP-5579 implement internal metrics autodiscovery endpoint 2025-06-09 16:10:30 +03:00
Kirill Ryabov 4c131093b1 MSP-5579 add handling MetricsAutodiscovery field from backend declaration 2025-06-09 14:52:49 +03:00
Kirill Ryabov 22bfe6f2a1 MSP-5579 enrich Backend struct with MetricsAutodiscovery field & add MetricsAdWrapper struct 2025-06-09 14:52:49 +03:00
Kirill Ryabov fd5ce55c4c MSP-5579 add metrics_autodiscovery column migration 2025-06-09 11:35:23 +03:00
Kirill Ryabov e5494e2849 MSP-5579 update dependencies 2025-06-09 11:35:23 +03:00
Кузьмин Игорь Александрович eb79974760 Edit Dockerfile 2025-06-06 14:02:13 +00:00
Кузьмин Игорь Александрович 350d22ae75 Edit Dockerfile 2025-06-06 13:49:02 +00:00
Рябов Кирилл Александрович 3e7f235876 Merge branch 'MSP-5494' into 'main'
MSP-5494

See merge request isp/isp-config-service!8
2025-05-27 18:36:55 +07:00
Kirill Ryabov 778e194d1d MSP-5494 bump version to 3.3.1 2025-05-26 14:43:31 +03:00
Kirill Ryabov bfe9764707 MSP-5494 update swagger 2025-05-26 14:43:31 +03:00
Kirill Ryabov 5877176645 MSP-5494 update dependencies 2025-05-26 14:43:31 +03:00
Kirill Ryabov 10e74db016 MSP-5494 migrate linter to v2 2025-05-26 14:43:31 +03:00
Kirill Ryabov 82f6d624ba MSP-5494 add github actions ci to build & publish docker image 2025-05-26 14:43:31 +03:00
Кузьмин Игорь Александрович 22e76538c4 Edit README.md 2025-04-18 13:57:57 +00:00
Кузьмин Игорь Александрович 11a5477bcb Edit README.md 2025-04-18 09:40:32 +00:00
Кузьмин Игорь Александрович aefc14ece9 Replace .gitlab-ci.yml 2025-04-18 09:13:59 +00:00
komissarovyv 0e6b5dec52 Merge branch 'MSP-5223' into 'main'
Resolve MSP-5223

Closes MSP-5223

See merge request isp/isp-config-service!7
2025-04-17 14:50:09 +00:00
Кузнецов Иван Александрович 2a424699d7 MSP-5223 composition struct domain.Config in domain.CreateUpdateConfigResponse 2025-04-17 15:23:36 +03:00
Кузнецов Иван Александрович 3c19a8d532 MSP-5223 update response CreateUpdateConfig: add IsChanged field 2025-04-16 16:05:17 +03:00
Кузнецов Иван Александрович 28be68322c MSP-5223 update compare actual data config and update request data config 2025-04-15 19:00:41 +03:00
Кузнецов Иван Александрович 867fd98bce MSP-5223 update naming + update changelog.md 2025-04-15 15:22:24 +03:00
Кузнецов Иван Александрович 1d3bacd22c MSP-5223 add endpoint /config/config/sync_config 2025-04-15 13:59:34 +03:00
Кузнецов Иван Александрович a483722e1d MSP-5223 update CreateUpdateConfig: add case equal name and data config 2025-04-15 13:29:27 +03:00
Кузнецов Иван Александрович 6ab012444f MSP-5223 UpdateConfigName not update field updated_at 2025-04-15 10:18:36 +03:00
Кузнецов Иван Александрович 57f58e7fb7 MSP-5223 rename field UpdateConfigNameRequest ConfigId -> Id 2025-04-15 10:10:46 +03:00
Кузнецов Иван Александрович a51aae9b69 MSP-5223 UpdateConfigNameRequest change field OldConfigName -> ConfidId + change ConfigVersion.CreatedAt actualCfg.CreatedAt -> actual.UpdatedAt 2025-04-14 19:17:04 +03:00
Кузнецов Иван Александрович 4214bd3f20 MSP-5223 swagger for UpdateConfigName 2025-04-14 19:17:04 +03:00
Кузнецов Иван Александрович a0b2a75c9d MSP-5223 GetAllVersion add handler entity.ErrConfigNotFound 2025-04-14 19:17:04 +03:00
Кузнецов Иван Александрович 159db8114e MSP-5223 bump version to 3.3.0 2025-04-14 19:16:57 +03:00
Кузнецов Иван Александрович a7b203bcd0 MSP-5223 implement handler config/config/update_config_name 2025-04-14 11:50:25 +03:00
Кузнецов Иван Александрович d0b55947c5 MSP-5223 configHistory.CreatedAt = oldConfig.UpdatedAt 2025-04-11 14:33:18 +03:00
Кузнецов Иван Александрович a3c65a1434 MSP-5223 generate new swagger 2025-04-11 14:16:24 +03:00
Кузнецов Иван Александрович 29c1a4deeb MSP-5223 update .golangci.yml + fix linters 2025-04-11 14:15:30 +03:00
Кузнецов Иван Александрович ee44e68af9 MSP-5223 update deps 2025-04-11 13:38:21 +03:00
Кузнецов Иван Александрович 7a426b647b MSP-5223 sort imports 2025-04-11 13:36:48 +03:00
Кузнецов Иван Александрович 9d299beaf6 MSP-5223 add actual config in GetAllVersions 2025-04-11 13:31:08 +03:00
komissarovyv 7a1d882248 Merge branch 'v3' into 'main'
V3

See merge request isp/isp-config-service!6
2025-03-24 12:29:17 +00:00
komissarovyv ab95da7242 MSP-5013 change variable error 2025-03-24 15:26:59 +03:00
komissarovyv f63bf4a9f1 MSP-5013 make description optional 2025-03-19 18:32:09 +03:00
komissarovyv a9d4b96305 MSP-5013 bump dependencies 2025-03-12 12:08:01 +03:00
komissarovyv cedb376a91 MSP-5013 use simple regexp to inject variables 2025-03-11 15:52:45 +03:00
komissarovyv 93d09a779d MSP-5013 hack jinja variables 2025-03-11 14:01:30 +03:00
komissarovyv 41fa496052 MSP-5013 fix test 2025-03-10 17:28:15 +03:00
komissarovyv 398d537d8a MSP-5013 unmarshal fix 2025-03-06 15:43:02 +03:00
komissarovyv c501354be1 MSP-5013 unmarshal fix 2025-03-06 15:40:54 +03:00
komissarovyv 7852772e9d MSP-5013 fix get by name 2025-03-06 14:56:01 +03:00
komissarovyv efc4a4ee38 MSP-5013 change routes 2025-03-06 11:53:04 +03:00
komissarovyv 25c07ef016 MSP-5013 bump version 2025-03-06 11:18:51 +03:00
komissarovyv b3511f018a MSP-5013 bump version 2025-03-06 11:10:15 +03:00
komissarovyv 46ba9541eb MSP-5013 reinit go mod 2025-03-06 11:03:01 +03:00
komissarovyv ecf2d06cfa MSP-5013 add full variable support 2025-03-05 18:10:07 +03:00
komissarovyv d6a8f77610 MSP-5013 Update doc 2025-03-03 17:32:13 +03:00
komissarovyv be0dea3702 MSP-5013 Add variables swagger 2025-03-03 15:23:03 +03:00
komissarovyv 148327c74e MSP-5013 Handle error in rqlite response 2025-03-03 15:22:54 +03:00
komissarovyv eed94a4920 MSP-5013 Disable logs in rqlite client by default 2025-03-03 15:22:46 +03:00
komissarovyv e47646c953 MSP-5013 Update dependencies 2025-03-03 15:22:38 +03:00
Кузьмин Игорь Александрович 69567c4869 Upload New File 2024-12-27 13:42:14 +00:00
Кузьмин Игорь Александрович 7a00dd1794 Upload New File 2024-12-27 13:41:48 +00:00
komissarovyv 5fbfe1b039 Add logs 2024-12-12 13:52:08 +03:00
komissarovyv 8f9dc2048f Merge branch 'v3' into 'master'
Add service

See merge request isp/isp-config-service!5
2024-11-27 09:08:46 +00:00
komissarovyv ca70e4a038 Add service 2024-11-27 12:07:45 +03:00
komissarovyv 16d2701e26 Merge branch 'v3' into 'master'
V3

See merge request isp/isp-config-service!4
2024-11-26 16:07:20 +00:00
komissarovyv 005510e0a5 Return default addresses 2024-11-26 19:04:50 +03:00
komissarovyv 5ba6913d5f Add disco mode support 2024-11-26 16:29:46 +03:00
komissarovyv c3400ab6cd Change migrate tool port 2024-11-20 17:06:52 +03:00
komissarovyv 83355f8bbc Move migrate tool to container 2024-11-20 14:31:52 +03:00
komissarovyv 93f2a5ed50 Merge branch 'v3' into 'master'
V3

Closes MSP-4227 and MSP-4182

See merge request isp/isp-config-service!1
2024-11-15 10:02:52 +00:00
komissarovyv 120abaf6dd Update swagger 2024-11-01 19:04:31 +03:00
komissarovyv 2db855d360 Pass backend connection id 2024-11-01 18:58:16 +03:00
komissarovyv 7aa2805f4c Clean phantom backends 2024-11-01 18:41:17 +03:00
komissarovyv 1342f0dcf2 Close cluster client 2024-10-29 21:54:01 +03:00
komissarovyv 4f4fb5e6c7 Clean events only on leader 2024-10-29 18:11:36 +03:00
komissarovyv 68c8681a9b Keep only last N config versions 2024-10-29 17:41:03 +03:00
komissarovyv cb8c66849a Fix migration 2024-10-29 12:48:33 +03:00
komissarovyv 3f60267bdc Fix migration 2024-10-29 12:35:31 +03:00
komissarovyv 43a1a206d5 Bump dependencies 2024-10-29 12:04:52 +03:00
komissarovyv d4badbb8db Return prev module id 2024-10-28 22:17:10 +03:00
komissarovyv 5346030323 Fix maintaince proxy 2024-10-28 21:44:54 +03:00
komissarovyv c32c9d5eba Implement auth 2024-10-28 20:24:48 +03:00
komissarovyv 000a5aacdf Merge branch 'MSP-4227' into 'v3'
Resolve MSP-4227

See merge request isp/isp-config-service!3
2024-10-16 08:06:58 +00:00
Пучков Андрей Павлович 62815a7691 MSP-4227 Bump version to 3.0.2 2024-10-14 16:51:19 +03:00
Пучков Андрей Павлович e52c0f760c MSP-4227 fix module name 2024-10-14 16:51:05 +03:00
komissarovyv bfe2a7f817 Merge branch 'MSP-4182' into 'v3'
Resolve MSP-4182

See merge request isp/isp-config-service!2
2024-10-02 07:41:41 +00:00
Синельник Тимур Романович 99c0e1b17d MSP-4182 Bump version to 3.0.1 2024-10-02 10:22:17 +03:00
Синельник Тимур Романович e1547dbb94 MSP-4182 Add autoincrement to isp_config_service__event id field 2024-10-02 10:02:25 +03:00
komissarovyv 38c4295d0b Use match elements 2024-09-08 09:36:16 +03:00
komissarovyv 3a9e163c9e Bump rqlited 2024-09-07 10:51:30 +03:00
d1slike 0065c7c5a7 Add migration tool 2024-05-24 18:26:39 +03:00
d1slike fb21d43425 Use idempotent module id 2024-05-24 16:26:00 +03:00
d1slike 13c5ed92f4 Do not check is response is array (fix panic) 2024-05-24 13:25:18 +03:00
Кузьмин Игорь Александрович c3d626f074 Update config.yml 2024-05-20 15:40:03 +00:00
d1slike a6fa3eee8a Reimplement disovery service 2024-05-17 11:37:03 +03:00
d1slike bf024474d1 Implement missing endpoint 2024-05-16 20:31:18 +03:00
d1slike 2228e02770 Implement missing endpoint 2024-05-16 20:27:40 +03:00
d1slike d7d17e7f13 Add Dockerfile 2024-05-15 14:42:52 +03:00
d1slike 9bc9655c3d Add Dockerfile 2024-05-15 14:39:25 +03:00
d1slike 0320131d57 Add log level 2024-05-15 13:54:40 +03:00
d1slike 8275c01d21 Align to CI 2024-05-15 12:44:39 +03:00
d1slike 125013ba0a Implement acceptance test 2024-05-14 19:21:19 +03:00
d1slike 3b34468842 Improve logging 2024-05-14 14:34:13 +03:00
d1slike cddd3383e8 Implement api 2024-05-12 16:35:33 +03:00
d1slike c6148a1c1c Implement api 2024-05-08 18:45:21 +03:00
d1slike b2e34c00a4 Implement api 2024-05-08 15:40:14 +03:00
d1slike 80a99c425b Implement event stream 2024-05-07 20:16:44 +03:00
d1slike f90063cb03 Add go.sum 2024-05-06 20:18:15 +03:00
d1slike c4abdaa54b Implement lifecycle 2024-05-06 20:09:14 +03:00
d1slike 8a2a65d8ed Implement lifecycle 2024-05-06 09:43:11 +03:00
d1slike 2e23e882bb Implement lifecycle 2024-05-03 18:24:07 +03:00
d1slike 4e96b7a930 Reimplement 2024-05-03 17:46:22 +03:00
d1slike 5e72ec3864 Fix build 2024-04-24 17:56:48 +03:00
d1slike 05eb762273 Fix data 2024-04-24 17:34:03 +03:00
Кузьмин Игорь Александрович e2419e2c4b Update file README.md 2024-03-25 14:40:05 +00:00
Кузьмин Игорь Александрович 72afc94782 Update README.md 2024-03-25 14:04:00 +00:00
Кузьмин Игорь Александрович 02070b1db1 Update file README.md 2024-03-25 13:50:01 +00:00
Кузьмин Игорь Александрович 2fc6c7ba91 Delete Dockerfile.dit 2024-03-25 13:16:38 +00:00
Кузьмин Игорь Александрович c706d7932d Delete .gitlab-ci.yml 2024-03-25 13:16:28 +00:00
Кузьмин Игорь 62714cdfe1 Upload New File 2023-05-10 08:44:16 +00:00
Кузьмин Игорь a2c49ac39f Add new file 2023-05-03 10:11:43 +00:00
komissarovyv de55ea643c Merge branch 'deps' into 'master'
Deps

See merge request integration-system/isp-config-service!6
2022-12-09 09:09:04 +00:00
d1slike 5fb60e14b8 Ignore test 2022-12-08 16:35:34 +03:00
d1slike 02603cb018 Bump version 2022-12-08 16:22:25 +03:00
d1slike ffbff595d1 Remove ci 2022-12-08 16:18:01 +03:00
d1slike 989429824e Upgrade dependencies 2022-12-08 16:18:01 +03:00
Кузьмин Игорь a31e6080e2 Update default_remote_config.json 2022-11-29 11:56:09 +00:00
Кузьмин Игорь 90e05dfb4b Add new file 2022-11-29 11:51:08 +00:00
Мержанов Максим Владимирович 2af27ddb68 Merge branch 'remove_instance_uuid' into 'master'
remove instanceUuid

See merge request integration-system/isp-config-service!5
2021-05-26 14:08:58 +00:00
Maxim Merzhanov d004faa9e0 remove instanceUuid 2021-05-25 18:39:58 +03:00
Мержанов Максим Владимирович 45a4a23112 Merge branch '__deps' into 'master'
Update dependencies

See merge request integration-system/isp-config-service!4
2021-05-18 12:09:02 +00:00
Egor Kiryushchenko 1bb50f8175 Update dependencies 2021-05-17 16:22:07 +03:00
Мержанов Максим Владимирович 0cbfcab3f9 Merge branch 'bugfixes' into 'master'
Bugfixes

See merge request integration-system/isp-config-service!3
2021-05-14 09:36:25 +00:00
Maxim Merzhanov d4125963b2 update CHANGELOG.md 2021-05-13 17:35:22 +03:00
Maxim Merzhanov 2e33c2275c address review comments
- increase shutdown limit to 10/11 sec as it was set in isp-lib/bootstrap
- refactor
- update libs versions to released
2021-05-13 17:04:15 +03:00
Maxim Merzhanov a5b21198e0 cluster: reduce websocket read buffer from 10 to 1 2021-04-30 18:05:06 +03:00
Maxim Merzhanov e765cda3f9 add timeouts to all websocket emits 2021-04-30 13:09:52 +03:00
Maxim Merzhanov 5a91184d6c fix deadlock in cluster client 2021-04-22 19:25:35 +03:00
Maxim Merzhanov e2094296f4 fix race in test (TimeoutRetryer.Do needs to be fixed in isp-lib-test) 2021-04-22 19:16:26 +03:00
Maxim Merzhanov 777e856d00 fix potential error shadowing when leader apply log, but return nil instead of ApplyLogResponse 2021-04-21 17:04:48 +03:00
Maxim Merzhanov c3f419bbc5 update raft lib, improve raft logging 2021-04-21 16:47:59 +03:00
Maxim Merzhanov 52705f6982 fix hanging on graceful shutdown 2021-04-21 16:47:59 +03:00
Maxim Merzhanov a5134181be add integration test for multiple config updates 2021-04-19 10:25:43 +03:00
Maxim Merzhanov 79c801d493 add metric server 2021-04-05 18:42:54 +03:00
Maxim Merzhanov f9823d5303 fix version config store test 2021-04-01 18:55:08 +03:00
Maxim Merzhanov 8339591b27 fix leader address race on leader disconnect 2021-04-01 18:36:12 +03:00
Maxim Merzhanov 17a6e3186d fix a couple of data races 2021-04-01 16:54:42 +03:00
Maxim Merzhanov 213bad9722 increase default version config count to 15 2021-04-01 16:47:44 +03:00
Maxim Merzhanov ef33bd9fd2 up test lib, fix grpc awaiting 2021-03-10 11:41:36 +03:00
Мержанов Максим Владимирович 123de3d452 Merge branch '__deps' into 'master'
Update dependencies

See merge request integration-system/isp-config-service!2
2021-01-26 19:21:26 +03:00
Egor Kiryushchenko 6591bff728 Update dependencies 2021-01-26 13:52:14 +03:00
Maxim Merzhanov 88c0779aa2 fix marshaling body of ERROR_CONNECTION event 2021-01-15 16:05:47 +03:00
Максим Мержанов 95adcb117c Merge branch '__deps' into 'master'
Update dependencies

See merge request integration-system/isp-config-service!14
2020-11-24 16:56:15 +03:00
Egor Kiryushchenko 372636f43b Update dependencies 2020-11-24 09:42:16 +03:00
Maxim Merzhanov 54dae1ab2b fix test 2020-11-23 10:47:08 +03:00
Egor Kiryushchenko f0f50a8507 fix lint 2020-11-20 16:46:46 +03:00
Egor Kiryushchenko c3d0d5be4c Update dependencies 2020-11-19 10:29:59 +03:00
DeniskaRediska 929132743c up version 2020-10-22 15:51:52 +03:00
DeniskaRediska 6643e8937c add db pass part 2020-10-22 15:49:25 +03:00
Максим Мержанов 08b4ee461e Merge branch 'api_ext_branch' into 'master'
add valid property to method `/config/get_configs_by_module_id`

See merge request integration-system/isp-config-service!6
2020-09-28 16:08:21 +03:00
Рябов Владислав Олегович ae501969bf add valid property to method /config/get_configs_by_module_id 2020-09-28 16:08:21 +03:00
Максим Мержанов c29ed6d41e Merge branch 'api_ext_branch' into 'master'
add new config methods

See merge request integration-system/isp-config-service!5
2020-09-24 22:08:50 +03:00
Рябов Владислав Олегович 1c28c895b5 add new config methods 2020-09-24 22:08:50 +03:00
d1slike d9c32437c9 remove utc 2020-07-15 17:37:22 +03:00
d1slike 0429bed9e3 up version 2020-07-15 17:33:06 +03:00
DeniskaRediska 8bdc36a302 up created_at for version_config 2020-07-10 19:48:09 +03:00
DeniskaRediska a3576cc3f4 add created_at for version_config 2020-07-10 19:38:35 +03:00
DeniskaRediska 713db0aa4c reverse version config 2020-07-10 19:26:35 +03:00
d1slike 95aae06a41 downgrade version 2020-06-09 14:42:36 +03:00
DeniskaRediska 31a4a6f5b8 ref 2020-06-09 13:55:39 +03:00
DeniskaRediska 1c66729974 fix generate version id 2020-06-09 13:41:56 +03:00
d1slike 6387947b22 small ref 2020-06-09 12:57:07 +03:00
DeniskaRediska 3a8469c5a9 fix test 2020-06-08 20:44:54 +03:00
DeniskaRediska 44715591ef fix lint 2020-06-08 20:14:50 +03:00
DeniskaRediska ceb9d71a1a fix lint 2020-06-08 20:11:53 +03:00
DeniskaRediska 15ad05277b add config version 2020-06-08 18:39:25 +03:00
d1slike 14c5b0a678 fix broadcasting config on activating and upserting configs 2020-06-03 15:43:05 +03:00
d1slike c95964fa3c get module dependencies from first connected backend 2020-06-03 14:35:11 +03:00
d1slike a46f2cee34 Merge remote-tracking branch 'origin/required_modules' into feat_broadcasting
# Conflicts:
#	go.mod
#	go.sum
2020-06-03 14:10:14 +03:00
d1slike 1764ce9a30 Merge remote-tracking branch 'origin/add_conf_version' into feat_broadcasting
# Conflicts:
#	go.mod
#	go.sum
2020-06-03 14:09:57 +03:00
DeniskaRediska 384fa0417a add config version 2020-06-03 11:33:52 +03:00
Maxim Merzhanov 97ba1050a7 appease linter 2020-06-02 18:19:33 +03:00
Maxim Merzhanov 628c506e85 list required modules in get_modules_info method 2020-06-02 17:06:02 +03:00
d1slike 9226796463 broadcasting to modules 2020-06-01 19:35:22 +03:00
Maxim Merzhanov 83176ba878 update doc 2020-03-24 13:24:16 +03:00
Maxim Merzhanov 94cb067214 refactor sync apply helpers 2020-03-23 18:31:47 +03:00
Maxim Merzhanov b56b6e0e42 update isp-etp lib 2020-03-23 17:51:30 +03:00
Maxim Merzhanov 28aa3eae33 add module/broadcast_event method 2020-03-23 16:49:21 +03:00
Maxim Merzhanov 96dee8dee3 stringify cluster commands in log 2020-03-23 12:49:34 +03:00
Maxim Merzhanov 400410c449 up version 2020-03-23 12:17:37 +03:00
Maxim Merzhanov ab08abb3f6 fix integration test 2020-03-23 11:50:04 +03:00
Maxim Merzhanov 01e32537a8 update docs 2020-03-23 11:21:23 +03:00
Maxim Merzhanov 652d1c8c4f update isp-lib and go-pg 2020-03-23 11:16:30 +03:00
Maxim Merzhanov 64e7792778 up version 2020-03-16 14:22:13 +03:00
Maxim Merzhanov bfb03c6d1e migrate to go modules 2020-03-16 14:20:10 +03:00
Maxim Merzhanov 1fa20f9cda add linter, refactor 2020-03-12 13:12:43 +03:00
Maxim Merzhanov 9d61ec49c3 improve logging, regenerate doc 2020-03-06 14:07:59 +03:00
Maxim Merzhanov 9dc598feff up .version file 2020-02-26 17:53:09 +03:00
Maxim Merzhanov 49fde946ac configure leader ws client ConnectionReadLimit 2020-02-26 17:48:46 +03:00
Maxim Merzhanov c4ded39e7c up v2.1.1 2020-01-16 17:55:46 +03:00
Maxim Merzhanov c8518e9f35 update to new EndpointDescriptor 2020-01-16 17:48:58 +03:00
ykomissarov 97d3a38ed8 up v2.1.0 2020-01-16 14:42:30 +03:00
Maxim Merzhanov e840b53978 fix raft store Snapshot and Restore 2020-01-16 14:02:52 +03:00
Maxim Merzhanov c43e52e9ad disable PullImage in tests 2019-12-27 18:56:15 +03:00
Maxim Merzhanov 2a2bd99fcf fix test, add retry on getRoutes command 2019-12-27 18:36:17 +03:00
Maxim Merzhanov c4f9fc4585 fix send on closed channel on raft shutdown 2019-12-27 17:35:45 +03:00
Maxim Merzhanov 0222dfd865 cleanup to satisfy linter 2019-12-27 17:26:48 +03:00
Maxim Merzhanov 11f91b67a8 move mux to separate repo 2019-12-27 17:09:29 +03:00
Maxim Merzhanov 6e2d485b90 fix data race when applyCommandOnLeader in websocket handler; minor fixes 2019-12-24 18:56:06 +03:00
ykomissarov e336a57e13 fix raft server address announcing (serverId == serverAddress == cluster.outerAddress) 2019-12-10 12:47:17 +03:00
Maxim Merzhanov 29e7c119bd integration test: add pause between starting container and checking cluster 2019-11-28 18:41:41 +03:00
Maxim Merzhanov 882228558d add schema docs, hotfix tests 2019-11-28 17:26:15 +03:00
Maxim Merzhanov 51360e802f up version 2019-11-28 16:05:55 +03:00
Maxim Merzhanov 7a06660597 fix nil pointer dereference in repositories
increase default websocket ConnectionReadLimit to 4 MB, add to configuration
2019-11-28 15:41:50 +03:00
Maxim Merzhanov 4553cd0261 cleanup 2019-11-22 18:30:33 +03:00
Maxim Merzhanov 2bbc426bef implement tcp/http mux 2019-11-22 16:53:40 +03:00
Maxim Merzhanov b22a22cac9 add docker IPs calculation to test 2019-11-21 14:22:30 +03:00
Maxim Merzhanov cc7b931e0a set grpcOuterAddress in default config to empty 2019-11-21 13:50:51 +03:00
Maxim Merzhanov d4a44b0d72 add possibility to declare grpcOuterAddress from config, update default config 2019-11-21 11:28:54 +03:00
Maxim Merzhanov 284a9bb444 try remove cmux 2019-11-20 17:26:03 +03:00
Maxim Merzhanov ef4dc0e972 update logging 2019-11-19 17:30:03 +03:00
Maxim Merzhanov def031958b add overriding logging level via env var 2019-11-19 13:24:24 +03:00
Maxim Merzhanov 00c1936683 try cmux.HTTP1Fast() 2019-11-18 19:08:29 +03:00
Maxim Merzhanov cc3aab1e7b add comparing backend declarations 2019-11-18 17:20:05 +03:00
Maxim Merzhanov c14de6d198 add option to BootstrapCluster 2019-11-18 15:08:02 +03:00
Maxim Merzhanov f9f8186451 add integration test
add option to configure raft connection timeout
2019-11-15 18:09:16 +03:00
Maxim Merzhanov 0259cf84ce fix config server address declaration 2019-11-11 17:37:03 +03:00
ykomissarov 04ceb5f4fa remove unused port 2019-11-06 12:09:50 +03:00
ykomissarov 6efcbe7c70 upd 2019-11-06 12:05:55 +03:00
ykomissarov e0ce92a9f3 Merge remote-tracking branch 'origin/v2' into v2_migrate_etp
# Conflicts:
#	Gopkg.lock
2019-11-06 12:04:24 +03:00
Yan 28e08e108a Merge pull request #12 from integration-system/fix_validate_config_status
fix valid config status after update
2019-11-01 12:18:05 +03:00
Maxim Merzhanov 4e68903251 update isp-lib
remove second apply module_connected_command
improve shutdown logging
2019-11-01 11:59:34 +03:00
DeniskaRediska 73515e5179 fix(valid config status after update) 2019-11-01 11:57:24 +03:00
Yan f752770788 Merge pull request #11 from integration-system/v2_validation_config
add validation config
2019-10-31 17:29:14 +03:00
DeniskaRediska 6eb6efe844 ref 2019-10-31 17:27:50 +03:00
DeniskaRediska 837b8755a0 Merge remote-tracking branch 'origin/v2_validation_config' into v2_validation_config
# Conflicts:
#	service/config.go
2019-10-31 17:23:50 +03:00
DeniskaRediska e3b5e867b1 ref 2019-10-31 17:23:03 +03:00
ykomissarov 362efd9546 upd 2019-10-31 17:21:02 +03:00
Maxim Merzhanov a958874731 fix ErrorConnection event format 2019-10-31 17:01:11 +03:00
DeniskaRediska 0d5094cfb5 add(validation config) 2019-10-31 16:17:15 +03:00
ykomissarov 74b32e064e upd 2019-10-30 18:39:20 +03:00
ykomissarov 3ad5dfe030 Merge remote-tracking branch 'origin/v2' into v2_migrate_etp 2019-10-30 15:07:42 +03:00
Maxim Merzhanov 95242965da add announcing config module 2019-10-30 14:53:28 +03:00
Maxim Merzhanov 8c15105087 add cmux multiplexer to run raft and ws on the same port
fix discovery broadcast
2019-10-30 14:00:46 +03:00
Yan db68505cca Update handler.go 2019-10-30 13:21:20 +03:00
ykomissarov 795aee86d1 new api for common configs 2019-10-30 12:50:01 +03:00
ykomissarov 33621ff523 new api for common configs 2019-10-30 12:47:35 +03:00
Maxim Merzhanov 415a694228 remove creating empty default config 2019-10-30 11:06:03 +03:00
Maxim Merzhanov 1fe8b7f78d add common configs unique name constraint 2019-10-29 18:43:06 +03:00
Maxim Merzhanov c2fc3c54da remove leader client reconnection
fix discovery addresses broadcast
2019-10-29 18:24:32 +03:00
Maxim Merzhanov 652c2d95b8 migrate to etp
fix raft logger
2019-10-29 17:24:47 +03:00
ykomissarov da1b6caf67 upd 2019-10-29 14:57:51 +03:00
ykomissarov deafdfb7ab upd 2019-10-29 14:56:56 +03:00
ykomissarov f9feaeab0b upd 2019-10-29 14:54:51 +03:00
Maxim Merzhanov 330c160122 revert SyncApplyCommand logging 2019-10-29 12:15:20 +03:00
Maxim Merzhanov 238c7b3a44 update swagger doc
add ws disconnect when cluster is not initialized
2019-10-29 11:40:45 +03:00
Maxim Merzhanov 1317696cb7 - update CreateUpdateCommonConfig doc
- remove required from ids
2019-10-28 19:10:26 +03:00
Maxim Merzhanov 23108f2224 fix discovery lock 2019-10-25 16:55:02 +03:00
ykomissarov 6b14252577 upd 2019-10-25 16:30:36 +03:00
ykomissarov 8386cd7503 upd 2019-10-25 16:26:33 +03:00
Yan c6225eeb3a Merge pull request #10 from integration-system/v2_grpc_api
implement grpc api
2019-10-25 15:25:11 +03:00
Maxim Merzhanov a12c2fd120 fix common configRep delete and mesh broadcasting 2019-10-25 14:13:52 +03:00
Maxim Merzhanov 9e503ab31f implement grpc api 2019-10-25 12:18:34 +03:00
d1slike c31abb84c9 reformat state access and errors handling 2019-10-12 12:53:20 +03:00
Yan b1a0bc252f Merge pull request #8 from integration-system/v2_send_config_schema
add subscription on send config schema
2019-10-12 10:41:10 +03:00
Yan 599b1639e7 Update config.yml 2019-10-11 19:02:20 +03:00
DeniskaRediska 1199f9ae8e ref 2019-10-11 18:58:11 +03:00
DeniskaRediska cb8ae318c4 add(cluster check 'is leader') 2019-10-11 18:52:44 +03:00
ykomissarov fec8a759bc upd 2019-10-11 18:40:16 +03:00
ykomissarov 5d4b54c39c Merge remote-tracking branch 'origin/v2' into v2_send_config_schema
# Conflicts:
#	Gopkg.lock
#	cluster/const.go
#	store/apply.go
#	store/state/modules.go
#	store/state/state.go
#	store/store.go
#	subs/client.go
2019-10-11 18:22:55 +03:00
Yan 4ebab3a967 Merge pull request #9 from integration-system/v2_backend_store
v2 config sharing
2019-10-11 18:18:18 +03:00
Maxim Merzhanov 73315e6671 move event to metadata in logging 2019-10-11 18:15:24 +03:00
Maxim Merzhanov db03a888fb move commandName to metadata in logging 2019-10-11 18:12:48 +03:00
Maxim Merzhanov 7d4a5c4c6c fix 2019-10-11 18:05:37 +03:00
DeniskaRediska 94397ea4c7 ref 2019-10-11 18:00:31 +03:00
Maxim Merzhanov e05319432e add handling CONFIG:SEND_CONFIG_WHEN_CONNECTED, update modules state 2019-10-11 16:59:25 +03:00
DeniskaRediska f1bce695fb add(subscription on send config schema ) 2019-10-11 16:38:56 +03:00
Yan 7aad2697f7 Merge pull request #7 from integration-system/v2_backend_store
V2 backend store
2019-10-10 16:19:16 +03:00
Maxim Merzhanov 848a2d74d6 fix migrations 2019-10-10 16:13:08 +03:00
Maxim Merzhanov a2a470ad93 refactor, change id to string 2019-10-10 15:05:57 +03:00
ykomissarov 78150b2661 remove unnecessary codes 2019-10-10 13:16:49 +03:00
ykomissarov ed2e1a0936 ref 2019-10-10 13:03:52 +03:00
Maxim Merzhanov 445389b7d8 - implement raft logger
- replace logger with isp-log
- add storage layer (pq)
2019-10-10 11:18:29 +03:00
Yan 1bb8cbf3ab Merge pull request #2 from integration-system/v2_service_discovery
V2 service discovery
2019-09-11 11:45:57 +03:00
Maxim Merzhanov ca6fe7b86e update golang-socketio lib 2019-09-11 10:25:53 +03:00
Maxim Merzhanov 0b351ea3a2 - updated golang-socketio lib 2019-09-10 14:16:12 +03:00
ykomissarov 05c5db53bd rename func 2019-09-09 16:23:36 +03:00
Maxim Merzhanov 7632e07f4e добавлено анонсирование конфиг сервисов 2019-09-09 12:16:17 +03:00
Maxim Merzhanov 1ddbe43618 fix 2019-09-04 18:48:54 +03:00
Maxim Merzhanov 79f83e245c refactoring, added DeleteBackendDeclarationCommand 2019-09-04 18:20:11 +03:00
ykomissarov d678f28909 add commnets 2019-09-04 14:45:21 +03:00
Maxim Merzhanov c3e95fa98c done #1 2019-09-04 13:55:07 +03:00
ykomissarov e32e55df15 init 2019-08-02 17:59:51 +03:00
ykomissarov 48eaf48797 init 2019-08-01 14:47:54 +03:00
ykomissarov ead505d40c * update libs
* default config handling
2019-05-13 16:53:43 +03:00
DeniskaRediska a39a53561e add default config 2019-05-13 15:35:06 +03:00
DeniskaRediska ebf715c368 add default config 2019-05-13 15:33:20 +03:00
gryaznovdv 87f2c360c5 added module mode to adapter service 2019-04-04 16:28:26 +03:00
gryaznovdv b0584b4ead added module mode to adapter service 2019-04-04 16:27:32 +03:00
ykomissarov 1575a4cc34 add default config for script service 2019-04-02 16:51:59 +03:00
ykomissarov 1bc12d7a33 remove field filtering for search by default 2019-03-27 14:26:42 +03:00
ykomissarov 89707ff412 package refactoring 2019-03-20 11:05:47 +03:00
ykomissarov 33b9e220d3 package refactoring 2019-03-20 11:05:17 +03:00
ykomissarov d3e39f66a2 reformat 2019-03-18 16:10:09 +03:00
ykomissarov 48a991e11b update lib 2019-03-18 14:02:04 +03:00
ykomissarov 3ef79e51ca update lib 2019-03-18 11:25:03 +03:00
ykomissarov d945add7a0 config for api service 2019-03-05 11:43:12 +03:00
ykomissarov 2e0e25de42 try use ack 2019-03-05 10:58:29 +03:00
ykomissarov 334043947a try use ack 2019-03-05 10:57:56 +03:00
ykomissarov e5e8f2b962 migration for async api service 2019-03-05 10:30:01 +03:00
ykomissarov a16ecbc8a9 new config for mdm 2019-03-01 12:04:34 +03:00
ykomissarov 3c6e9c75a9 up version 2019-02-26 13:11:24 +03:00
ykomissarov 980bcb2eb5 upd 2019-02-20 19:02:10 +03:00
ykomissarov 3b73722bca upd 2019-02-20 16:23:44 +03:00
ykomissarov 15f7a970b1 test config 2019-02-20 12:05:49 +03:00
ykomissarov e6083dbe81 migration for dumper service 2019-02-19 11:34:23 +03:00
logicalslice 54a77441fd Update 00013_2018-08-29_add_default_config_for_senders.sql 2019-01-29 20:02:38 +03:00
Andrey Savchuk 353cf671da update module 2019-01-29 16:22:40 +03:00
Andrey Savchuk 02c280009b bump version 2019-01-29 15:50:53 +03:00
Andrey Savchuk 379db84504 Merge branch 'master' of work.github.com:integration-system/isp-config-service 2019-01-29 15:49:39 +03:00
logicalslice bd56df8ed8 Create LICENSE 2019-01-29 15:22:17 +03:00
176 changed files with 13005 additions and 4792 deletions

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
name: Create and publish a Docker image
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
APP_NAME: ${{ github.event.repository.name }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version from tag
id: version_reader
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: |
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
org.opencontainers.image.version=${{ steps.version_reader.outputs.version }}
build-args: |
app_name=${{ env.APP_NAME }}
version=${{ steps.version_reader.outputs.version }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
+9 -3
View File
@@ -9,8 +9,8 @@
.idea/**/tasks.xml
.idea/dictionaries
*.iml
config_service
config-service
convert_service
convert-service
# Sensitive or high-churn files:
.idea/**/dataSources/
@@ -67,5 +67,11 @@ fabric.properties
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
/node_modules/
/vendor/
/node_modules/
package.json
yarn.lock
conf/config_dev.yml
.DS_Store
+3
View File
@@ -0,0 +1,3 @@
include:
- project: '$CI_PROJECT_PATH'
file: '/ci-isp-go-service.yml'
+78
View File
@@ -0,0 +1,78 @@
version: "2"
run:
allow-parallel-runners: true
linters:
default: all
disable:
- contextcheck # не имеет смысла
- depguard # не всегда имеет смысл
- dupword # не имеет смысла
- exhaustruct # не имеет смысла
- exhaustruct_v5 # не имеет смысла
- goconst # не всегда имеет смысл
- godot # не актуально для swagger
- godox # не позволяет оставлять todo
- musttag # у нас собственное правило: не используем теги, если работаем с пакетом isp-kit/json и с внутренними структурами(между нашими сервисами), при этом теги обязательный для всех внешних для нас структур
- nlreturn # не всегда имеет смысл
- nolintlint # Goland все равно форматирует с отступом
- perfsprint # мнимая производительность в угоду читаемости
- tagalign # не всегда имеет смысл
- varnamelen # очень индивидуально (db)
- wsl # расставление пробелов очень индивидуально
- wsl_v5 # расставление пробелов очень индивидуально
- godoclint # ругается на // nolint, не удобно
- prealloc # слишком аггресивный, в большинстве случаев не требуется
- gomoddirectives # в проекте осознанно захардкожены версии зависимостей
settings:
cyclop:
max-complexity: 15 # по умолчанию 10 мало
funlen:
lines: 80
lll:
line-length: 150
revive:
rules:
- name: var-naming # отключаем Id -> ID
disabled: true
staticcheck:
checks: # отключаем Id -> ID
- -ST1000
- -ST1016
- -ST1020
- -ST1021
- -ST1022
testifylint:
disable:
- compares
- equal-values
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- wrapcheck
path: controller # достаточное кол-во контекста на уровне контроллеров
- linters:
- wrapcheck
path: transaction # транзакции прозрачны
- linters:
- unqueryvet
- prealloc
path: ".*_test\\.go$"
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
+1 -1
View File
@@ -1 +1 @@
0.3.0
3.12.1
+42
View File
@@ -0,0 +1,42 @@
FROM golang:1.27-alpine AS builder
WORKDIR /build
ARG version
ENV version_env=$version
ARG app_name
ENV app_name_env=$app_name
COPY . .
RUN apk update && apk upgrade && apk add --no-cache gcc musl-dev
RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
WORKDIR cmd/migrate
#RUN CGO_ENABLED=1 go build -o /migrate .
FROM alpine:3.23
RUN apk add --no-cache tzdata
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
RUN echo "Europe/Moscow" > /etc/timezone
#COPY --from=builder migrate /migrate/migrate
COPY cmd/migrate/config.yml /migrate/config.yml
RUN chmod 666 /migrate/config.yml
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
USER appuser
WORKDIR /app
ARG app_name
ENV app_name_env=$app_name
COPY --from=builder main /app/$app_name_env
COPY /conf/config.yml /app/config.yml
COPY /conf/default_remote_config.json* /app/default_remote_config.json
COPY /migrations /app/migrations
ENTRYPOINT /app/$app_name_env
+52
View File
@@ -0,0 +1,52 @@
FROM dockerhub.mos.ru/mosos/arbat:15.5 as builder
RUN zypper --no-gpg-checks update -y && zypper --no-gpg-checks install -y go1.27 git
WORKDIR /build
ARG version
ENV version_env=$version
ARG app_name
ENV app_name_env=$app_name
COPY . .
ENV GOPROXY=https://repo-mirror.mos.ru/repository/go-public
RUN go build -ldflags="-X 'main.version=$version_env'" -o /main .
WORKDIR cmd/migrate
RUN CGO_ENABLED=1 go build -o /migrate .
FROM dockerhub.mos.ru/mosos/arbat:15.5
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
RUN echo "Europe/Moscow" > /etc/timezone
COPY --from=builder migrate /migrate/migrate
COPY cmd/migrate/config.yml /migrate/config.yml
RUN chmod 666 /migrate/config.yml
ARG UID=10001
RUN useradd \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
--user-group \
appuser
RUN mkdir -p /app/data
RUN chown appuser:appuser /app/data
VOLUME /app/data
USER appuser
WORKDIR /app
ARG app_name
ENV app_name_env=$app_name
COPY --from=builder main /app/$app_name_env
COPY /conf/config.yml /app/config.yml
COPY /conf/default_remote_config.json* /app/default_remote_config.json
COPY /migrations /app/migrations
ENTRYPOINT /app/$app_name_env
COPY /conf/config.yml /app/config.yml
COPY /conf/default_remote_config.json* /app/default_remote_config.json
COPY /migrations /app/migrations
ENTRYPOINT /app/$app_name_env
Generated
-618
View File
@@ -1,618 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
digest = "1:e92f5581902c345eb4ceffdcd4a854fb8f73cf436d47d837d1ec98ef1fe0a214"
name = "github.com/StackExchange/wmi"
packages = ["."]
pruneopts = "UT"
revision = "5d049714c4a64225c3c79a7cf7d02f7fb5b96338"
version = "1.0.0"
[[projects]]
digest = "1:320e7ead93de9fd2b0e59b50fd92a4d50c1f8ab455d96bc2eb083267453a9709"
name = "github.com/asaskevich/govalidator"
packages = ["."]
pruneopts = "UT"
revision = "ccb8e960c48f04d6935e72476ae4a51028f9e22f"
version = "v9"
[[projects]]
digest = "1:652880afc6b57ce0a67173f552cb35ccda816493a1da6ca20e5074a66bcd083f"
name = "github.com/buaazp/fasthttprouter"
packages = ["."]
pruneopts = "UT"
revision = "ade4e2031af3aed7fffd241084aad80a58faf421"
version = "v0.1.1"
[[projects]]
digest = "1:553f73a4171c265045ae4f5d3122429ecf2c9c0c232c91f336127fe45480104a"
name = "github.com/cenkalti/backoff"
packages = ["."]
pruneopts = "UT"
revision = "62661b46c4093e2c1f38d943e663db1a29873e80"
version = "v2.1.0"
[[projects]]
digest = "1:abeb38ade3f32a92943e5be54f55ed6d6e3b6602761d74b4aab4c9dd45c18abd"
name = "github.com/fsnotify/fsnotify"
packages = ["."]
pruneopts = "UT"
revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9"
version = "v1.4.7"
[[projects]]
digest = "1:64a5a67c69b70c2420e607a8545d674a23778ed9c3e80607bfd17b77c6c87f6a"
name = "github.com/go-ole/go-ole"
packages = [
".",
"oleutil",
]
pruneopts = "UT"
revision = "a41e3c4b706f6ae8dfbff342b06e40fa4d2d0506"
version = "v1.2.1"
[[projects]]
digest = "1:e7f1117ec9d37b59ba6d70bbd8feaa9cd2d1c6f676dc88ee152f5a57908fea4b"
name = "github.com/go-pg/pg"
packages = [
".",
"internal",
"internal/parser",
"internal/pool",
"orm",
"types",
]
pruneopts = "UT"
revision = "514bed76d8f579d6ff8d40294fa77e476a5c1b3f"
version = "v6.15.0"
[[projects]]
digest = "1:fa5e9e1af8a8645086811ec5ab003806026babc57c8bb3a6f7e1ab34b80e2ff1"
name = "github.com/golang/protobuf"
packages = [
"jsonpb",
"proto",
"protoc-gen-go/descriptor",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/struct",
"ptypes/timestamp",
]
pruneopts = "UT"
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
version = "v1.2.0"
[[projects]]
branch = "master"
digest = "1:324591cd9122f94cc39a87bd44ec71153672c239e2cff5743bfad96b60be3749"
name = "github.com/googollee/go-engine.io"
packages = [
".",
"message",
"parser",
"polling",
"transport",
"websocket",
]
pruneopts = "UT"
revision = "e2f255711dcb2ea41e42c6d9d98c172d7edf6509"
[[projects]]
branch = "master"
digest = "1:3eb026ba34d6dd12b45bb6abd63b4e917ebca8d8f3022a139c0881d900ad1bee"
name = "github.com/googollee/go-socket.io"
packages = ["."]
pruneopts = "UT"
revision = "c8aeb1ed9b49d7de8fef8662efb18f1d289c5f2e"
[[projects]]
digest = "1:7b5c6e2eeaa9ae5907c391a91c132abfd5c9e8a784a341b5625e750c67e6825d"
name = "github.com/gorilla/websocket"
packages = ["."]
pruneopts = "UT"
revision = "66b9c49e59c6c48f0ffce28c2d8b8a5678502c6d"
version = "v1.4.0"
[[projects]]
digest = "1:d544928ef5b57ff39325b4fea31f262db66c9241324aee38ba55dfe3e836e2c8"
name = "github.com/grpc-ecosystem/grpc-gateway"
packages = [
"runtime",
"runtime/internal",
"utilities",
]
pruneopts = "UT"
revision = "e8bd377da7395186f2f042ee6b366fa5a11d2b39"
[[projects]]
digest = "1:c0d19ab64b32ce9fe5cf4ddceba78d5bc9807f0016db6b1183599da3dcc24d10"
name = "github.com/hashicorp/hcl"
packages = [
".",
"hcl/ast",
"hcl/parser",
"hcl/printer",
"hcl/scanner",
"hcl/strconv",
"hcl/token",
"json/parser",
"json/scanner",
"json/token",
]
pruneopts = "UT"
revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:1b1d9534e35d61e861a7356f7f2d766e57e2777dbf79be60e1ac56bbd60adf51"
name = "github.com/integration-system/go-cmp"
packages = [
"cmp",
"cmp/internal/diff",
"cmp/internal/function",
"cmp/internal/value",
]
pruneopts = "UT"
revision = "ed1c8d9bf7906aec13cf28080fdf069d7687471a"
[[projects]]
branch = "master"
digest = "1:9e2fd899fdb17e28e9d036fe7a604a1e04918aa4865d5a2150008fc12c6134be"
name = "github.com/integration-system/golang-socketio"
packages = [
".",
"protocol",
"transport",
]
pruneopts = "UT"
revision = "5959fcea049facd9441fff9de976191accd3cf9f"
[[projects]]
branch = "master"
digest = "1:900583da99fb5a30a9c3b829bab8acca29a9474d5b40a5c3cb28e7bc7cd27788"
name = "github.com/integration-system/isp-lib"
packages = [
"backend",
"bootstrap",
"config",
"config/schema",
"controller",
"database",
"http",
"logger",
"metric",
"proto/stubs",
"socket",
"streaming",
"structure",
"utils",
]
pruneopts = "UT"
revision = "0f71aaf83133a59c9fc143faecbd38b86ed068e2"
[[projects]]
branch = "master"
digest = "1:a992b3ab79433b828258f9fe99af29da5aeb2e48bf8076a41ba556ac90ac04d3"
name = "github.com/integration-system/jsonschema"
packages = ["."]
pruneopts = "UT"
revision = "170a88febd847f36821e99ec54a095e6cec48528"
[[projects]]
branch = "master"
digest = "1:fd97437fbb6b7dce04132cf06775bd258cce305c44add58eb55ca86c6c325160"
name = "github.com/jinzhu/inflection"
packages = ["."]
pruneopts = "UT"
revision = "04140366298a54a039076d798123ffa108fff46c"
[[projects]]
digest = "1:5d713dbcad44f3358fec51fd5573d4f733c02cac5a40dcb177787ad5ffe9272f"
name = "github.com/json-iterator/go"
packages = [
".",
"extra",
]
pruneopts = "UT"
revision = "1624edc4454b8682399def8740d46db5e4362ba4"
version = "v1.1.5"
[[projects]]
digest = "1:aaa8e0e7e35d92e21daed3f241832cee73d15ca1cd3302ba3843159a959a7eac"
name = "github.com/klauspost/compress"
packages = [
"flate",
"gzip",
"zlib",
]
pruneopts = "UT"
revision = "30be6041bed523c18e269a700ebd9c2ea9328574"
version = "v1.4.1"
[[projects]]
digest = "1:2d643962fac133904694fffa959bc3c5dcfdcee38c6f5ffdd99a3c93eb9c835c"
name = "github.com/klauspost/cpuid"
packages = ["."]
pruneopts = "UT"
revision = "e7e905edc00ea8827e58662220139109efea09db"
version = "v1.2.0"
[[projects]]
digest = "1:0a69a1c0db3591fcefb47f115b224592c8dfa4368b7ba9fae509d5e16cdc95c8"
name = "github.com/konsorten/go-windows-terminal-sequences"
packages = ["."]
pruneopts = "UT"
revision = "5c8c8bd35d3832f5d134ae1e1e375b69a4d25242"
version = "v1.0.1"
[[projects]]
digest = "1:8ef506fc2bb9ced9b151dafa592d4046063d744c646c1bbe801982ce87e4bc24"
name = "github.com/lib/pq"
packages = [
".",
"oid",
]
pruneopts = "UT"
revision = "4ded0e9383f75c197b3a2aaa6d590ac52df6fd79"
version = "v1.0.0"
[[projects]]
digest = "1:c568d7727aa262c32bdf8a3f7db83614f7af0ed661474b24588de635c20024c7"
name = "github.com/magiconair/properties"
packages = ["."]
pruneopts = "UT"
revision = "c2353362d570a7bfa228149c62842019201cfb71"
version = "v1.8.0"
[[projects]]
digest = "1:c658e84ad3916da105a761660dcaeb01e63416c8ec7bc62256a9b411a05fcd67"
name = "github.com/mattn/go-colorable"
packages = ["."]
pruneopts = "UT"
revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
version = "v0.0.9"
[[projects]]
digest = "1:0981502f9816113c9c8c4ac301583841855c8cf4da8c72f696b3ebedf6d0e4e5"
name = "github.com/mattn/go-isatty"
packages = ["."]
pruneopts = "UT"
revision = "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c"
version = "v0.0.4"
[[projects]]
branch = "master"
digest = "1:2b32af4d2a529083275afc192d1067d8126b578c7a9613b26600e4df9c735155"
name = "github.com/mgutz/ansi"
packages = ["."]
pruneopts = "UT"
revision = "9520e82c474b0a04dd04f8a40959027271bab992"
[[projects]]
digest = "1:53bc4cd4914cd7cd52139990d5170d6dc99067ae31c56530621b18b35fc30318"
name = "github.com/mitchellh/mapstructure"
packages = ["."]
pruneopts = "UT"
revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe"
version = "v1.1.2"
[[projects]]
digest = "1:33422d238f147d247752996a26574ac48dcf472976eda7f5134015f06bf16563"
name = "github.com/modern-go/concurrent"
packages = ["."]
pruneopts = "UT"
revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94"
version = "1.0.3"
[[projects]]
digest = "1:e32bdbdb7c377a07a9a46378290059822efdce5c8d96fe71940d87cb4f918855"
name = "github.com/modern-go/reflect2"
packages = ["."]
pruneopts = "UT"
revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
version = "1.0.1"
[[projects]]
branch = "master"
digest = "1:84bd7f8a2e0bcd53ddc33c3b47c34c1fe340c8632cbe928f7f8ae10ec6ecdd62"
name = "github.com/mohae/deepcopy"
packages = ["."]
pruneopts = "UT"
revision = "c48cc78d482608239f6c4c92a4abd87eb8761c90"
[[projects]]
digest = "1:95741de3af260a92cc5c7f3f3061e85273f5a81b5db20d4bd68da74bd521675e"
name = "github.com/pelletier/go-toml"
packages = ["."]
pruneopts = "UT"
revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194"
version = "v1.2.0"
[[projects]]
digest = "1:d4c5d57ac0163eb71e09f1a94ca998961668700232f948d47a6269c8d7651d38"
name = "github.com/pressly/goose"
packages = ["."]
pruneopts = "UT"
revision = "7a98874933001af28951c83e958b1db750f39f8d"
version = "v2.4.5"
[[projects]]
branch = "master"
digest = "1:d38f81081a389f1466ec98192cf9115a82158854d6f01e1c23e2e7554b97db71"
name = "github.com/rcrowley/go-metrics"
packages = ["."]
pruneopts = "UT"
revision = "3113b8401b8a98917cde58f8bbd42a1b1c03b1fd"
[[projects]]
digest = "1:564e4136357b9d481ad8eb9d87f7fc144a28bb41cb0e29e739db3535e2d87575"
name = "github.com/shirou/gopsutil"
packages = [
"cpu",
"internal/common",
]
pruneopts = "UT"
revision = "0f70a4a06f7a1039305ec9b3ba9c2800f8929fba"
version = "v2.18.11"
[[projects]]
digest = "1:69b1cc331fca23d702bd72f860c6a647afd0aa9fcbc1d0659b1365e26546dd70"
name = "github.com/sirupsen/logrus"
packages = ["."]
pruneopts = "UT"
revision = "bcd833dfe83d3cebad139e4a29ed79cb2318bf95"
version = "v1.2.0"
[[projects]]
digest = "1:6a4a11ba764a56d2758899ec6f3848d24698d48442ebce85ee7a3f63284526cd"
name = "github.com/spf13/afero"
packages = [
".",
"mem",
]
pruneopts = "UT"
revision = "d40851caa0d747393da1ffb28f7f9d8b4eeffebd"
version = "v1.1.2"
[[projects]]
digest = "1:08d65904057412fc0270fc4812a1c90c594186819243160dc779a402d4b6d0bc"
name = "github.com/spf13/cast"
packages = ["."]
pruneopts = "UT"
revision = "8c9545af88b134710ab1cd196795e7f2388358d7"
version = "v1.3.0"
[[projects]]
digest = "1:68ea4e23713989dc20b1bded5d9da2c5f9be14ff9885beef481848edd18c26cb"
name = "github.com/spf13/jwalterweatherman"
packages = ["."]
pruneopts = "UT"
revision = "4a4406e478ca629068e7768fc33f3f044173c0a6"
version = "v1.0.0"
[[projects]]
digest = "1:c1b1102241e7f645bc8e0c22ae352e8f0dc6484b6cb4d132fa9f24174e0119e2"
name = "github.com/spf13/pflag"
packages = ["."]
pruneopts = "UT"
revision = "298182f68c66c05229eb03ac171abe6e309ee79a"
version = "v1.0.3"
[[projects]]
digest = "1:214775c11fd26da94a100111a62daa25339198a4f9c57cb4aab352da889f5b93"
name = "github.com/spf13/viper"
packages = ["."]
pruneopts = "UT"
revision = "2c12c60302a5a0e62ee102ca9bc996277c2f64f5"
version = "v1.2.1"
[[projects]]
branch = "master"
digest = "1:d32b64a7a82dd36b674fb73ff767e949eb7155b6b574ff276f49d4edc8af105f"
name = "github.com/thecodeteam/goodbye"
packages = ["."]
pruneopts = "UT"
revision = "a83968bda2d37294a3541b7d2207fb6f5a3559a3"
[[projects]]
digest = "1:c468422f334a6b46a19448ad59aaffdfc0a36b08fdcc1c749a0b29b6453d7e59"
name = "github.com/valyala/bytebufferpool"
packages = ["."]
pruneopts = "UT"
revision = "e746df99fe4a3986f4d4f79e13c1e0117ce9c2f7"
version = "v1.0.0"
[[projects]]
branch = "master"
digest = "1:c911cc6a838b0d6be5de154aaea7b36530d5c97e019c3bb56b67fa8531aa17df"
name = "github.com/valyala/fasthttp"
packages = [
".",
"fasthttputil",
"stackless",
]
pruneopts = "UT"
revision = "1d2d99cba311e04b8d58f5d113ee07086c3e64f6"
[[projects]]
branch = "master"
digest = "1:c83590426ecf1362e77a9054afed570b201de1a353398a6157ecce06583ea024"
name = "github.com/vmihailenco/sasl"
packages = ["."]
pruneopts = "UT"
revision = "2f13c189728a02f8cc31b3b9cc06047b383c21cc"
[[projects]]
digest = "1:39a425f98fb19427061a693fe6bf0683c9bddec4b25b17067e34fdb465e39cb9"
name = "github.com/x-cray/logrus-prefixed-formatter"
packages = ["."]
pruneopts = "UT"
revision = "bb2702d423886830dee131692131d35648c382e2"
version = "v0.5.2"
[[projects]]
branch = "master"
digest = "1:9ff2b9f8d4e47013a213b9ea0d850ed787c51f5eab2038842d82397ad85a19c1"
name = "golang.org/x/crypto"
packages = [
"pbkdf2",
"ssh/terminal",
]
pruneopts = "UT"
revision = "505ab145d0a99da450461ae2c1a9f6cd10d1f447"
[[projects]]
branch = "master"
digest = "1:7a2e3d6819e7a97a877f8604e737901c6941e76d56ae98a51a1ca2f13de351fb"
name = "golang.org/x/net"
packages = [
"context",
"http/httpguts",
"http2",
"http2/hpack",
"idna",
"internal/timeseries",
"trace",
]
pruneopts = "UT"
revision = "351d144fa1fc0bd934e2408202be0c29f25e35a0"
[[projects]]
branch = "master"
digest = "1:b9dceb1408ba5105803d5859193bc7d89ac3199b611cf8681dbaa0aa09c10d9c"
name = "golang.org/x/sys"
packages = [
"unix",
"windows",
]
pruneopts = "UT"
revision = "a5c9d58dba9a56f97aaa86f55e638b718c5a6c42"
[[projects]]
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable",
]
pruneopts = "UT"
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
branch = "master"
digest = "1:6aec038013fe4a5de91d89b51283cd0ddc0b8ed60ac58e0a173a9d8cf39438c5"
name = "google.golang.org/genproto"
packages = [
"googleapis/api/annotations",
"googleapis/rpc/errdetails",
"googleapis/rpc/status",
]
pruneopts = "UT"
revision = "bd91e49a0898e27abb88c339b432fa53d7497ac0"
[[projects]]
digest = "1:9edd250a3c46675d0679d87540b30c9ed253b19bd1fd1af08f4f5fb3c79fc487"
name = "google.golang.org/grpc"
packages = [
".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"binarylog/grpc_binarylog_v1",
"codes",
"connectivity",
"credentials",
"credentials/internal",
"encoding",
"encoding/proto",
"grpclog",
"internal",
"internal/backoff",
"internal/binarylog",
"internal/channelz",
"internal/envconfig",
"internal/grpcrand",
"internal/grpcsync",
"internal/syscall",
"internal/transport",
"keepalive",
"metadata",
"naming",
"peer",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats",
"status",
"tap",
]
pruneopts = "UT"
revision = "df014850f6dee74ba2fc94874043a9f3f75fbfd8"
version = "v1.17.0"
[[projects]]
digest = "1:c805e517269b0ba4c21ded5836019ed7d16953d4026cb7d00041d039c7906be9"
name = "gopkg.in/natefinch/lumberjack.v2"
packages = ["."]
pruneopts = "UT"
revision = "a96e63847dc3c67d17befa69c303767e2f84e54f"
version = "v2.1"
[[projects]]
digest = "1:4d2e5a73dc1500038e504a8d78b986630e3626dc027bc030ba5c75da257cdb96"
name = "gopkg.in/yaml.v2"
packages = ["."]
pruneopts = "UT"
revision = "51d6538a90f86fe93ac480b35f37b2be17fef232"
version = "v2.2.2"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"github.com/asaskevich/govalidator",
"github.com/cenkalti/backoff",
"github.com/go-pg/pg",
"github.com/go-pg/pg/orm",
"github.com/golang/protobuf/proto",
"github.com/golang/protobuf/ptypes/struct",
"github.com/googollee/go-socket.io",
"github.com/grpc-ecosystem/grpc-gateway/runtime",
"github.com/grpc-ecosystem/grpc-gateway/utilities",
"github.com/integration-system/isp-lib/backend",
"github.com/integration-system/isp-lib/bootstrap",
"github.com/integration-system/isp-lib/config",
"github.com/integration-system/isp-lib/config/schema",
"github.com/integration-system/isp-lib/controller",
"github.com/integration-system/isp-lib/database",
"github.com/integration-system/isp-lib/logger",
"github.com/integration-system/isp-lib/metric",
"github.com/integration-system/isp-lib/socket",
"github.com/integration-system/isp-lib/structure",
"github.com/integration-system/isp-lib/utils",
"github.com/valyala/fasthttp",
"golang.org/x/net/context",
"google.golang.org/genproto/googleapis/api/annotations",
"google.golang.org/grpc",
"google.golang.org/grpc/codes",
"google.golang.org/grpc/grpclog",
"google.golang.org/grpc/status",
]
solver-name = "gps-cdcl"
solver-version = 1
-33
View File
@@ -1,33 +0,0 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[prune]
go-tests = true
unused-packages = true
[[constraint]]
name = "github.com/grpc-ecosystem/grpc-gateway"
revision = "e8bd377da7395186f2f042ee6b366fa5a11d2b39"
+1 -91
View File
@@ -1,92 +1,2 @@
## Contents
## [1. Installing](#installing)
## [2. Using](#using)
## [3. Environment variables](#environment-variables)
# isp-config-service
## Installing
### 1. Download dependencies
```
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go
```
### 2. Generate GRPC, GRPC-gateway, GRPC-gateway-swagger
###### WINDOWS
```cmd
protoc ^
-I. -I%GOPATH%\src ^
-I%GOPATH%\src\github.com\grpc-ecosystem\grpc-gateway\third_party\googleapis ^
--go_out=plugins=grpc:. --grpc-gateway_out=logtostderr=true:. --swagger_out=logtostderr=true:. ^
proto\config_service.proto
```
###### LINUX
```bash
protoc -I. \
-I$GOPATH \
-I$GOPATH/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
--go_out=plugins=grpc:. --grpc-gateway_out=logtostderr=true:. --swagger_out=logtostderr=true:. \
proto/config_service.proto
```
## Using
### 1. GRPC
Default GRPC port is: `5001`, might be changed in config file
Proto file is: `proto/config_service.proto`
### 2. REST proxy to GRPC
Default port is: `5000`, might be changed in config file
Swagger work on http://0.0.0.0:5000/swagger
### 3. SocketIO
For connect to this server two variables must be sent in query path:
1. `module_name` - Module name, for example `auth`.
2. `instance_uuid` - UUID - instance identity.
#### Events
##### Event to a client
`CONFIG:SEND_CONFIG_WHEN_CONNECTED` - When a connection is established to a client will send an event.
`CONFIG:SEND_CONFIG_CHANGED` - When config for particular module had been changed this event with new config will send to a client.
`CONFIG:SEND_CONFIG_ON_REQUEST` - the server will send to a client actual config with this event after `CONFIG:REQUEST_CONFIG`
###### The next events work on both sides. First, when new backend publishes new methods at config service there is incoming one of this events:
`ROUTES:SEND_ROUTES_WHEN_CONNECTED` - A backend sends this event when a connection is established with a config server.
`ROUTES:SEND_ROUTES_CHANGED` - Any module can say that something had changed in its methods.
`ROUTES:SEND_ROUTES_ON_REQUEST` - A config service is able to make a request to renew list methods.
###### A config service, in turn, send the same events types in each its connection.
For all of this events we wait for next data structure:
```json
{
"address": {
"ip": "10.10.10.10",
"port": "5001"
},
"endpoints": [
{"path": "/api/user/get"},
{"path": "/api/user/save"},
{"path": "/api/user/delete"}
]
}
```
##### Event to the server
`CONFIG:REQUEST_CONFIG` - A client can request current config with this event.
## Environment variables
`APP_PROFILE` - Name for config file, default is `config`. Will seek file with name: `config.yml`.
`APP_CONFIG_PATH` - Absolute path where a config file is. If a variable hadn't been specified config will seek into the same directory, when binary file placed.
`LOG_LEVEL` - Log level, the default is `INFO`.
`APP_MODE` - If set to `dev` logger for SQL will be on and if `LOG_LEVEL` hadn't been specified it will set to `DEBUG`.
## Changes
#### 0.2.2 - 2018-10-05
- Add default config for mdm module
+214
View File
@@ -0,0 +1,214 @@
package assembly
import (
"context"
"net/http"
"net/http/httputil"
"net/url"
"time"
"isp-config-service/conf"
"isp-config-service/service/module/backend"
"isp-config-service/service/variable"
httpEndpoint "github.com/txix-open/isp-kit/http/endpoint"
"github.com/txix-open/isp-kit/http/endpoint/httplog"
"isp-config-service/controller"
"isp-config-service/controller/api"
"isp-config-service/repository"
"isp-config-service/routes"
apisvs "isp-config-service/service/api"
"isp-config-service/service/event"
"isp-config-service/service/metrics"
"isp-config-service/service/module"
"isp-config-service/service/rqlite/db"
"isp-config-service/service/subscription"
"github.com/txix-open/etp/v4"
"github.com/txix-open/isp-kit/grpc"
"github.com/txix-open/isp-kit/grpc/endpoint"
"github.com/txix-open/isp-kit/log"
"github.com/txix-open/isp-kit/worker"
)
const (
wsReadLimit = 4 * 1024 * 1024
handleEventsInterval = 500 * time.Millisecond
cleanEventInterval = 60 * time.Second
cleanPhantomBackendsInterval = 5 * time.Minute
eventTtl = 60 * time.Second
)
type LocalConfig struct {
Local conf.Local
RqliteAddress string
}
type Locator struct {
db db.DB
cfg LocalConfig
leaderChecker LeaderChecker
logger log.Logger
}
type LeaderChecker interface {
IsLeader() bool
}
type OwnBackendsCleaner interface {
DeleteOwnBackends(ctx context.Context)
}
func NewLocator(
db db.DB,
leaderChecker LeaderChecker,
cfg LocalConfig,
logger log.Logger,
) Locator {
return Locator{
db: db,
leaderChecker: leaderChecker,
cfg: cfg,
logger: logger,
}
}
type Config struct {
GrpcMux *grpc.Mux
HttpMux http.Handler
MetricsAdHandler http.Handler
EtpSrv *etp.Server
HandleEventWorker *worker.Worker
CleanEventWorker *worker.Worker
CleanPhantomBackendWorker *worker.Worker
CleanBackupsWorker *worker.Worker
OwnBackendsCleaner OwnBackendsCleaner
}
//nolint:funlen
func (l Locator) Config() *Config {
moduleRepo := repository.NewModule(l.db)
backendRepo := repository.NewBackend(l.db)
eventRepo := repository.NewEvent(l.db)
configRepo := repository.NewConfig(l.db)
configSchemaRepo := repository.NewConfigSchema(l.db)
configHistoryRepo := repository.NewConfigHistory(l.db)
variableRepo := repository.NewVariable(l.db)
variableService := variable.NewService(variableRepo, configRepo, eventRepo)
variableController := api.NewVariable(variableService)
etpSrv := etp.NewServer(
etp.WithServerReadLimit(wsReadLimit),
etp.WithServerAcceptOptions(&etp.AcceptOptions{
InsecureSkipVerify: true,
}),
)
emitter := module.NewEmitter(l.logger)
subscriptionService := subscription.NewService(
moduleRepo,
backendRepo,
configRepo,
etpSrv.Rooms(),
emitter,
variableService,
l.logger,
)
backendService := backend.NewBackend(
backendRepo,
eventRepo,
l.cfg.Local.Rqlite.NodeId,
etpSrv.Rooms(),
l.logger,
)
cleanPhantomBackendJob := backend.NewCleaner(backendService, l.logger)
cleanPhantomBackendWorker := worker.New(cleanPhantomBackendJob, worker.WithInterval(cleanPhantomBackendsInterval))
moduleService := module.NewService(
moduleRepo,
backendService,
configRepo,
configSchemaRepo,
subscriptionService,
emitter,
variableService,
l.logger,
)
moduleController := controller.NewModule(moduleService, l.logger)
configHistoryApiService := apisvs.NewConfigHistory(configRepo, moduleRepo, configHistoryRepo,
l.cfg.Local.KeepConfigVersions, l.logger)
configHistoryController := api.NewConfigHistory(configHistoryApiService)
moduleApiService := apisvs.NewModule(moduleRepo, backendRepo, configSchemaRepo)
moduleApiController := api.NewModule(moduleApiService)
configApiService := apisvs.NewConfig(
configRepo,
moduleRepo,
configSchemaRepo,
eventRepo,
configHistoryApiService,
variableService,
l.logger,
)
configApiController := api.NewConfig(configApiService)
configSchemaApiService := apisvs.NewConfigSchema(configSchemaRepo, moduleRepo)
configSchemaController := api.NewConfigSchema(configSchemaApiService)
controllers := routes.Controllers{
Module: moduleController,
ModuleApi: moduleApiController,
ConfigApi: configApiController,
ConfigHistoryApi: configHistoryController,
ConfigSchemaApi: configSchemaController,
VariableApi: variableController,
}
mapper := endpoint.DefaultWrapper(l.logger)
grpcMux := routes.GrpcHandler(mapper, controllers)
routes.BindEtp(etpSrv, controllers, l.logger)
rqliteUrl, err := url.Parse(l.cfg.RqliteAddress)
if err != nil {
panic(err)
}
rqliteProxy := httputil.NewSingleHostReverseProxy(rqliteUrl)
rqliteBackupUrl, err := url.Parse(l.cfg.RqliteAddress + "/db/backup")
if err != nil {
panic(err)
}
rqliteBackupProxy := httputil.NewSingleHostReverseProxy(rqliteBackupUrl)
httpMux := routes.HttpHandler(etpSrv, l.cfg.Local, rqliteProxy, rqliteBackupProxy)
eventHandler := event.NewHandler(subscriptionService, l.logger)
handleEventJob := event.NewWorker(eventRepo, eventHandler, l.logger)
handleEventWorker := worker.New(handleEventJob, worker.WithInterval(handleEventsInterval))
cleanerJob := event.NewCleaner(eventRepo, l.leaderChecker, eventTtl, l.logger)
cleanEventWorker := worker.New(cleanerJob, worker.WithInterval(cleanEventInterval))
cleanBackupsJob := event.NewBackupCleaner(l.leaderChecker, l.cfg.Local.Backup, l.logger)
cleanBackupsWorker := worker.New(cleanBackupsJob, worker.WithInterval(l.cfg.Local.Backup.ClearInterval))
metricsSvc := metrics.New(backendRepo)
metricsController := controller.NewMetrics(metricsSvc)
httpWrapper := httpEndpoint.DefaultWrapper(l.logger, httplog.Log(l.logger, false))
return &Config{
GrpcMux: grpcMux,
EtpSrv: etpSrv,
HttpMux: httpMux,
MetricsAdHandler: httpWrapper.Endpoint(metricsController.Autodiscovery),
HandleEventWorker: handleEventWorker,
CleanEventWorker: cleanEventWorker,
CleanPhantomBackendWorker: cleanPhantomBackendWorker,
CleanBackupsWorker: cleanBackupsWorker,
OwnBackendsCleaner: backendService,
}
}
+75
View File
@@ -0,0 +1,75 @@
### v3.12.1
* Обновление ограничений конфигурации: в параметре `KeepConfigVersions` допустимо значение `0`
### v3.12.0
* Обновлен isp-kit до v1.76.0: подтянуты транзитивные зависимости (grpc v1.85.0, otel v1.47.0, goose v3.30.1, prometheus/client_golang v1.25.0), сервис собирается на Go 1.27
* Добавлена колонка `module_leader_mode` в таблицу `isp_config_service__backend` — режим выбора лидера, объявленный инстансом в `MODULE:READY`. Любое значение, кроме `REQUEST_ELECTION` (в том числе зарезервированные `IM_LEADER` и `IM_FOLLOWER`), нормализуется в пустое значение с логом уровня `warn`, рукопожатие при этом не отклоняется
* Для модулей, объявивших `REQUEST_ELECTION`, список адресов в событии `{module}_MODULE_CONNECTED` и карта маршрутов в `CONFIG:SEND_ROUTES_*` сузены до одного инстанса — лидера, а когда инстансов не осталось — до пустого списка. Модули без election не затронуты
* Лидер выводится из подключённых инстансов (минимум по `created_at`, тай-брейк по `ws_connection_id`) и нигде не хранится: ни новой таблицы, ни колонки «лидер/не лидер» нет
* Расширен ответ по `/module/get_modules_info` и `/routing/get_routes`: поле `isModuleLeader` в `domain.Connection`. `/routing/get_routes` остался полным — все инстансы всех модулей; сужение касается только событий, уходящих модулям
* Сужение видно в логах: публикация списка адресов модуля с election пишет `info` с адресом лидера, пересборка карты маршрутов — одной строкой список опубликованных лидеров (`модуль=адрес` через запятую). Модули без election по-прежнему не шумят
### v3.11.1
* Исправлено: при сохранении конфига с многократным использованием одной переменной через `_Var()` терялись все связи переменной с конфигами (конфликт PK в транзакции ссылок)
* Ошибки statement в rqlite-транзакциях больше не игнорируются молча, возвращаются как ошибка запроса
* Отключены линтеры `exhaustruct_v5`, `goconst`
### v3.11.0
* Добавлены `admin` permission к endpoint'ам
### v3.10.0
* событие `MODULE_READY` теперь может быть обработано несколько раз, обновляя полученные данные об инстансе модуля
### v3.9.3
* обновлены зависимости
### v3.9.2
* Обновлен isp-kit
### v3.9.1
* Версия go 1.26
* Добавлен эндпоинт `/module/get_required_modules` для получения списка модулей, от которых зависит модуль, отправивший запрос
### v3.9.0
* Обновлены зависимости
* Добавлено поле `transport` в таблицу `isp_config_service__backend`
* Расширен ответ по `/routing/get_routes` и `/module/get_modules_info`:
* Добавлено поле `httpMethod` в `domain.EndpointDescriptor`
* Добавлено поле `transport` в `domain.Connection`
### v3.8.1
* исправлена миграция для `config-history`
### v3.8.0
* Добавлен новый endpoint `config/schema/update_by_module_name` для обновления схемы модуля по его названию
## v3.7.0
* добавлены rqlite-автобэкапы и прокси-эндпоинт `/backup` для создания резервных копий
* изменен таймаут ожидания лидера с 30 до 180 секунд
* исправлены потенциальные race conditions
* добавлен параметр периодической оптимизации sqlite `AutoOptimizeInterval: 23h`
* обновлены зависимости
## v3.6.0
* добавлен новый эндпоинт `config/config/purge_versions` для удаления старых версий всех конфигураций модуля, за исключением n последних
* обновлены зависимости
## v3.5.0
* обновлены зависимости
## v3.4.1
* исправлена проблема при которой не отвязывалась единственная переменная от конфигурации
* исправлена проблема при которой версия конфига сохраняется с некорректным временем (бралось текущее время, а не время обновления конфига)
* обновлены зависимости
## v3.4.0
* добавлено поле `metrics_autodiscovery` в таблицу `isp_config_service__backend`
* реализован внутренний метод `/internal/metrics/autodiscovery`, формирующий конфигурацию для `HTTP-based service discovery` механизма `Prometheus`
* обновлены зависимости
## v3.3.1
* добавлен скрипт для сборки и публикации образа в `GitHub Contaier Registry`
* обновлены зависимости
## v3.3.0
* обновлены зависимости
* добавлен новый эндпоинт `config/config/update_config_name` для изменения названия конфигурации без повышения версии и рассылки события
* теперь эндпоинт `config/config/get_all_version` первым элементом возвращает актуальную версию конфигурации
* добавлен новый эндпоинт `/config/config/sync` для синхронизации актуальной конфигурации пришедшего модуля
* добавлена оптимизация в `config/config/create_update_config`: если в запросе `data` и `name` не отличаются от текущей версии конфигурации, то событие логируется на уровне `info` без обновления конфигурации; возвращается текущая версия конфигурации
## v3.2.0
* добавлена поддержка переменных в конфигурациях
## v3.1.2
* возвращена поддержка rqlite.DiscoMode `dns` и `dns-srv`
* добавлена поддержка работы в `kubernetes` c autodiscovery
## v3.1.1
* инструмент миграции перенесен внутрь контейнера
## v3.1.0
* добавлено возможность анонсировать несколько бекендов с одинаковыми адресами
* реализован механизм поиска и очистки фантомных бекендов (те который отключились, но остались висеть в таблице маршрутизации)
* добавлена очистка таблицы маршрутизации в момент отключения самого модуля
## v3.0.2
* Новая реализация модуля на базе rqlite
+12
View File
@@ -0,0 +1,12 @@
db:
host: 127.0.0.1
port: 5432
database: test
username: test
password: test
schema: config_service
newConfigService:
address: http://127.0.0.1:9001/
username: default
password: test
+43
View File
@@ -0,0 +1,43 @@
package main
import (
"time"
"github.com/txix-open/isp-kit/json"
)
type Module struct {
Id string
Name string
LastConnectedAt *time.Time
LastDisconnectedAt *time.Time
CreatedAt time.Time
}
type Config struct {
Id string
ModuleId string
Name string
Version int
Active bool
Data json.RawMessage
CreatedAt time.Time
UpdatedAt time.Time
}
type ConfigHistory struct {
Id string
ConfigId string
ConfigVersion int
Data json.RawMessage
CreatedAt time.Time
}
type ConfigSchema struct {
Id string
ModuleId string
Version string
Schema json.RawMessage
CreatedAt time.Time
UpdatedAt time.Time
}
+78
View File
@@ -0,0 +1,78 @@
module isp-config-service/migrate
go 1.27
replace isp-config-service => ../..
require (
github.com/jmoiron/sqlx v1.4.0
github.com/mattn/go-sqlite3 v1.14.47
github.com/pressly/goose/v3 v3.30.1
github.com/txix-open/isp-kit v1.76.0
isp-config-service v0.0.0-00010101000000-000000000000
)
require (
github.com/Masterminds/squirrel v1.5.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coder/websocket v1.8.15 // indirect
github.com/gabriel-vasile/mimetype v1.4.16 // indirect
github.com/go-logr/logr v1.4.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.2 // indirect
github.com/go-playground/universal-translator v0.18.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.13.0 // indirect
github.com/jackc/puddle/v2 v2.2.4 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.20.4 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.5.0 // indirect
github.com/mfridman/interpolate v0.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pandatix/go-abnf v0.5.5 // indirect
github.com/prometheus/client_golang v1.25.0 // indirect
github.com/prometheus/client_model v0.6.3 // indirect
github.com/prometheus/common v0.74.0 // indirect
github.com/prometheus/procfs v0.23.0 // indirect
github.com/sethvargo/go-retry v0.5.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/txix-open/bellows v1.2.0 // indirect
github.com/txix-open/etp/v4 v4.1.3 // indirect
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0 // indirect
go.opentelemetry.io/otel v1.47.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 // indirect
go.opentelemetry.io/otel/log v1.47.0 // indirect
go.opentelemetry.io/otel/metric v1.47.0 // indirect
go.opentelemetry.io/otel/sdk v1.47.0 // indirect
go.opentelemetry.io/otel/trace v1.47.0 // indirect
go.opentelemetry.io/proto/otlp v1.11.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.28.0 // indirect
golang.org/x/crypto v0.59.0 // indirect
golang.org/x/net v0.63.0 // indirect
golang.org/x/sync v0.25.0 // indirect
golang.org/x/sys v0.50.0 // indirect
golang.org/x/text v0.44.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20261118221215-c8830f628b3f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20261118221215-c8830f628b3f // indirect
google.golang.org/grpc v1.85.0 // indirect
google.golang.org/protobuf v1.36.12 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+216
View File
@@ -0,0 +1,216 @@
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg=
github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI=
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
github.com/gabriel-vasile/mimetype v1.4.16 h1:5izNFuvA37st1dDRAcA7TtmngBmRgiIPDmTtiEvjx1E=
github.com/gabriel-vasile/mimetype v1.4.16/go.mod h1:3oFFwxX8kTklZwzIl2aQEDZT0lKY8xH92ST88bAwba4=
github.com/getsentry/sentry-go v0.50.0 h1:gkO59rn/i0RCAXUUTflC5QVbTQGPXbaFabs2olVzc9g=
github.com/getsentry/sentry-go v0.50.0/go.mod h1:+xsDuN+SoRN/xfs1hdq78wnrE3omIZf+FCuh9FOW1C8=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.2 h1:d8UmcrM6Nip0hfGZKLGpAvZH37XB4TS0xzK9B56YNCY=
github.com/go-playground/locales v0.14.2/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.2 h1:LCsMLC9RzmbUMNUPVYD15dmcjwYAJhmX8mPZRW4rAVU=
github.com/go-playground/universal-translator v0.18.2/go.mod h1:67VZIMp5lQpDWlnStOct22q1bkdJGJqHghbOtmkawxk=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/go-sql-driver/mysql v1.10.1 h1:arlSnNLq6a5yxGxV7qg9lF4j0C+KwD6NbQyKr9QL6ME=
github.com/go-sql-driver/mysql v1.10.1/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0 h1:vzlTzzi4tHLa/JQdIE5LeXw6SEX5EVVhq/VPqKHnKOk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0/go.mod h1:FHXQZnW5pA0txiMr3jApv9uNJzZ+7mYZd+u+PPenCFU=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.13.0 h1:Hl08k64maU0nrRyVUEbwCnK6/gT0EhMrtAqBHz9/gA4=
github.com/jackc/pgx/v5 v5.13.0/go.mod h1:u2Fi6no03HCSBYE+ZVdLxbwdu3xyi2vU+K/YNJioSds=
github.com/jackc/puddle/v2 v2.2.4 h1:N6Mz6EGB9DL0bz3OEfxJ7eoOpjRHnnjpOh+G8kbLoG8=
github.com/jackc/puddle/v2 v2.2.4/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jmoiron/sqlx v1.4.0 h1:1PLqN7S1UYp5t4SrVVnt4nUVNemrDAtxlulVe+Qgm3o=
github.com/jmoiron/sqlx v1.4.0/go.mod h1:ZrZ7UsYB/weZdl2Bxg6jCRO9c3YHl8r3ahlKmRT4JLY=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI=
github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw=
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o=
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk=
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
github.com/leodido/go-urn v1.5.0 h1:pLqT2kq1zpHW/1D18QMjMpdtX7cekxqtJJjg5ANyWw0=
github.com/leodido/go-urn v1.5.0/go.mod h1:9BORnCDhdPBJNDEX+w1bJisa8yOKYi116VeO96s4ifE=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/mattn/go-sqlite3 v1.14.47 h1:jOBI62gS7nKeZv+as1oGEy0+1qISgXwH/QBlR6KbfIo=
github.com/mattn/go-sqlite3 v1.14.47/go.mod h1:6JTjA44L93a0QCyJef5YvlPoKXntQPjzWv5gtm9sB6w=
github.com/mfridman/interpolate v0.2.0 h1:HM9ID8p6CUxoMJX+fECOtGQ2Mu7TW/GIMPyu48nnvUg=
github.com/mfridman/interpolate v0.2.0/go.mod h1:8SfDy95IaPNnIokZh9mvIppmc3fGl8fx+Gu7uusuO9Q=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/ncruces/go-strftime v1.1.0 h1:vtPmPWMkb539RGV9WpWT9EwJGvrOCKvMNI4obWL47Hk=
github.com/ncruces/go-strftime v1.1.0/go.mod h1:yVaq7iwCN09vHRrKBrrflXT0M9tTMG2KmZ9Fj7xeG/g=
github.com/pandatix/go-abnf v0.5.5 h1:EXex5KkRQx4Dm6GnpAcQnIMBs9KiK0uf8p/wq+4t9PM=
github.com/pandatix/go-abnf v0.5.5/go.mod h1:AE0KD3/VNoCjGzc1gqetRKshbI4SYErXQ/8kPenR5mc=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pressly/goose/v3 v3.30.1 h1:KO28meBdbAUIdMbTP7bl9dp1FYZGXcYWb2O7miT09lE=
github.com/pressly/goose/v3 v3.30.1/go.mod h1:CHGwuG2acDerUaXwz2i5T18VSauXpYDiL4WxzDvcOIM=
github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKqbYtNOXuiK0=
github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk=
github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo=
github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM=
github.com/prometheus/common v0.74.0 h1:6iYW8MsYvmEnXFD9zLGgF0qmReaRhs3OMONu1c/nrLI=
github.com/prometheus/common v0.74.0/go.mod h1:i/02C+FCst5B1etKgWesNrD49n+onplJCqUCtUKkOeA=
github.com/prometheus/procfs v0.23.0 h1:ad+S6FTkzwaMgacKLM5h6bNKExS+DMH0YiUwXItH/o4=
github.com/prometheus/procfs v0.23.0/go.mod h1:3AVXO0FqLafyYFU/V/IQRZlC8Rgqz8Dm/x6pKLK+RIk=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/sethvargo/go-retry v0.5.0 h1:JYfFKmVJ8ER06GReN1efzc5cm52BrVsFVzmcHiKJwfY=
github.com/sethvargo/go-retry v0.5.0/go.mod h1:tvsjdKG6xfiCx4LSiUZ06kcv38xvdVQwv8R6/VnnVWg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
github.com/txix-open/etp/v4 v4.1.3 h1:u9ZyU2yKGgoQ1/DSaElhazWm8xASdqGEdWjoJ2xQlfo=
github.com/txix-open/etp/v4 v4.1.3/go.mod h1:9GK+Aje8BmLFq8Hk4j6Qb976LdU9WECCWAuLK1vAKgM=
github.com/txix-open/isp-kit v1.76.0 h1:kqhX2DuoTfeW7BIshedG26TRIfOgX0QOInm606ssGVg=
github.com/txix-open/isp-kit v1.76.0/go.mod h1:hR9iAlh3x9gEg5GfALrrkN/2SbGkgZQCmwO2GZWjC1M=
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3 h1:1jE11HLmMHDYYAcE+UmQ5VHgz4stzz0+daJbDWS+sEs=
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3/go.mod h1:Yf41v210LFyYAj+tGmDh7PHdGsTaZjdBzHG0ptUvihw=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0 h1:jva1c3z2ZFEQ5sTvnLG2tBALNehO+QvdXKQii6eKRoo=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0/go.mod h1:3pjFS5EnOVfjvYO6/NMdtJFHFQR+8uiGtrZ965nZP4w=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 h1:LxwW/9ctSCv+QkE/cLR7M91ZIkXNMqJtEMi1vCw9U8s=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0/go.mod h1:tOsftB4SslBwwErVEPaenU2RpThXWPIU8DoJHEC4dyw=
go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM=
go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 h1:julhjPeUH/q/7hinbSdDdqt5h7Zw9YWmRlWRhI0jd54=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0/go.mod h1:Ao2mz688LH/tFf0yMAenidq6k2YNSx6SIY2q6jDACck=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 h1:aXZXsZ012wOgVkqaiQv+Z/d8V0xKjmg70F6m4CE94lc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0/go.mod h1:ziu1gUIJhAaxM3EV1e3Ralk5AAyL1UOYz3lJJ4VSI38=
go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI=
go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw=
go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY=
go.opentelemetry.io/otel/metric v1.47.0/go.mod h1:ADGSXxRrXM6bjbvLo535EstVFlPpPYZm4LBKixjDHwU=
go.opentelemetry.io/otel/sdk v1.47.0 h1:zWXEr4j2lFefG87TU6Yg8a7ngfohIKFZHKp0Hf5hC6I=
go.opentelemetry.io/otel/sdk v1.47.0/go.mod h1:VUc24kiOeoGsxG8G9ULx3fWKvB7jMhnGE8Oi607lgR0=
go.opentelemetry.io/otel/sdk/metric v1.47.0 h1:lfISg2j93VT6yqdk9OfUaZmw/GfcZqCCV3jdXtsPnKw=
go.opentelemetry.io/otel/sdk/metric v1.47.0/go.mod h1:ypLp+mW1Nt2x+Szt3b5/i1syodyts49lMOwxpDI3VGw=
go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM=
go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0=
go.opentelemetry.io/proto/otlp v1.11.1 h1:SCrPqH9NE5CmBrOqpjNCiT0X5mGwMyGERXdogfR7Yjw=
go.opentelemetry.io/proto/otlp v1.11.1/go.mod h1:wq8W4aSf6bOy8RZyESOeQFr9Pu7wydWX/TY4sgvrTPg=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo=
go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q=
go.yaml.in/yaml/v2 v2.4.5 h1:a5nxWvYi94DRl6QSLlTbLpVmutgx2qg8EVjnJtuFpwI=
go.yaml.in/yaml/v2 v2.4.5/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM=
go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c=
golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U=
golang.org/x/net v0.63.0 h1:HCoTmNh9EpD1PpK8gBNFY4gcTY4N+KQEO8ylfIKqFJ0=
golang.org/x/net v0.63.0/go.mod h1:15JLg3IX1bLjHK264EZQEbIpTiR/KVLuo9CTRWd0pig=
golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs=
golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs=
golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/api v0.0.0-20261118221215-c8830f628b3f h1:7CbYDSDM5xqpq8v2tNm+Q057COf1lvA0gorVk+304tY=
google.golang.org/genproto/googleapis/api v0.0.0-20261118221215-c8830f628b3f/go.mod h1:CPxXEEQ1S9iJmInAF/8MNc8tKWnya8I8Kni9Zh2hV0M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20261118221215-c8830f628b3f h1:aDW6Vb2T1K0xbAgW+ED8iz39WlgjjX/OKiNh6tXv/+g=
google.golang.org/genproto/googleapis/rpc v0.0.0-20261118221215-c8830f628b3f/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw=
google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ=
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
modernc.org/libc v1.80.2 h1:3+a4fJZvvzg920ZC0mOepnKPGn7cqCaVeDxm/UnrM1A=
modernc.org/libc v1.80.2/go.mod h1:pvo25Rs3OJEbDqhUV9jdEGevxeLJrJeDmNid/AcQV1g=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g=
modernc.org/memory v1.12.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/sqlite v1.62.0 h1:gMaCjSM1qpl+iOjiWhR1LYP3zqrYDI+5GYLGt6veP2g=
modernc.org/sqlite v1.62.0/go.mod h1:Jzjh1mt4s0HuQ0KvtB1LIuHiGRmU2D5pgj8dUhW7/SE=
+204
View File
@@ -0,0 +1,204 @@
package main
import (
"context"
"database/sql"
"fmt"
"os"
"time"
"github.com/pressly/goose/v3"
"github.com/txix-open/isp-kit/config"
"github.com/txix-open/isp-kit/dbx"
"github.com/txix-open/isp-kit/http/httpcli"
"github.com/txix-open/isp-kit/http/httpclix"
"github.com/txix-open/isp-kit/log"
"github.com/txix-open/isp-kit/validator"
"isp-config-service/service/rqlite/goose_store"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
"github.com/txix-open/isp-kit/app"
"github.com/txix-open/isp-kit/db"
"github.com/txix-open/isp-kit/errors"
"isp-config-service/entity"
"isp-config-service/entity/xtypes"
"isp-config-service/migrate/migration"
"isp-config-service/migrations"
"isp-config-service/repository"
)
type Cfg struct {
Db dbx.Config
NewConfigService struct {
Address string
Username string
Password string
}
}
type dbClient struct {
*db.Client
}
func (d dbClient) ExecTransaction(ctx context.Context, requests [][]any) ([]sql.Result, error) {
panic("implement me")
}
func main() {
app, err := app.New(app.WithConfigOptions(
config.WithValidator(validator.Default),
config.WithExtraSource(config.NewYamlConfig("config.yml")),
))
if err != nil {
panic(err)
}
logger := app.Logger()
logger.SetLevel(log.DebugLevel)
ctx := app.Context()
cfg := Cfg{}
err = app.Config().Read(&cfg)
if err != nil {
panic(errors.WithMessage(err, "read config"))
}
pgDb, err := dbx.Open(ctx, cfg.Db, dbx.WithQueryTracer(dbx.NewLogTracer(logger)))
if err != nil {
panic(err)
}
defer pgDb.Close()
fileName := fmt.Sprintf("db_%d.sqlite", time.Now().Unix())
dbClient := dbClient{&db.Client{}}
dbClient.DB, err = sqlx.Open("sqlite3", fileName)
dbClient.DB.MapperFunc(db.ToSnakeCase)
if err != nil {
panic(errors.WithMessage(err, "err opening db"))
}
defer dbClient.Close()
migrationStore := goose_store.NewStore(dbClient.DB.DB)
mr := migration.NewRunner("", migrations.Migrations, logger)
err = mr.Run(ctx, dbClient.DB.DB, goose.WithStore(migrationStore))
if err != nil {
panic(errors.WithMessage(err, "err connecting to db"))
}
moduleRepo := repository.NewModule(dbClient)
configRepo := repository.NewConfig(dbClient)
configSchemaRepo := repository.NewConfigSchema(dbClient)
configHistoryRepo := repository.NewConfigHistory(dbClient)
logger.Info(ctx, "start modules migration")
modules := make([]Module, 0)
err = pgDb.Select(ctx, &modules, "select * from modules")
if err != nil {
panic(errors.WithMessage(err, "err selecting modules"))
}
for _, module := range modules {
result := entity.Module{
Id: module.Id,
Name: module.Name,
CreatedAt: xtypes.Time(module.CreatedAt),
}
_, _ = moduleRepo.Upsert(ctx, result)
}
logger.Info(ctx, "modules migrated")
logger.Info(ctx, "start configs migration")
configs := make([]Config, 0)
err = pgDb.Select(ctx, &configs, "select id, module_id, version, active, created_at, updated_at, data, name from configs")
if err != nil {
panic(errors.WithMessage(err, "err selecting configs"))
}
for _, config := range configs {
result := entity.Config{
Id: config.Id,
Name: config.Name,
ModuleId: config.ModuleId,
Data: config.Data,
Version: config.Version,
Active: xtypes.Bool(config.Active),
AdminId: 0,
CreatedAt: xtypes.Time(config.CreatedAt),
UpdatedAt: xtypes.Time(config.UpdatedAt),
}
err := configRepo.Insert(ctx, result)
if err != nil {
panic(errors.WithMessagef(err, "err inserting config: %s", config.Id))
}
}
logger.Info(ctx, "configs migrated")
logger.Info(ctx, "start config schemas migration")
schemas := make([]ConfigSchema, 0)
err = pgDb.Select(ctx, &schemas, "select * from config_schemas")
if err != nil {
panic(errors.WithMessage(err, "err selecting schemas"))
}
for _, schema := range schemas {
result := entity.ConfigSchema{
Id: schema.Id,
ModuleId: schema.ModuleId,
Data: schema.Schema,
ModuleVersion: schema.Version,
CreatedAt: xtypes.Time(schema.CreatedAt),
UpdatedAt: xtypes.Time(schema.UpdatedAt),
}
err := configSchemaRepo.Upsert(ctx, result)
if err != nil {
panic(errors.WithMessagef(err, "err upserting config_schema: %s", schema.Id))
}
}
logger.Info(ctx, "config schemas migrated")
logger.Info(ctx, "start config history migration")
configHistories := make([]ConfigHistory, 0)
err = pgDb.Select(ctx, &configHistories, "select * from version_config")
if err != nil {
panic(errors.WithMessage(err, "err selecting configs"))
}
for _, history := range configHistories {
result := entity.ConfigHistory{
Id: history.Id,
ConfigId: history.ConfigId,
Data: history.Data,
Version: history.ConfigVersion,
AdminId: 0,
CreatedAt: xtypes.Time(history.CreatedAt),
}
err := configHistoryRepo.InsertV2(ctx, result)
if err != nil {
panic(errors.WithMessagef(err, "err inserting config_history: %s", history.Id))
}
}
logger.Info(ctx, "config history migrated")
logger.Info(ctx, "close sqlite db")
_ = dbClient.Close()
logger.Info(ctx, "loading db to isp-config-service")
sqliteFile, err := os.ReadFile(fileName)
if err != nil {
panic(errors.WithMessage(err, "err opening sqlite file"))
}
cli := httpcli.New(httpcli.WithMiddlewares(httpclix.Log(logger)))
cli.GlobalRequestConfig().BaseUrl = cfg.NewConfigService.Address
cli.GlobalRequestConfig().BasicAuth = &httpcli.BasicAuth{
Username: cfg.NewConfigService.Username,
Password: cfg.NewConfigService.Password,
}
ctx = httpclix.LogConfigToContext(ctx, false, true)
err = cli.Post("/db/load").
Header("Content-Type", "application/octet-stream").
RequestBody(sqliteFile).
StatusCodeToError().
Timeout(120 * time.Second).
DoWithoutResponse(ctx)
if err != nil {
panic(errors.WithMessage(err, "load sqlite file"))
}
logger.Info(ctx, "done!")
}
+86
View File
@@ -0,0 +1,86 @@
package migration
import (
"context"
"database/sql"
"fmt"
"io/fs"
"path/filepath"
"strings"
"time"
"github.com/pressly/goose/v3"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/log"
)
const (
DialectPostgreSQL = goose.DialectPostgres
DialectSqlite3 = goose.DialectSQLite3
DialectClickhouse = goose.DialectClickHouse
)
type Runner struct {
dialect goose.Dialect
fs fs.FS
logger log.Logger
}
func NewRunner(
dialect goose.Dialect,
fs fs.FS,
logger log.Logger,
) Runner {
return Runner{
dialect: dialect,
fs: fs,
logger: logger,
}
}
func (r Runner) Run(ctx context.Context, db *sql.DB, gooseOpts ...goose.ProviderOption) error {
ctx = log.ToContext(ctx, log.String("worker", "goose_db_migration"))
provider, err := goose.NewProvider(r.dialect, db, r.fs, gooseOpts...)
if err != nil {
return errors.WithMessage(err, "get goose provider")
}
dbVersion, err := provider.GetDBVersion(ctx)
if err != nil {
return errors.WithMessage(err, "get db version")
}
r.logger.Info(ctx, fmt.Sprintf("current db version: %d", dbVersion))
migrations, err := provider.Status(ctx)
if err != nil {
return errors.WithMessage(err, "get status migrations")
}
r.logger.Info(ctx, "print migration list")
if len(migrations) == 0 {
r.logger.Info(ctx, "no migrations")
}
for _, migration := range migrations {
appliedAt := "Pending"
if !migration.AppliedAt.IsZero() {
appliedAt = migration.AppliedAt.Format(time.RFC3339)
}
msg := fmt.Sprintf(
"migration: %s %s %s",
filepath.Base(migration.Source.Path),
strings.ToUpper(string(migration.State)),
appliedAt,
)
r.logger.Info(ctx, msg)
}
result, err := provider.Up(ctx)
if err != nil {
return errors.WithMessage(err, "apply pending migrations")
}
for _, migrationResult := range result {
r.logger.Info(ctx, fmt.Sprintf("applied migration: %s", migrationResult.String()))
}
return nil
}
+48 -27
View File
@@ -1,30 +1,51 @@
database:
address: "127.0.0.1"
schema: "config_service"
database: "isp"
port: "5432"
username: "isp"
password: "isp_password"
createSchema: true
moduleName: "config"
grpcOuterAddress:
ip: 127.0.0.1
configServiceAddress:
ip: localhost
port: 9001
grpcOuterAddress:
ip: isp-config-service
port: 9002
grpcInnerAddress:
ip: 0.0.0.0
port: 9002
moduleName: isp-config-service
ws:
rest:
port: "9001"
ip: "0.0.0.0"
grpc:
port: "9002"
ip: "0.0.0.0"
infraServerPort: 9006
metrics:
gc: true
memory: true
address:
addressConfiguration:
ip: "0.0.0.0"
port: "9551"
path: "/metrics"
logLevel: debug
maintenanceMode: false
keepConfigVersions: 64
credentials:
- username: default
password: 38kPk0upqI5j
perms: ["all"]
- username: monitor
password: monitor
perms: ["ready"]
internalClientCredential: default
rqlite:
DataPath: "data"
NodeID: 1
BootstrapExpect: 1
RaftAddr: "127.0.0.1:9008"
JoinAddrs: "127.0.0.1:9008"
FKConstraints: true
AutoVacInterval: 12h
AutoOptimizeInterval: 23h
JoinAs: default
backup:
Enable: true
Amount: 5
Interval: "24h"
ClearInterval: "168h"
Sub:
Dir: "/app/data/backups/rqlite"
Name: "backup.sqlite.gz"
metricsAutodiscovery:
enable: true
-17
View File
@@ -1,17 +0,0 @@
package conf
import (
"github.com/integration-system/isp-lib/database"
"github.com/integration-system/isp-lib/structure"
)
type Configuration struct {
Database database.DBConfiguration `valid:"required~Required"`
GrpcOuterAddress structure.AddressConfiguration `valid:"required~Required" json:"grpcOuterAddress"`
ModuleName string `valid:"required~Required"`
WS struct {
Rest structure.AddressConfiguration `valid:"required~Required"`
Grpc structure.AddressConfiguration `valid:"required~Required"`
}
Metrics structure.MetricConfiguration
}
+1
View File
@@ -0,0 +1 @@
{}
+22
View File
@@ -0,0 +1,22 @@
package conf
import (
"isp-config-service/service/rqlite"
"github.com/rqlite/rqlite/v10/auth"
"github.com/txix-open/isp-kit/bootstrap"
)
type Local struct {
ConfigServiceAddress bootstrap.ConfigServiceAddr
MaintenanceMode bool
Credentials []auth.Credential
KeepConfigVersions int
InternalClientCredential string `validate:"required"`
Rqlite Rqlite
Backup rqlite.Backup
}
type Rqlite struct {
NodeId string `validate:"required"`
}
+4
View File
@@ -0,0 +1,4 @@
package conf
type Remote struct {
}
+292
View File
@@ -0,0 +1,292 @@
//nolint:lll
package api
import (
"context"
"strconv"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc"
"github.com/txix-open/isp-kit/grpc/apierrors"
"google.golang.org/grpc/metadata"
"isp-config-service/domain"
"isp-config-service/entity"
)
type ConfigService interface {
GetActiveConfigByModuleName(ctx context.Context, moduleName string) (*domain.Config, error)
GetConfigsByModuleId(ctx context.Context, moduleId string) ([]domain.Config, error)
CreateUpdateConfig(ctx context.Context, adminId int, req domain.CreateUpdateConfigRequest) (*domain.CreateUpdateConfigResponse, error)
GetConfigById(ctx context.Context, configId string) (*domain.Config, error)
MarkConfigAsActive(ctx context.Context, configId string) error
DeleteConfig(ctx context.Context, id string) error
UpdateConfigName(ctx context.Context, req domain.UpdateConfigNameRequest) error
SyncConfig(ctx context.Context, moduleName string) error
}
type Config struct {
service ConfigService
}
func NewConfig(service ConfigService) Config {
return Config{
service: service,
}
}
// GetActiveConfigByModuleName
// @Summary Метод получения объекта конфигурации по названию модуля
// @Description Возвращает активную конфиграцию по названию модуля
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.GetByModuleNameRequest true "название модуля"
// @Success 200 {object} domain.Config
// @Failure 400 {object} apierrors.Error "`errorCode: 2001` - модуль не найден<br/>`errorCode: 2002` - конфиг не найден"
// @Failure 500 {object} apierrors.Error
// @Router /config/get_active_config_by_module_name [POST]
func (c Config) GetActiveConfigByModuleName(ctx context.Context, req domain.GetByModuleNameRequest) (*domain.Config, error) {
config, err := c.service.GetActiveConfigByModuleName(ctx, req.ModuleName)
switch {
case errors.Is(err, entity.ErrModuleNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeModuleNotFound,
"module not found",
err,
)
case errors.Is(err, entity.ErrConfigNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeConfigNotFound,
"active config not found",
err,
)
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
default:
return config, nil
}
}
// GetConfigsByModuleId
// @Summary Метод получения списка конфигураций по ID модуля
// @Description Возвращает список конфиграции по ID модуля
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.GetByModuleIdRequest true "ID модуля"
// @Success 200 {array} domain.Config
// @Failure 400 {object} apierrors.Error "если идентификатор не указан"
// @Failure 500 {object} apierrors.Error
// @Router /config/get_configs_by_module_id [POST]
func (c Config) GetConfigsByModuleId(ctx context.Context, req domain.GetByModuleIdRequest) ([]domain.Config, error) {
configs, err := c.service.GetConfigsByModuleId(ctx, req.ModuleId)
switch {
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
default:
return configs, nil
}
}
// CreateUpdateConfig
// @Summary Метод обновления конфигурации
// @Description Если конфиг с таким id существует, то обновляет данные, если нет, то добавляет данные в базу
// @Description В случае обновления рассылает всем подключенным модулям актуальную конфигурацию
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.CreateUpdateConfigRequest true "объект для сохранения"
// @Success 200 {object} domain.CreateUpdateConfigResponse
// @Failure 400 {object} apierrors.Error "`errorCode: 2003` - конфиг не соотвествует текущей схеме<br/>`errorCode: 2002` - указанного id не сущесвует<br/>`errorCode: 2004` - кто-то уже обновил конфигурацию<br/>`errorCode: 2005` - схема конфигурации не найдена<br/>"
// @Failure 500 {object} apierrors.Error
// @Router /config/create_update_config [POST]
func (c Config) CreateUpdateConfig(
ctx context.Context,
authData grpc.AuthData,
req domain.CreateUpdateConfigRequest,
) (*domain.CreateUpdateConfigResponse, error) {
adminIdValue, _ := grpc.StringFromMd("x-admin-id", metadata.MD(authData))
var adminId int
if adminIdValue != "" {
adminId, _ = strconv.Atoi(adminIdValue)
}
resp, err := c.service.CreateUpdateConfig(ctx, adminId, req)
var validationError domain.ConfigValidationError
switch {
case errors.As(err, &validationError):
details := map[string]any{}
for key, value := range validationError.Details {
details[key] = value
}
return nil, apierrors.NewBusinessError(
domain.ErrorCodeInvalidConfig,
"invalid config",
err,
).WithDetails(details)
case errors.Is(err, entity.ErrConfigNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeConfigNotFound,
"config not found",
err,
)
case errors.Is(err, entity.ErrConfigConflictUpdate):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeConfigVersionConflict,
"someone has updated the config",
err,
)
case errors.Is(err, entity.ErrSchemaNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeSchemaNotFound,
"config schema not found",
err,
)
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
default:
return resp, nil
}
}
// GetConfigById
// @Summary Метод получение конфигурации по id
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.IdRequest true "id конфигурации"
// @Success 200 {object} domain.Config
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден<br/>"
// @Failure 500 {object} apierrors.Error
// @Router /config/get_config_by_id [POST]
func (c Config) GetConfigById(ctx context.Context, req domain.IdRequest) (*domain.Config, error) {
config, err := c.service.GetConfigById(ctx, req.Id)
switch {
case errors.Is(err, entity.ErrConfigNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeConfigNotFound,
"config not found",
err,
)
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
default:
return config, nil
}
}
// MarkConfigAsActive
// @Summary Метод активации конфигурации для модуля
// @Description Активирует указанную конфигурацию и деактивирует остальные, возвращает активированную конфигурацию
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.IdRequest true "id конфигурации для изменения"
// @Success 200
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден<br/>"
// @Failure 500 {object} apierrors.Error
// @Router /config/mark_config_as_active [POST]
func (c Config) MarkConfigAsActive(ctx context.Context, identity domain.IdRequest) error {
err := c.service.MarkConfigAsActive(ctx, identity.Id)
switch {
case errors.Is(err, entity.ErrConfigNotFound):
return apierrors.NewBusinessError(
domain.ErrorCodeConfigNotFound,
"config not found",
err,
)
case err != nil:
return apierrors.NewInternalServiceError(err)
default:
return nil
}
}
// DeleteConfigs
// @Summary Метод удаления объектов конфигурации по идентификаторам
// @Description Возвращает количество удаленных модулей
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body []string true "массив идентификаторов конфигураций"
// @Success 200 {object} domain.DeleteResponse
// @Failure 400 {object} apierrors.Error "если не указан массив идентификаторов"
// @Failure 500 {object} apierrors.Error
// @Router /config/delete_config [POST]
func (c Config) DeleteConfigs(ctx context.Context, identities []string) (*domain.DeleteResponse, error) {
configId, err := getSingleId(identities)
if err != nil {
return nil, err
}
err = c.service.DeleteConfig(ctx, configId)
switch {
case errors.Is(err, entity.ErrConfigNotFoundOrActive):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeConfigNotFound,
"config not found or is active",
err,
)
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
default:
return &domain.DeleteResponse{
Deleted: 1,
}, nil
}
}
// UpdateConfigName
// @Summary Метод переименования объекта конфигурации
// @Description Изменеяет название конфигурации без повышения версии и без рассылки события
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.UpdateConfigNameRequest true "id конфигурации и новое название"
// @Success 200
// @Failure 400 {object} apierrors.Error "`errorCode: 2002` - конфиг не найден<br/>"
// @Failure 500 {object} apierrors.Error
// @Router /config/update_config_name [POST]
func (c Config) UpdateConfigName(ctx context.Context, req domain.UpdateConfigNameRequest) error {
err := c.service.UpdateConfigName(ctx, req)
switch {
case errors.Is(err, entity.ErrConfigNotFound):
return apierrors.NewBusinessError(
domain.ErrorCodeConfigNotFound,
"config not found",
err,
)
case err != nil:
return apierrors.NewInternalServiceError(err)
default:
return nil
}
}
// SyncConfig
// @Summary Метод синхронизации актуальной конфигурации пришедешего модуля
// @Description Метод синхронизации актуальной конфигурации пришедешего модуля
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.SyncConfigRequest true "название модуля"
// @Success 200 {object} domain.Config
// @Failure 400 {object} apierrors.Error "`errorCode: 2001` - модуль не найден<br/>`errorCode: 2002` - конфиг не найден"
// @Failure 500 {object} apierrors.Error
// @Router /config/sync_config [POST]
func (c Config) SyncConfig(ctx context.Context, req domain.SyncConfigRequest) error {
err := c.service.SyncConfig(ctx, req.ModuleName)
switch {
case errors.Is(err, entity.ErrModuleNotFound):
return apierrors.NewBusinessError(
domain.ErrorCodeModuleNotFound,
"module not found",
err,
)
case err != nil:
return apierrors.NewInternalServiceError(err)
default:
return nil
}
}
+102
View File
@@ -0,0 +1,102 @@
package api
import (
"context"
"isp-config-service/domain"
"isp-config-service/entity"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc/apierrors"
)
type ConfigHistoryService interface {
GetAllVersions(ctx context.Context, configId string) ([]domain.ConfigVersion, error)
Delete(ctx context.Context, id string) error
Purge(ctx context.Context, moduleName string, keepVersions int) (map[string]int, error)
}
type ConfigHistory struct {
service ConfigHistoryService
}
func NewConfigHistory(service ConfigHistoryService) ConfigHistory {
return ConfigHistory{
service: service,
}
}
// GetAllVersion
// @Summary Метод получение старых версий конфигурации
// @Description Возвращает предыдущие версии конфигураций
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.IdRequest true "id конфигурации"
// @Success 200 {array} domain.ConfigVersion
// @Failure 400 {object} apierrors.Error "если не указан массив идентификаторов"
// @Failure 500 {object} apierrors.Error
// @Router /config/get_all_version [POST]
func (c ConfigHistory) GetAllVersion(ctx context.Context, req domain.IdRequest) ([]domain.ConfigVersion, error) {
versions, err := c.service.GetAllVersions(ctx, req.Id)
switch {
case errors.Is(err, entity.ErrConfigNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeConfigNotFound,
"config not found",
err,
)
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
default:
return versions, nil
}
}
// DeleteConfigVersion
// @Summary Метод удаления версии конфигурации
// @Description Возвращает количество удаленных версий
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.IdRequest true "id версии конфигурации"
// @Success 200 {object} domain.DeleteResponse
// @Failure 400 {object} apierrors.Error "не указан массив идентификаторов"
// @Failure 500 {object} apierrors.Error
// @Router /config/delete_version [POST]
func (c ConfigHistory) DeleteConfigVersion(ctx context.Context, req domain.IdRequest) (*domain.DeleteResponse, error) {
err := c.service.Delete(ctx, req.Id)
if err != nil {
return nil, apierrors.NewInternalServiceError(err)
}
return &domain.DeleteResponse{
Deleted: 1,
}, nil
}
// PurgeConfigVersions
// @Summary Метод удаления старых версий всех конфигураций модуля, оставляет keepVersions последних версий каждой конфигурации
// @Description Возвращает количество удаленных версий каждой конфигурации
// @Tags Конфигурация
// @Accept json
// @Produce json
// @Param body body domain.PurgeConfigVersionsRequest true "Название модуля, количество оставленных версий конфигурации"
// @Success 200 {object} map[string]int
// @Failure 400 {object} apierrors.Error "`errorCode: 2001` - модуль не найден"
// @Failure 500 {object} apierrors.Error
// @Router /config/purge_versions [POST]
func (c ConfigHistory) PurgeConfigVersions(ctx context.Context, req domain.PurgeConfigVersionsRequest) (map[string]int, error) {
result, err := c.service.Purge(ctx, req.ModuleName, req.KeepVersions)
switch {
case errors.Is(err, entity.ErrModuleNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeModuleNotFound,
"module not found",
err,
)
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
default:
return result, nil
}
}
+80
View File
@@ -0,0 +1,80 @@
package api
import (
"context"
"isp-config-service/domain"
"isp-config-service/entity"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc/apierrors"
)
type ConfigSchemaService interface {
SchemaByModuleId(ctx context.Context, moduleId string) (*domain.ConfigSchema, error)
UpdateSchemaByModuleName(ctx context.Context, request domain.UpdateSchemaRequest) error
}
type ConfigSchema struct {
service ConfigSchemaService
}
func NewConfigSchema(service ConfigSchemaService) ConfigSchema {
return ConfigSchema{
service: service,
}
}
// SchemaByModuleId
// @Summary Метод получения схемы конфигурации модуля
// @Description Возвращает текущую json схему конфигурации модуля
// @Tags Схема
// @Accept json
// @Produce json
// @Param body body domain.GetByModuleIdRequest true "идентификатор модуля"
// @Success 200 {object} domain.ConfigSchema
// @Failure 400 {object} apierrors.Error "`errorCode: 2005` - схема для модуля не найдена"
// @Failure 500 {object} apierrors.Error
// @Router /schema/get_by_module_id [POST]
func (c ConfigSchema) SchemaByModuleId(ctx context.Context, request domain.GetByModuleIdRequest) (*domain.ConfigSchema, error) {
schema, err := c.service.SchemaByModuleId(ctx, request.ModuleId)
switch {
case errors.Is(err, entity.ErrSchemaNotFound):
return nil, apierrors.NewBusinessError(
domain.ErrorCodeSchemaNotFound,
"config schema not found",
err,
)
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
default:
return schema, nil
}
}
// UpdateSchemaByModuleName
// @Summary Метод обновления схемы конфигурации модуля
// @Description Меняет схему конфигурации модуля на переданную
// @Tags Схема
// @Accept json
// @Produce json
// @Param body body domain.UpdateSchemaRequest true "название модуля и схема конфига"
// @Success 200 {object} any
// @Failure 400 {object} apierrors.Error "`errorCode: 2001` - модуль не найден"
// @Failure 500 {object} apierrors.Error
// @Router /schema/update_by_module_name [POST]
func (c ConfigSchema) UpdateSchemaByModuleName(ctx context.Context, request domain.UpdateSchemaRequest) error {
err := c.service.UpdateSchemaByModuleName(ctx, request)
switch {
case errors.Is(err, entity.ErrModuleNotFound):
return apierrors.NewBusinessError(
domain.ErrorCodeModuleNotFound,
"module not found",
err,
)
case err != nil:
return apierrors.NewInternalServiceError(err)
default:
return nil
}
}
+111
View File
@@ -0,0 +1,111 @@
package api
import (
"context"
"github.com/txix-open/isp-kit/grpc/apierrors"
"isp-config-service/domain"
)
type ModuleService interface {
Status(ctx context.Context) ([]domain.ModuleInfo, error)
Delete(ctx context.Context, id string) error
Connections(ctx context.Context) ([]domain.Connection, error)
RequiredModules(ctx context.Context) ([]domain.ModuleRelation, error)
}
type Module struct {
service ModuleService
}
func NewModule(service ModuleService) Module {
return Module{
service: service,
}
}
// Status
// @Summary Метод полчения полной информации о состоянии модулей
// @Description Возвращает полное состояние всех модулей в кластере (схема конфигурации, подключенные экземпляры)
// @Tags Модули
// @Accept json
// @Produce json
// @Success 200 {array} domain.ModuleInfo
// @Failure 500 {object} apierrors.Error
// @Router /module/get_modules_info [POST]
func (c Module) Status(ctx context.Context) ([]domain.ModuleInfo, error) {
modulesInfo, err := c.service.Status(ctx)
if err != nil {
return nil, apierrors.NewInternalServiceError(err)
}
return modulesInfo, nil
}
// DeleteModule
// @Summary Метод удаления объектов модулей по идентификаторам
// @Description Возвращает количество удаленных модулей
// @Tags Модули
// @Accept json
// @Produce json
// @Param body body []string true "массив идентификаторов модулей"
// @Success 200 {object} domain.DeleteResponse
// @Failure 500 {object} apierrors.Error
// @Router /module/delete_module [POST]
func (c Module) DeleteModule(ctx context.Context, identities []string) (*domain.DeleteResponse, error) {
id, err := getSingleId(identities)
if err != nil {
return nil, err
}
err = c.service.Delete(ctx, id)
if err != nil {
return nil, apierrors.NewInternalServiceError(err)
}
return &domain.DeleteResponse{
Deleted: len(identities),
}, nil
}
// RequiredModules
// @Summary Метод для получения зависимостей модулей
// @Description Возвращает список модулей с их зависимостями
// @Tags Модули
// @Accept json
// @Produce json
// @Success 200 {array} domain.ModuleRelation
// @Failure 500 {object} apierrors.Error
// @Router /module/get_required_modules [POST]
func (c Module) RequiredModules(ctx context.Context) ([]domain.ModuleRelation, error) {
relations, err := c.service.RequiredModules(ctx)
if err != nil {
return nil, apierrors.NewInternalServiceError(err)
}
return relations, nil
}
// Connections
// @Summary Метод получения маршрутов
// @Description Возвращает все доступные роуты
// @Tags Модули
// @Accept json
// @Produce json
// @Success 200 {array} domain.Connection
// @Failure 500 {object} apierrors.Error
// @Router /routing/get_routes [POST]
func (c Module) Connections(ctx context.Context) ([]domain.Connection, error) {
connections, err := c.service.Connections(ctx)
if err != nil {
return nil, apierrors.NewInternalServiceError(err)
}
return connections, nil
}
func getSingleId(identities []string) (string, error) {
if len(identities) == 0 {
return "", apierrors.NewBusinessError(domain.ErrorCodeBadRequest, "at least one id is required", nil)
}
if len(identities) > 1 {
return "", apierrors.NewBusinessError(domain.ErrorCodeBadRequest, "accept only single identity", nil)
}
return identities[0], nil
}
+151
View File
@@ -0,0 +1,151 @@
//nolint:lll
package api
import (
"context"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/grpc/apierrors"
_ "github.com/txix-open/isp-kit/grpc/apierrors"
"isp-config-service/domain"
"isp-config-service/entity"
)
type Service interface {
All(ctx context.Context) ([]domain.Variable, error)
GetByName(ctx context.Context, name string) (*domain.Variable, error)
Create(ctx context.Context, req domain.CreateVariableRequest) error
Update(ctx context.Context, req domain.UpdateVariableRequest) error
Upsert(ctx context.Context, req []domain.UpsertVariableRequest) error
Delete(ctx context.Context, name string) error
}
type Variable struct {
service Service
}
func NewVariable(service Service) Variable {
return Variable{
service: service,
}
}
// All
// @Summary Метод получения списка всех переменных
// @Tags Переменные
// @Accept json
// @Produce json
// @Success 200 {array} domain.Variable
// @Failure 500 {object} apierrors.Error
// @Router /variable/all [POST]
func (c Variable) All(ctx context.Context) ([]domain.Variable, error) {
return c.service.All(ctx)
}
// GetByName
// @Summary Метод получения переменной по точному совпадению имени
// @Tags Переменные
// @Accept json
// @Produce json
// @Param body body domain.VariableByNameRequest true "тело запроса"
// @Success 200 {object} domain.Variable
// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена<br/>"
// @Failure 500 {object} apierrors.Error
// @Router /variable/get_by_name [POST]
func (c Variable) GetByName(ctx context.Context, req domain.VariableByNameRequest) (*domain.Variable, error) {
v, err := c.service.GetByName(ctx, req.Name)
switch {
case errors.Is(err, entity.ErrVariableNotFound):
return nil, apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
case err != nil:
return nil, apierrors.NewInternalServiceError(err)
}
return v, nil
}
// Create
// @Summary Метод создания новой переменной
// @Description Создает новую переменную с указанным наименованием и значением
// @Tags Переменные
// @Accept json
// @Produce json
// @Param body body domain.CreateVariableRequest true "тело запроса"
// @Success 200
// @Failure 400 {object} apierrors.Error "`errorCode: 2007` - переменная с таким именем уже существует<br/>"
// @Failure 500 {object} apierrors.Error
// @Router /variable/create [POST]
func (c Variable) Create(ctx context.Context, req domain.CreateVariableRequest) error {
err := c.service.Create(ctx, req)
switch {
case errors.Is(err, entity.ErrVariableAlreadyExists):
return apierrors.NewBusinessError(domain.ErrorCodeVariableAlreadyExists, "variable with the same name already exists", err)
case err != nil:
return apierrors.NewInternalServiceError(err)
}
return nil
}
// Update
// @Summary Метод обновления переменной
// @Description Выполняет обновление переменной по ее названию
// @Tags Переменные
// @Accept json
// @Produce json
// @Param body body domain.UpdateVariableRequest true "тело запроса"
// @Success 200
// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена<br/>"
// @Failure 500 {object} apierrors.Error
// @Router /variable/update [POST]
func (c Variable) Update(ctx context.Context, req domain.UpdateVariableRequest) error {
err := c.service.Update(ctx, req)
switch {
case errors.Is(err, entity.ErrVariableNotFound):
return apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
case err != nil:
return apierrors.NewInternalServiceError(err)
}
return nil
}
// Upsert
// @Summary Метод добавления/обновления переменных
// @Description Выполняет безусловное добавление/обновление указанных в теле запроса переменных
// @Description Операция выполняется не в транзакции
// @Tags Переменные
// @Accept json
// @Produce json
// @Param body body []domain.UpsertVariableRequest true "тело запроса"
// @Success 200
// @Failure 500 {object} apierrors.Error
// @Router /variable/upsert [POST]
func (c Variable) Upsert(ctx context.Context, req []domain.UpsertVariableRequest) error {
err := c.service.Upsert(ctx, req)
if err != nil {
return apierrors.NewInternalServiceError(err)
}
return nil
}
// Delete
// @Summary Метод удаления переменной
// @Description Переменная связанная с конфигурациями, не может быть удалена
// @Tags Переменные
// @Accept json
// @Produce json
// @Param body body domain.VariableByNameRequest true "тело запроса"
// @Success 200
// @Failure 400 {object} apierrors.Error "`errorCode: 2006` - переменная по имени не найдена<br/>`errorCode: 2008` - переменная используется в конфигурациях<br/>"
// @Failure 500 {object} apierrors.Error
// @Router /variable/delete [POST]
func (c Variable) Delete(ctx context.Context, req domain.VariableByNameRequest) error {
err := c.service.Delete(ctx, req.Name)
switch {
case errors.Is(err, entity.ErrVariableNotFound):
return apierrors.NewBusinessError(domain.ErrorCodeVariableNotFound, "variable by name not found", err)
case errors.Is(err, entity.ErrVariableUsedInConfigs):
return apierrors.NewBusinessError(domain.ErrorCodeVariableUsedInConfigs, "variable used in configs", err)
case err != nil:
return apierrors.NewInternalServiceError(err)
}
return nil
}
+37
View File
@@ -0,0 +1,37 @@
package controller
import (
"context"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/http/apierrors"
"isp-config-service/domain"
)
type metricsService interface {
Autodiscovery(ctx context.Context) (domain.AutodiscoveryResponse, error)
}
type Metrics struct {
svc metricsService
}
func NewMetrics(svc metricsService) Metrics {
return Metrics{svc: svc}
}
// Autodiscovery
// @Summary Метод получения конфигурации для HTTP-based service discovery механизма Prometheus
// @Tags Метрики
// @Accept json
// @Produce json
// @Success 200 {object} domain.AutodiscoveryResponse
// @Failure 500 {object} apierrors.Error
// @Router /internal/metrics/autodiscovery [POST]
func (c Metrics) Autodiscovery(ctx context.Context) (domain.AutodiscoveryResponse, error) {
resp, err := c.svc.Autodiscovery(ctx)
if err != nil {
return nil, apierrors.NewInternalServiceError(errors.WithMessage(err, "autodiscovery"))
}
return resp, nil
}
+143
View File
@@ -0,0 +1,143 @@
package controller
import (
"context"
"github.com/txix-open/etp/v4"
"github.com/txix-open/etp/v4/msg"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/json"
"github.com/txix-open/isp-kit/log"
"isp-config-service/helpers"
)
var (
ok = []byte("ok") //nolint:gochecknoglobals
)
type ModuleService interface {
OnConnect(ctx context.Context, conn *etp.Conn, moduleName string) error
OnDisconnect(ctx context.Context, conn *etp.Conn, moduleName string, isNormalClose bool, err error) error
OnError(ctx context.Context, conn *etp.Conn, err error)
OnModuleReady(
ctx context.Context,
conn *etp.Conn,
backend cluster.BackendDeclaration,
) error
OnModuleRequirements(
ctx context.Context,
conn *etp.Conn,
requirements cluster.ModuleRequirements,
) error
OnModuleConfigSchema(
ctx context.Context,
conn *etp.Conn,
data cluster.ConfigData,
) error
}
type Module struct {
service ModuleService
logger log.Logger
}
func NewModule(service ModuleService, logger log.Logger) Module {
return Module{
service: service,
logger: logger,
}
}
func (m Module) OnConnect(conn *etp.Conn) {
ctx := conn.HttpRequest().Context()
err := conn.HttpRequest().ParseForm()
if err != nil {
m.handleError(ctx, errors.WithMessage(err, "parse form"))
_ = conn.Close()
return
}
moduleName := helpers.ModuleName(conn)
if moduleName == "" {
m.handleError(ctx, errors.New("module_name is required query param"))
_ = conn.Close()
return
}
err = m.service.OnConnect(ctx, conn, moduleName)
if err != nil {
m.handleError(ctx, errors.WithMessage(err, "handle onConnect"))
}
}
func (m Module) OnDisconnect(conn *etp.Conn, err error) {
ctx := conn.HttpRequest().Context()
handleDisconnectErr := m.service.OnDisconnect(
ctx,
conn,
helpers.ModuleName(conn),
etp.IsNormalClose(err),
err,
)
if handleDisconnectErr != nil {
m.handleError(ctx, errors.WithMessage(handleDisconnectErr, "handle onDisconnect"))
}
}
func (m Module) OnError(conn *etp.Conn, err error) {
m.service.OnError(conn.HttpRequest().Context(), conn, err)
}
func (m Module) OnModuleReady(ctx context.Context, conn *etp.Conn, event msg.Event) []byte {
backend := cluster.BackendDeclaration{}
err := json.Unmarshal(event.Data, &backend)
if err != nil {
return m.handleError(ctx, errors.WithMessage(err, "unmarshal event data"))
}
err = m.service.OnModuleReady(ctx, conn, backend)
if err != nil {
return m.handleError(ctx, errors.WithMessage(err, "handle onModuleReady"))
}
return ok
}
func (m Module) OnModuleRequirements(ctx context.Context, conn *etp.Conn, event msg.Event) []byte {
requirements := cluster.ModuleRequirements{}
err := json.Unmarshal(event.Data, &requirements)
if err != nil {
return m.handleError(ctx, errors.WithMessage(err, "unmarshal event data"))
}
err = m.service.OnModuleRequirements(ctx, conn, requirements)
if err != nil {
return m.handleError(ctx, errors.WithMessage(err, "handle onModuleRequirements"))
}
return ok
}
func (m Module) OnModuleConfigSchema(ctx context.Context, conn *etp.Conn, event msg.Event) []byte {
configData := cluster.ConfigData{}
err := json.Unmarshal(event.Data, &configData)
if err != nil {
return m.handleError(ctx, errors.WithMessage(err, "unmarshal event data"))
}
err = m.service.OnModuleConfigSchema(ctx, conn, configData)
if err != nil {
return m.handleError(ctx, errors.WithMessage(err, "handle onModuleConfigSchema"))
}
return ok
}
func (m Module) handleError(
ctx context.Context,
err error,
) []byte {
m.logger.Error(ctx, err)
return []byte(err.Error())
}
-125
View File
@@ -1,125 +0,0 @@
package controllers
import (
"fmt"
st "isp-config-service/entity"
"isp-config-service/model"
"isp-config-service/socket"
"github.com/integration-system/isp-lib/utils"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"isp-config-service/domain"
)
func GetConfigs(identities []int64) ([]st.Config, error) {
configs, err := model.ConfigRep.GetConfigs(identities)
if err != nil {
return nil, createUnknownError(err)
}
return configs, nil
}
func GetConfigByInstanceUUIDAndModuleName(request st.ModuleInstanceIdentity) (*st.Config, error) {
config, err := model.ConfigRep.GetConfigByInstanceUUIDAndModuleName(request.Uuid, request.Name)
if err != nil {
return nil, createUnknownError(err)
}
if config == nil {
return nil, status.Error(codes.NotFound, utils.ValidationError)
}
return config, nil
}
func CreateUpdateConfig(config st.Config) (*st.Config, error) {
var err error
var cfg *st.Config
if config.Id == 0 {
cfg, err = model.ConfigRep.CreateConfig(&config)
if err != nil {
return nil, err
}
} else {
configExists, err := model.ConfigRep.GetConfigById(config.Id)
if err != nil {
return nil, err
}
if configExists == nil {
validationErrors := map[string]string{
"id": fmt.Sprintf("Entity with id: %d not found", config.Id),
}
return nil, utils.CreateValidationErrorDetails(codes.NotFound, utils.ValidationError, validationErrors)
}
cfg, err = model.ConfigRep.UpdateConfig(&config)
if err != nil {
return nil, err
}
}
if cfg.Active {
moduleInstanceIdentity, err := model.ConfigRep.GetModuleNameAndInstanceUUIDByConfigId(cfg.Id)
if err != nil {
return nil, createUnknownError(err)
}
socket.SendNewConfig(moduleInstanceIdentity.Uuid, moduleInstanceIdentity.Name, cfg)
}
return cfg, nil
}
func UpdateActiveConfigByInstanceUUIDAndModuleName(configReq domain.ConfigInstanceModuleName) (*st.Config, error) {
config, err := model.ConfigRep.GetConfigByInstanceUUIDAndModuleName(configReq.InstanceUuid, configReq.ModuleName)
if err != nil || config == nil {
validationErrors := map[string]string{
"id": fmt.Sprintf("Active config for module: %s and instance uuid: %s not found",
configReq.ModuleName, configReq.InstanceUuid),
}
return nil, utils.CreateValidationErrorDetails(codes.NotFound, utils.ValidationError, validationErrors)
}
config.Data = configReq.ConfigData
return CreateUpdateConfig(*config)
}
func MarkConfigAsActive(identity domain.LongIdentitiesRequest) (*st.Config, error) {
configExists, err := model.ConfigRep.GetConfigById(identity.Id)
if err != nil {
return nil, createUnknownError(err)
}
if configExists == nil {
validationErrors := map[string]string{
"id": fmt.Sprintf("Entity with id: %d not found", identity.Id),
}
return nil, utils.CreateValidationErrorDetails(codes.NotFound, utils.ValidationError, validationErrors)
}
configExists.Active = true
configExists, err = model.ConfigRep.UpdateConfig(configExists)
if err != nil {
return nil, err
}
if configExists.Active {
moduleInstanceIdentity, err := model.ConfigRep.GetModuleNameAndInstanceUUIDByConfigId(configExists.Id)
if err != nil {
return nil, createUnknownError(err)
}
socket.SendNewConfig(moduleInstanceIdentity.Uuid, moduleInstanceIdentity.Name, configExists)
}
return configExists, nil
}
func DeleteConfig(identities []int64) (*domain.DeleteResponse, error) {
if len(identities) == 0 {
validationErrors := map[string]string{
"ids": "Required",
}
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, validationErrors)
}
count, err := model.ConfigRep.DeleteConfig(identities)
if err != nil {
return nil, createUnknownError(err)
}
return &domain.DeleteResponse{Deleted: count}, err
}
-73
View File
@@ -1,73 +0,0 @@
package controllers
import (
"fmt"
st "isp-config-service/entity"
"isp-config-service/model"
"isp-config-service/domain"
"github.com/integration-system/isp-lib/logger"
"github.com/integration-system/isp-lib/utils"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
func GetInstances(identities []int32) ([]st.Instance, error) {
instances, err := model.InstanceRep.GetInstances(identities)
if err != nil {
return nil, createUnknownError(err)
}
return instances, err
}
func CreateUpdateInstance(instance st.Instance) (*st.Instance, error) {
if instance.Id == 0 {
moduleExists, err := model.InstanceRep.GetInstanceByUuid(instance.Uuid)
if err != nil {
return nil, createUnknownError(err)
}
if moduleExists.Id != 0 {
validationErrors := map[string]string{
"name": fmt.Sprintf("Entity with uuid: %s already exists", instance.Name),
}
return nil, utils.CreateValidationErrorDetails(codes.AlreadyExists, utils.ValidationError, validationErrors)
}
instance, err = model.InstanceRep.CreateInstance(instance)
} else {
instanceExists, err := model.InstanceRep.GetInstanceById(instance.Id)
if err != nil {
return nil, createUnknownError(err)
}
if instanceExists.Id == 0 {
validationErrors := map[string]string{
"id": fmt.Sprintf("Entity with id: %d not found", instance.Id),
}
return nil, utils.CreateValidationErrorDetails(codes.NotFound, utils.ValidationError, validationErrors)
}
instance, err = model.InstanceRep.UpdateInstance(instance)
instance.CreatedAt = instanceExists.CreatedAt
}
return &instance, nil
}
func DeleteInstance(identities []int32) (*domain.DeleteResponse, error) {
if len(identities) == 0 {
validationErrors := map[string]string{
"ids": "Required",
}
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, validationErrors)
}
count, err := model.InstanceRep.DeleteInstance(identities)
if err != nil {
return nil, createUnknownError(err)
}
return &domain.DeleteResponse{Deleted: count}, err
}
func createUnknownError(err error) error {
logger.Error(err)
return status.Error(codes.Unknown, utils.ServiceError)
}
-16
View File
@@ -1,16 +0,0 @@
package controllers
/*var HandlerSwagger = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
values, err := url.ParseQuery(r.URL.RawQuery)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("Method not received"))
}
method := values.Get("method")
if method == "" {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("Method not received"))
}
proxyRequestHandle(w, r, method)
})
*/
-113
View File
@@ -1,113 +0,0 @@
package controllers
import (
"encoding/json"
"fmt"
st "isp-config-service/entity"
"isp-config-service/model"
"isp-config-service/module"
"isp-config-service/socket"
"isp-config-service/domain"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
"google.golang.org/grpc/codes"
)
func GetModules(identities []int32) ([]st.Module, error) {
modules, err := model.ModulesRep.GetModules(identities)
if err != nil {
return nil, createUnknownError(err)
}
return modules, nil
}
func GetModulesAggregatedInfo(i structure.Isolation) ([]*domain.ModuleInfo, error) {
instanceId, err := i.GetInstanceId()
if err != nil {
return nil, err
}
return module.GetAggregatedModuleInfo(instanceId)
}
func GetActiveModules() ([]st.Module, error) {
modules, err := model.ModulesRep.GetActiveModules()
if err != nil {
return nil, createUnknownError(err)
}
return modules, nil
}
func GetConnectedModules() (map[string]interface{}, error) {
modules := socket.GetRoomsCount()
bytes, err := json.Marshal(modules)
if err != nil {
return nil, createUnknownError(err)
}
var response map[string]interface{}
err = json.Unmarshal(bytes, &response)
if err != nil {
return nil, createUnknownError(err)
}
return response, nil
}
func CreateUpdateModule(module st.Module) (*st.Module, error) {
if module.Id == 0 {
instanceExists, err := model.InstanceRep.GetInstanceById(module.InstanceId)
if err != nil {
return nil, createUnknownError(err)
}
if instanceExists.Id == 0 {
validationErrors := map[string]string{
"instanceId": fmt.Sprintf("Entity with instanceId: %d not found", module.InstanceId),
}
return nil, utils.CreateValidationErrorDetails(codes.NotFound, utils.ValidationError, validationErrors)
}
moduleExists, err := model.ModulesRep.GetModuleByInstanceIdAndName(module.InstanceId, module.Name)
if err != nil {
return nil, createUnknownError(err)
}
if moduleExists.Id != 0 {
validationErrors := map[string]string{
"name": fmt.Sprintf("Entity with name: %s already exists", module.Name),
}
return nil, utils.CreateValidationErrorDetails(codes.AlreadyExists, utils.ValidationError, validationErrors)
}
module, err = model.ModulesRep.CreateModule(module)
} else {
moduleExists, err := model.ModulesRep.GetModuleById(module.Id)
if err != nil {
return nil, createUnknownError(err)
}
if moduleExists.Id == 0 {
validationErrors := map[string]string{
"id": fmt.Sprintf("Entity with id: %d not found", module.Id),
}
return nil, utils.CreateValidationErrorDetails(codes.NotFound, utils.ValidationError, validationErrors)
}
module, err = model.ModulesRep.UpdateModule(module)
module.CreatedAt = moduleExists.CreatedAt
module.Active = moduleExists.Active
}
return &module, nil
}
func DeleteModule(identities []int32) (*domain.DeleteResponse, error) {
if len(identities) == 0 {
validationErrors := map[string]string{
"ids": "Required",
}
return nil, utils.CreateValidationErrorDetails(codes.InvalidArgument, utils.ValidationError, validationErrors)
}
count, err := model.ModulesRep.DeleteModule(identities)
if err != nil {
return nil, createUnknownError(err)
}
return &domain.DeleteResponse{Deleted: count}, err
}
-20
View File
@@ -1,20 +0,0 @@
package controllers
import (
"encoding/json"
"isp-config-service/socket"
)
func GetRoutes() (map[string]interface{}, error) {
bytes, err := json.Marshal(socket.GetRoutes().Routes)
if err != nil {
return nil, createUnknownError(err)
}
var response map[string]interface{}
err = json.Unmarshal(bytes, &response)
if err != nil {
return nil, createUnknownError(err)
}
return response, nil
}
+40
View File
@@ -0,0 +1,40 @@
services:
isp-config-service-1:
image: "isp-config-service:latest"
container_name: "isp-config-service-1"
hostname: "isp-config-service-1"
restart: unless-stopped
environment:
grpcOuterAddress.ip: isp-config-service-1
rqlite.NodeID: 1
rqlite.BootstrapExpect: 3
rqlite.RaftAddr: "isp-config-service-1:4002"
rqlite.JoinAddrs: "isp-config-service-1:4002,isp-config-service-2:4002,isp-config-service-3:4002"
volumes:
- "./isp-config-service-1/data:/app/data"
isp-config-service-2:
image: "isp-config-service:latest"
container_name: "isp-config-service-2"
hostname: "isp-config-service-2"
restart: unless-stopped
environment:
grpcOuterAddress.ip: isp-config-service-2
rqlite.NodeID: 2
rqlite.BootstrapExpect: 3
rqlite.RaftAddr: "isp-config-service-2:4002"
rqlite.JoinAddrs: "isp-config-service-1:4002,isp-config-service-2:4002,isp-config-service-3:4002"
volumes:
- "./isp-config-service-2/data:/app/data"
isp-config-service-3:
image: "isp-config-service:latest"
container_name: "isp-config-service-3"
hostname: "isp-config-service-3"
restart: unless-stopped
environment:
grpcOuterAddress.ip: isp-config-service-3
rqlite.NodeID: 3
rqlite.BootstrapExpect: 3
rqlite.RaftAddr: "isp-config-service-3:4002"
rqlite.JoinAddrs: "isp-config-service-1:4002,isp-config-service-2:4002,isp-config-service-3:4002"
volumes:
- "./isp-config-service-3/data:/app/data"
+30
View File
@@ -0,0 +1,30 @@
apiVersion: v1
kind: Service
metadata:
name: isp-config-service-internal
spec:
clusterIP: None
publishNotReadyAddresses: True
selector:
app: isp-config-service
ports:
- protocol: TCP
port: 4001
targetPort: 4001
---
apiVersion: v1
kind: Service
metadata:
name: isp-config-service
spec:
selector:
app: isp-config-service
ports:
- protocol: TCP
name: ws
port: 9001
targetPort: 9001
- protocol: TCP
name: grpc
port: 9002
targetPort: 9002
+87
View File
@@ -0,0 +1,87 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: isp-config-service
spec:
selector:
matchLabels:
app: isp-config-service # has to match .spec.template.metadata.labels
serviceName: isp-config-service-internal
replicas: 3
podManagementPolicy: "Parallel"
template:
metadata:
labels:
app: isp-config-service # has to match .spec.selector.matchLabels
spec:
terminationGracePeriodSeconds: 10
imagePullSecrets:
- name: regcred
containers:
- name: isp-config-service
image: isp-config-service:latest
imagePullPolicy: Always
env:
- name: rqlite.NodeID
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: rqlite.BootstrapExpect
value: "3"
- name: rqlite.HttpAddr
value: "0.0.0.0:4001"
- name: rqlite.HttpAdv
value: "$HOSTNAME:4001"
- name: rqlite.RaftAddr
value: "0.0.0.0:4002"
- name: rqlite.RaftAdv
value: "$HOSTNAME:4002"
- name: rqlite.JoinAddrs
value: ""
- name: rqlite.DiscoMode
value: "dns"
- name: rqlite.DiscoConfig
value: "{\"name\":\"isp-config-service-internal\"}"
- name: rqlite.JoinInterval
value: "1s"
- name: rqlite.JoinAttempts
value: "120"
- name: rqlite.RaftClusterRemoveOnShutdown
value: "true"
ports:
- containerPort: 4001
name: rqlite
readinessProbe:
httpGet:
scheme: HTTP
path: /readyz
port: rqlite
httpHeaders:
- name: Authorization
value: Basic bW9uaXRvcjptb25pdG9y
periodSeconds: 5
timeoutSeconds: 2
initialDelaySeconds: 2
livenessProbe:
httpGet:
scheme: HTTP
path: /readyz?noleader
port: rqlite
httpHeaders:
- name: Authorization
value: Basic bW9uaXRvcjptb25pdG9y
initialDelaySeconds: 5
timeoutSeconds: 2
failureThreshold: 3
volumeMounts:
- name: isp-config-service-data
mountPath: /app/data
volumeClaimTemplates:
- metadata:
name: isp-config-service-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "local-path"
resources:
requests:
storage: 1Gi
+1033
View File
File diff suppressed because it is too large. Load diff
+36
View File
@@ -0,0 +1,36 @@
package domain
import (
"fmt"
"strings"
)
const (
ErrorCodeBadRequest = 400
ErrorCodeModuleNotFound = 2001
ErrorCodeConfigNotFound = 2002
ErrorCodeInvalidConfig = 2003
ErrorCodeConfigVersionConflict = 2004
ErrorCodeSchemaNotFound = 2005
ErrorCodeVariableNotFound = 2006
ErrorCodeVariableAlreadyExists = 2007
ErrorCodeVariableUsedInConfigs = 2008
)
type ConfigValidationError struct {
Details map[string]string
}
func NewConfigValidationError(details map[string]string) ConfigValidationError {
return ConfigValidationError{
Details: details,
}
}
func (e ConfigValidationError) Error() string {
descriptions := make([]string, 0, len(e.Details))
for field, err := range e.Details {
descriptions = append(descriptions, fmt.Sprintf("%s -> %s", field, err))
}
return strings.Join(descriptions, "; ")
}
+45 -8
View File
@@ -1,15 +1,52 @@
package domain
type IdentitiesRequest struct {
Ids []int32 `json:"ids" valid:"required~Required"`
import (
"github.com/txix-open/isp-kit/json"
)
type IdRequest struct {
Id string `validate:"required"`
}
type LongIdentitiesRequest struct {
Id int64 `json:"id" valid:"required~Required"`
type PurgeConfigVersionsRequest struct {
ModuleName string `validate:"required"`
KeepVersions int `validate:"required"`
}
type ConfigInstanceModuleName struct {
ModuleName string `valid:"required~Required"`
InstanceUuid string `valid:"required~Required"`
ConfigData map[string]interface{} `valid:"required~Required"`
type GetByModuleIdRequest struct {
ModuleId string `validate:"required"`
}
type GetByModuleNameRequest struct {
ModuleName string `validate:"required"`
}
type UpdateSchemaRequest struct {
ModuleName string `validate:"required"`
Schema json.RawMessage `validate:"required" swaggertype:"object"`
}
type CreateUpdateConfigRequest struct {
Id string
Name string `validate:"required"`
ModuleId string `validate:"required"`
Version int
Data json.RawMessage `swaggertype:"object"`
Unsafe bool
}
type UpdateConfigNameRequest struct {
Id string `validate:"required"`
NewConfigName string `validate:"required"`
}
type SyncConfigRequest struct {
ModuleName string `validate:"required"`
}
type PrometheusTargets struct {
Targets []string
Labels map[string]string
}
type AutodiscoveryResponse []PrometheusTargets
+73 -16
View File
@@ -3,32 +3,89 @@ package domain
import (
"time"
"isp-config-service/entity"
"github.com/integration-system/isp-lib/config/schema"
"github.com/integration-system/isp-lib/structure"
"github.com/txix-open/isp-kit/json"
)
type DeleteResponse struct {
Deleted int
}
type Connection struct {
LibVersion string
Version string
Address structure.AddressConfiguration
Endpoints []structure.EndpointConfig `json:",omitempty"`
EstablishedAt time.Time
type CreateUpdateConfigResponse struct {
Config
IsChanged bool
}
type ModuleInfo struct {
Id int32
Id string
Name string
Active bool
LastConnectedAt *time.Time
LastDisconnectedAt *time.Time
ConfigSchema json.RawMessage `swaggertype:"object"`
Status []Connection
CreatedAt time.Time
LastConnectedAt time.Time
LastDisconnectedAt time.Time
Configs []entity.Config `json:",omitempty"`
ConfigSchema *schema.Schema `json:",omitempty"`
Status []Connection `json:",omitempty"`
}
type Connection struct {
Id string
ModuleName string
LibVersion string
Version string
Address Address
IsModuleLeader bool
Transport string
Endpoints []EndpointDescriptor
EstablishedAt time.Time
}
type Address struct {
Ip string
Port string
}
type EndpointDescriptor struct {
HttpMethod string
Path string
Inner bool
}
type Config struct {
Id string
Name string
ModuleId string
Valid bool
Data json.RawMessage `swaggertype:"object"`
Version int
Active bool
CreatedAt time.Time
UpdatedAt time.Time
}
type ConfigVersion struct {
Id string
ConfigId string
ConfigVersion int
Data json.RawMessage `swaggertype:"object"`
CreatedAt time.Time
}
type ConfigSchema struct {
Id string
Version string
ModuleId string
Schema json.RawMessage `swaggertype:"object"`
CreatedAt time.Time
UpdatedAt time.Time
}
type ModuleRelation struct {
Id string
Name string
RequiredModules []RequiredModuleType
}
type RequiredModuleType struct {
Id string
Name string
}
+52
View File
@@ -0,0 +1,52 @@
package domain
import (
"time"
"isp-config-service/entity"
)
type Variable struct {
Name string
Description string
Type string
Value string
CreatedAt time.Time
UpdatedAt time.Time
ContainsInConfigs []LinkedConfig
}
type LinkedConfig struct {
Id string
ModuleId string
Name string
}
type CreateVariableRequest struct {
Name string `validate:"required"`
Description string
Type string `validate:"required,oneof=SECRET TEXT"`
Value string `validate:"required"`
}
type UpdateVariableRequest struct {
Name string `validate:"required"`
Description string
Value string `validate:"required"`
}
type UpsertVariableRequest struct {
Name string `validate:"required"`
Description string
Type string `validate:"required,oneof=SECRET TEXT"`
Value string `validate:"required"`
}
type VariableByNameRequest struct {
Name string `validate:"required"`
}
type VariableExtractionResult struct {
VariableLinks []entity.ConfigHasVariable
AbsentVariables []string
}
+28
View File
@@ -0,0 +1,28 @@
package entity
import (
"github.com/txix-open/isp-kit/cluster"
"isp-config-service/entity/xtypes"
)
// nolint: tagliatelle
type Backend struct {
WsConnectionId string `json:"ws_connection_id"`
ModuleId string `json:"module_id"`
Address string `json:"address"`
Version string `json:"version"`
LibVersion string `json:"lib_version"`
ModuleName string `json:"module_name"`
Transport string `json:"transport"`
ModuleLeaderMode string `json:"module_leader_mode"`
ConfigServiceNodeId string `json:"config_service_node_id"`
Endpoints xtypes.Json[[]cluster.EndpointDescriptor] `json:"endpoints"`
RequiredModules xtypes.Json[[]cluster.ModuleDependency] `json:"required_modules"`
CreatedAt xtypes.Time `json:"created_at"`
MetricsAutodiscovery *xtypes.Json[cluster.MetricsAutodiscovery] `json:"metrics_autodiscovery"`
}
// nolint: tagliatelle
type MetricsAdWrapper struct {
MetricsAutodiscovery xtypes.Json[cluster.MetricsAutodiscovery] `json:"metrics_autodiscovery"`
}
+33 -29
View File
@@ -1,40 +1,44 @@
// nolint: tagliatelle
package entity
import (
"encoding/json"
"github.com/integration-system/isp-lib/config/schema"
"github.com/integration-system/isp-lib/logger"
"time"
"isp-config-service/entity/xtypes"
)
type ConfigData map[string]interface{}
func (cd ConfigData) ToJSON() string {
if bytes, err := json.Marshal(cd); err == nil {
return string(bytes)
} else {
logger.Warn("Could not serialize config data to JSON", err)
return "{}"
}
type Config struct {
Id string `json:"id"`
Name string `json:"name"`
ModuleId string `json:"module_id"`
Data []byte `json:"data"`
Version int `json:"version"`
Active xtypes.Bool `json:"active"`
AdminId int `json:"admin_id"`
CreatedAt xtypes.Time `json:"created_at"`
UpdatedAt xtypes.Time `json:"updated_at"`
}
type Config struct {
Id int64 `json:"id"`
Name string `json:"name" valid:"required~Required"`
Description string `json:"description"`
ModuleId int32 `json:"moduleId" valid:"required~Required"`
Version int32 `json:"version" sql:",null"`
Active bool `json:"active" sql:",null"`
CreatedAt time.Time `json:"createdAt" sql:",null"`
UpdatedAt time.Time `json:"updatedAt" sql:",null"`
Data ConfigData `json:"data" sql:",notnull"`
type ConfigMetaWithVariable struct {
Id string `json:"id"`
Name string `json:"name"`
ModuleId string `json:"module_id"`
VariableName string `json:"variable_name"`
Active xtypes.Bool `json:"active"`
}
type ConfigHistory struct {
Id string `json:"id"`
ConfigId string `json:"config_id"`
Data []byte `json:"data"`
Version int `json:"version"`
AdminId int `json:"admin_id"`
CreatedAt xtypes.Time `json:"created_at"`
}
type ConfigSchema struct {
Id int32
Version string
ModuleId int32
Schema schema.Schema
CreatedAt time.Time
UpdatedAt time.Time
Id string `json:"id"`
ModuleId string `json:"module_id"`
Data []byte `json:"data"`
ModuleVersion string `json:"module_version"`
CreatedAt xtypes.Time `json:"created_at"`
UpdatedAt xtypes.Time `json:"updated_at"`
}
+16
View File
@@ -0,0 +1,16 @@
package entity
import (
"github.com/txix-open/isp-kit/errors"
)
var (
ErrConfigNotFound = errors.New("no active config")
ErrModuleNotFound = errors.New("module not found")
ErrSchemaNotFound = errors.New("config schema not found")
ErrConfigNotFoundOrActive = errors.New("config not found or markers as active")
ErrConfigConflictUpdate = errors.New("config conflict update")
ErrVariableNotFound = errors.New("variable not found")
ErrVariableAlreadyExists = errors.New("variable already exists")
ErrVariableUsedInConfigs = errors.New("variable used in configs")
)
+52
View File
@@ -0,0 +1,52 @@
package entity
import (
"fmt"
"isp-config-service/entity/xtypes"
)
type Event struct {
Id int `json:"id"`
Payload xtypes.Json[EventPayload] `json:"payload"`
}
func NewEvent(payload EventPayload) Event {
return Event{
Payload: xtypes.Json[EventPayload]{
Value: payload,
},
}
}
func (e Event) Key() string {
switch {
case e.Payload.Value.ConfigUpdated != nil:
return fmt.Sprintf("config_updated_%s", e.Payload.Value.ConfigUpdated.ModuleId)
case e.Payload.Value.ModuleReady != nil:
return fmt.Sprintf("module_lifecycle_%s", e.Payload.Value.ModuleReady.ModuleId)
case e.Payload.Value.ModuleDisconnected != nil:
return fmt.Sprintf("module_lifecycle_%s", e.Payload.Value.ModuleDisconnected.ModuleId)
default:
return ""
}
}
// nolint:tagliatelle
type EventPayload struct {
ConfigUpdated *PayloadConfigUpdated `json:",omitempty"`
ModuleReady *PayloadModuleReady `json:",omitempty"`
ModuleDisconnected *PayloadModuleDisconnected `json:",omitempty"`
}
type PayloadConfigUpdated struct {
ModuleId string
}
type PayloadModuleReady struct {
ModuleId string
}
type PayloadModuleDisconnected struct {
ModuleId string
}
-13
View File
@@ -1,13 +0,0 @@
package entity
import (
"time"
)
type Instance struct {
Id int32 `json:"id"`
Uuid string `json:"uuid" valid:"required~Required,uuid~must be a valid uuid"`
Name string `json:"name" valid:"required~Required"`
// CreatedAtJson utils.JSONTime `json:"createdAt" sql:"-"`
CreatedAt time.Time `json:"createdAt" sql:",null"`
}
+7 -13
View File
@@ -1,20 +1,14 @@
package entity
import (
"time"
"isp-config-service/entity/xtypes"
)
// nolint:tagliatelle
type Module struct {
Id int32 `json:"id"`
InstanceId int32 `json:"instanceId" valid:"required~Required"`
Name string `json:"name" valid:"required~Required"`
Active bool `json:"active" sql:",null"`
CreatedAt time.Time `json:"createdAt" sql:",null"`
LastConnectedAt time.Time `json:"lastConnectedAt"`
LastDisconnectedAt time.Time `json:"lastDisconnectedAt"`
}
type ModuleInstanceIdentity struct {
Name string `valid:"required~Required"`
Uuid string `valid:"required~Required,uuid~must be a valid uuid"`
Id string `json:"id"`
Name string `json:"name"`
LastConnectedAt *xtypes.Time `json:"last_connected_at"`
LastDisconnectedAt *xtypes.Time `json:"last_disconnected_at"`
CreatedAt xtypes.Time `json:"created_at"`
}
+20
View File
@@ -0,0 +1,20 @@
// nolint:tagliatelle
package entity
import (
"isp-config-service/entity/xtypes"
)
type Variable struct {
Name string `json:"name"`
Description string `json:"description"`
Type string `json:"type"`
Value string `json:"value"`
CreatedAt xtypes.Time `json:"created_at"`
UpdatedAt xtypes.Time `json:"updated_at"`
}
type ConfigHasVariable struct {
ConfigId string `json:"config_id"`
VariableName string `json:"variable_name"`
}
+23
View File
@@ -0,0 +1,23 @@
package xtypes
type Bool bool
func (l Bool) MarshalJSON() ([]byte, error) {
return l.MarshalText()
}
func (l *Bool) UnmarshalJSON(data []byte) error {
return l.UnmarshalText(data)
}
func (l Bool) MarshalText() ([]byte, error) {
if l {
return []byte("1"), nil
}
return []byte("0"), nil
}
func (l *Bool) UnmarshalText(data []byte) error {
*l = string(data) == "1"
return nil
}
+44
View File
@@ -0,0 +1,44 @@
package xtypes
import (
"strconv"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/json"
)
type Json[T any] struct {
Value T
}
func (l Json[T]) MarshalJSON() ([]byte, error) {
data, err := l.MarshalText()
if err != nil {
return nil, err
}
return []byte(strconv.Quote(string(data))), nil
}
func (l *Json[T]) UnmarshalJSON(data []byte) error {
s, err := strconv.Unquote(string(data))
if err != nil {
return errors.WithMessage(err, "unquote text")
}
return l.UnmarshalText([]byte(s))
}
func (l Json[T]) MarshalText() ([]byte, error) {
data, err := json.Marshal(l.Value)
if err != nil {
return nil, errors.WithMessage(err, "marshal json")
}
return data, nil
}
func (l *Json[T]) UnmarshalText(data []byte) error {
err := json.Unmarshal(data, &l.Value)
if err != nil {
return errors.WithMessage(err, "unmarshal json")
}
return nil
}
+36
View File
@@ -0,0 +1,36 @@
package xtypes
import (
"strconv"
"time"
"github.com/txix-open/isp-kit/errors"
)
type Time time.Time
func (l Time) MarshalJSON() ([]byte, error) {
return l.MarshalText()
}
func (l *Time) UnmarshalJSON(data []byte) error {
return l.UnmarshalText(data)
}
func (l Time) MarshalText() ([]byte, error) {
t := time.Time(l)
value := strconv.Itoa(int(t.Unix()))
return []byte(value), nil
}
func (l *Time) UnmarshalText(data []byte) error {
if string(data) == "null" {
return nil
}
value, err := strconv.Atoi(string(data))
if err != nil {
return errors.WithMessagef(err, "parse int: %s", string(data))
}
*l = Time(time.Unix(int64(value), 0))
return nil
}
-257
View File
@@ -1,257 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: proto/backend_service.proto
/*
Package isp is a generated protocol buffer package.
It is generated from these files:
proto/backend_service.proto
It has these top-level messages:
Message
*/
package isp
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "google.golang.org/genproto/googleapis/api/annotations"
import google_protobuf1 "github.com/golang/protobuf/ptypes/struct"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Message struct {
// Types that are valid to be assigned to Body:
// *Message_StructBody
// *Message_ListBody
Body isMessage_Body `protobuf_oneof:"body"`
}
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type isMessage_Body interface {
isMessage_Body()
}
type Message_StructBody struct {
StructBody *google_protobuf1.Struct `protobuf:"bytes,1,opt,name=structBody,oneof"`
}
type Message_ListBody struct {
ListBody *google_protobuf1.ListValue `protobuf:"bytes,2,opt,name=listBody,oneof"`
}
func (*Message_StructBody) isMessage_Body() {}
func (*Message_ListBody) isMessage_Body() {}
func (m *Message) GetBody() isMessage_Body {
if m != nil {
return m.Body
}
return nil
}
func (m *Message) GetStructBody() *google_protobuf1.Struct {
if x, ok := m.GetBody().(*Message_StructBody); ok {
return x.StructBody
}
return nil
}
func (m *Message) GetListBody() *google_protobuf1.ListValue {
if x, ok := m.GetBody().(*Message_ListBody); ok {
return x.ListBody
}
return nil
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*Message) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _Message_OneofMarshaler, _Message_OneofUnmarshaler, _Message_OneofSizer, []interface{}{
(*Message_StructBody)(nil),
(*Message_ListBody)(nil),
}
}
func _Message_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*Message)
// body
switch x := m.Body.(type) {
case *Message_StructBody:
b.EncodeVarint(1<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.StructBody); err != nil {
return err
}
case *Message_ListBody:
b.EncodeVarint(2<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.ListBody); err != nil {
return err
}
case nil:
default:
return fmt.Errorf("Message.Body has unexpected type %T", x)
}
return nil
}
func _Message_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*Message)
switch tag {
case 1: // body.structBody
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(google_protobuf1.Struct)
err := b.DecodeMessage(msg)
m.Body = &Message_StructBody{msg}
return true, err
case 2: // body.listBody
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
msg := new(google_protobuf1.ListValue)
err := b.DecodeMessage(msg)
m.Body = &Message_ListBody{msg}
return true, err
default:
return false, nil
}
}
func _Message_OneofSizer(msg proto.Message) (n int) {
m := msg.(*Message)
// body
switch x := m.Body.(type) {
case *Message_StructBody:
s := proto.Size(x.StructBody)
n += proto.SizeVarint(1<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case *Message_ListBody:
s := proto.Size(x.ListBody)
n += proto.SizeVarint(2<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s))
n += s
case nil:
default:
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
}
return n
}
func init() {
proto.RegisterType((*Message)(nil), "isp.Message")
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for BackendService service
type BackendServiceClient interface {
// ===== SYSTEM =====
Request(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error)
}
type backendServiceClient struct {
cc *grpc.ClientConn
}
func NewBackendServiceClient(cc *grpc.ClientConn) BackendServiceClient {
return &backendServiceClient{cc}
}
func (c *backendServiceClient) Request(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error) {
out := new(Message)
err := grpc.Invoke(ctx, "/isp.BackendService/Request", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for BackendService service
type BackendServiceServer interface {
// ===== SYSTEM =====
Request(context.Context, *Message) (*Message, error)
}
func RegisterBackendServiceServer(s *grpc.Server, srv BackendServiceServer) {
s.RegisterService(&_BackendService_serviceDesc, srv)
}
func _BackendService_Request_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Message)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(BackendServiceServer).Request(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/isp.BackendService/Request",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(BackendServiceServer).Request(ctx, req.(*Message))
}
return interceptor(ctx, in, info, handler)
}
var _BackendService_serviceDesc = grpc.ServiceDesc{
ServiceName: "isp.BackendService",
HandlerType: (*BackendServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Request",
Handler: _BackendService_Request_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "proto/backend_service.proto",
}
func init() { proto.RegisterFile("proto/backend_service.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 264 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0x28, 0xca, 0x2f,
0xc9, 0xd7, 0x4f, 0x4a, 0x4c, 0xce, 0x4e, 0xcd, 0x4b, 0x89, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c,
0x4e, 0xd5, 0x03, 0x8b, 0x0a, 0x31, 0xe7, 0x16, 0x17, 0x48, 0xc9, 0xa4, 0xe7, 0xe7, 0xa7, 0xe7,
0xa4, 0xea, 0x27, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, 0x96, 0x64, 0xe6, 0xe7,
0x15, 0x43, 0x94, 0xc0, 0x65, 0xc1, 0xbc, 0xa4, 0xd2, 0x34, 0xfd, 0xe2, 0x92, 0xa2, 0xd2, 0xe4,
0x12, 0x88, 0xac, 0x52, 0x1b, 0x23, 0x17, 0xbb, 0x6f, 0x6a, 0x71, 0x71, 0x62, 0x7a, 0xaa, 0x90,
0x25, 0x17, 0x17, 0x44, 0xce, 0x29, 0x3f, 0xa5, 0x52, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48,
0x5c, 0x0f, 0xa2, 0x5d, 0x0f, 0xa6, 0x5d, 0x2f, 0x18, 0xac, 0xc4, 0x83, 0x21, 0x08, 0x49, 0xb1,
0x90, 0x05, 0x17, 0x47, 0x4e, 0x66, 0x31, 0x44, 0x23, 0x13, 0x58, 0xa3, 0x14, 0x86, 0x46, 0x9f,
0xcc, 0xe2, 0x92, 0xb0, 0xc4, 0x9c, 0xd2, 0x54, 0x0f, 0x86, 0x20, 0xb8, 0x6a, 0x27, 0x36, 0x2e,
0x96, 0xa4, 0xfc, 0x94, 0x4a, 0x23, 0x0f, 0x2e, 0x3e, 0x27, 0x88, 0x17, 0x83, 0x21, 0x3e, 0x14,
0x32, 0xe3, 0x62, 0x0f, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0xe2, 0xd1, 0xcb, 0x2d, 0x2e,
0xd0, 0x83, 0xba, 0x53, 0x0a, 0x85, 0xa7, 0xc4, 0xdf, 0x74, 0xf9, 0xc9, 0x64, 0x26, 0x4e, 0x25,
0x16, 0x90, 0xff, 0xad, 0x18, 0xb5, 0x9c, 0xf4, 0xb9, 0xc4, 0x32, 0xf3, 0xf5, 0xd2, 0x8b, 0x0a,
0x92, 0xf5, 0x92, 0xf3, 0xf3, 0xca, 0x52, 0x8b, 0x4a, 0xa0, 0x26, 0x3a, 0x09, 0x3b, 0xa3, 0xf0,
0x03, 0x40, 0x2e, 0x0b, 0x60, 0x4c, 0x62, 0x03, 0x3b, 0xd1, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff,
0x64, 0xa9, 0x7f, 0x65, 0x6a, 0x01, 0x00, 0x00,
}
-122
View File
@@ -1,122 +0,0 @@
// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT.
// source: proto/backend_service.proto
/*
Package isp is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
*/
package isp
import (
"io"
"net/http"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/grpc-ecosystem/grpc-gateway/utilities"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/status"
)
var _ codes.Code
var _ io.Reader
var _ status.Status
var _ = runtime.String
var _ = utilities.NewDoubleArray
func request_BackendService_Request_0(ctx context.Context, marshaler runtime.Marshaler, client BackendServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq Message
var metadata runtime.ServerMetadata
if req.ContentLength > 0 {
if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
}
msg, err := client.Request(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
// RegisterBackendServiceHandlerFromEndpoint is same as RegisterBackendServiceHandler but
// automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterBackendServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) {
conn, err := grpc.Dial(endpoint, opts...)
if err != nil {
return err
}
defer func() {
if err != nil {
if cerr := conn.Close(); cerr != nil {
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
}
return
}
go func() {
<-ctx.Done()
if cerr := conn.Close(); cerr != nil {
grpclog.Printf("Failed to close conn to %s: %v", endpoint, cerr)
}
}()
}()
return RegisterBackendServiceHandler(ctx, mux, conn)
}
// RegisterBackendServiceHandler registers the http handlers for service BackendService to "mux".
// The handlers forward requests to the grpc endpoint over "conn".
func RegisterBackendServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {
return RegisterBackendServiceHandlerClient(ctx, mux, NewBackendServiceClient(conn))
}
// RegisterBackendServiceHandler registers the http handlers for service BackendService to "mux".
// The handlers forward requests to the grpc endpoint over the given implementation of "BackendServiceClient".
// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BackendServiceClient"
// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in
// "BackendServiceClient" to call the correct interceptors.
func RegisterBackendServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BackendServiceClient) error {
mux.Handle("POST", pattern_BackendService_Request_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
if cn, ok := w.(http.CloseNotifier); ok {
go func(done <-chan struct{}, closed <-chan bool) {
select {
case <-done:
case <-closed:
cancel()
}
}(ctx.Done(), cn.CloseNotify())
}
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
rctx, err := runtime.AnnotateContext(ctx, mux, req)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_BackendService_Request_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_BackendService_Request_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil
}
var (
pattern_BackendService_Request_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"api"}, ""))
)
var (
forward_BackendService_Request_0 = runtime.ForwardResponseMessage
)
+124
View File
@@ -0,0 +1,124 @@
module isp-config-service
go 1.27
replace (
github.com/armon/go-metrics => github.com/hashicorp/go-metrics v0.5.1
github.com/mattn/go-sqlite3 => github.com/rqlite/go-sqlite3 v1.48.0
)
require (
github.com/Masterminds/squirrel v1.5.4
github.com/google/uuid v1.6.0
github.com/pressly/goose/v3 v3.30.1
github.com/prometheus/client_golang v1.25.0
github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8
github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099
github.com/rqlite/rqlite/v10 v10.2.7
github.com/stretchr/testify v1.12.1
github.com/tidwall/gjson v1.18.0
github.com/txix-open/etp/v4 v4.1.3
github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60
github.com/txix-open/isp-kit v1.76.0
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/sync v0.25.0
google.golang.org/grpc v1.85.0
)
require (
github.com/armon/go-metrics v0.6.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.42.0 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.13 // indirect
github.com/aws/aws-sdk-go-v2/config v1.32.25 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.19.24 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.29 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.28 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.29 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.29 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.30 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.12 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.22 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.29 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.29 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.104.0 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.2.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.31.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.43.3 // indirect
github.com/aws/smithy-go v1.27.2 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/buger/jsonparser v1.6.1 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coder/websocket v1.8.15 // indirect
github.com/fatih/color v1.19.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.16 // indirect
github.com/getsentry/sentry-go v0.50.0 // indirect
github.com/go-faker/faker/v4 v4.12.0 // indirect
github.com/go-logr/logr v1.4.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/locales v0.14.2 // indirect
github.com/go-playground/universal-translator v0.18.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-metrics v0.6.0 // indirect
github.com/hashicorp/go-msgpack v1.1.5 // indirect
github.com/hashicorp/go-msgpack/v2 v2.1.5 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/raft v1.7.3 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.20.4 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.5.0 // indirect
github.com/mailru/easyjson v0.9.2 // indirect
github.com/mattn/go-colorable v0.1.15 // indirect
github.com/mattn/go-isatty v0.0.24 // indirect
github.com/mattn/go-sqlite3 v1.14.47 // indirect
github.com/mfridman/interpolate v0.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pandatix/go-abnf v0.5.5 // indirect
github.com/prometheus/client_model v0.6.3 // indirect
github.com/prometheus/common v0.74.0 // indirect
github.com/prometheus/procfs v0.23.0 // indirect
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 // indirect
github.com/rqlite/sql v0.0.0-20260224021119-1b2524a41372 // indirect
github.com/sethvargo/go-retry v0.5.0 // indirect
github.com/tidwall/match v1.2.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/txix-open/bellows v1.2.0 // indirect
github.com/txix-open/jsonschema v1.3.0 // indirect
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
go.etcd.io/bbolt v1.5.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0 // indirect
go.opentelemetry.io/otel v1.47.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 // indirect
go.opentelemetry.io/otel/log v1.47.0 // indirect
go.opentelemetry.io/otel/metric v1.47.0 // indirect
go.opentelemetry.io/otel/sdk v1.47.0 // indirect
go.opentelemetry.io/otel/trace v1.47.0 // indirect
go.opentelemetry.io/proto/otlp v1.11.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.28.0 // indirect
go.yaml.in/yaml/v3 v3.0.6 // indirect
golang.org/x/crypto v0.59.0 // indirect
golang.org/x/net v0.63.0 // indirect
golang.org/x/sys v0.50.0 // indirect
golang.org/x/text v0.44.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20261118221215-c8830f628b3f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20261118221215-c8830f628b3f // indirect
google.golang.org/protobuf v1.36.12 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
+398
View File
@@ -0,0 +1,398 @@
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8afzqM=
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-sdk-go-v2 v1.42.0 h1:XvXMJTkFQtpBKIWZnmr9ZEOc2InWM2yldjXEJ/bymhA=
github.com/aws/aws-sdk-go-v2 v1.42.0/go.mod h1:27+ACypSLljLAEKsCYOmrjKh83vuTRkuAe9Uv/3A4bg=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.13 h1:p1BBrg/Hhp6uK7zpejeI8QFXHJeC/mynzi04Sl03k9g=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.13/go.mod h1:8cIfkE9MDhkRZGpQ22aV6/lkYeYSozpz16Smrs5x4Ls=
github.com/aws/aws-sdk-go-v2/config v1.32.25 h1:ACCejvStYoilgwrfegSt5ZntCbPrk52qfwyNcnl3omM=
github.com/aws/aws-sdk-go-v2/config v1.32.25/go.mod h1:LJyU8sDRbXUxFn8xMJIGP+v9QYYwveNLI8a/giAOiAs=
github.com/aws/aws-sdk-go-v2/credentials v1.19.24 h1:2hQqYCV9yqyePQ9o6dCrZc/zO8U3TwPr9mIKlZnPu/I=
github.com/aws/aws-sdk-go-v2/credentials v1.19.24/go.mod h1:IDwpACtwqHLISdzfwUUNq4P9DsB/h5BLg4FwJPNfqFY=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.29 h1:r6qZHbT+wxgWO/e9vYNUEtg7lv5+UN3pRqKhLXvnArg=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.29/go.mod h1:QRnaRcTVGKPGRy8w78HMQtKUGRYcnMZAANATkeVA6Mo=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.28 h1:ez4y5o7sa0uaRI8BquYOXtZpioUPhbQEh7Igm88oV9U=
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.28/go.mod h1:TpmZOrQA12XKEpVypgBGZSQBsm1WUTndCiSnbDsbvug=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.29 h1:f3vKqSo13fhTYb+JEcXwXefZQE26I1FB5eTSniU67ko=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.29/go.mod h1:MzoLFUArKGpGD+ukmPiTPG1X5x4o6M2kq4v2dr1FiEc=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.29 h1:RdwIf/CuUsvJX3RgJagbOyotl/cxoLY4xviKuE7p2GY=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.29/go.mod h1:71wt8W2EgswdZy9Mf9KNnzxZ3TiZlv4caKghPktDOkA=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.30 h1:VTGy885W5DKBxWRUJbym9hytNaYzsyaPkCHGRRMAOhU=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.30/go.mod h1:AS0HycUvJRFvTt613AYDOgO2jzw+00cVSMny8XB3yMY=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.12 h1:ZD2+BSw9vFsNlKYIasSNt3uDbjqqXIBcM13UJv/Lx2k=
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.12/go.mod h1:Ms4zlcVBbXbiP7EVLhl+lgjvA/a7YphqQ3Ih3174EmI=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.22 h1:V51LGlOq/1VsDsHUdoklAQi7rMmx4qQubvFYAlP2254=
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.22/go.mod h1:4Pzhyz8hJOm2bepgl+NjvRx8vlUFAIIvJnZ/MkcNPpU=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.29 h1:DRebniUGZ2MqiiIVmQJ04vIXr918hubdHMnarSLEWyU=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.29/go.mod h1:LfRkPCD8YHDM2E5eTkos2UpwYeZnBcVarTa8L59bJHA=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.29 h1:hiME6pBzC7OTl9LMtlyTWBuEl1f4QBcUmFDKC7MLXtc=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.29/go.mod h1:G7RP+uhagpKtKhd1BM9N6JQqjCcGEU47K5lBVZQyRQw=
github.com/aws/aws-sdk-go-v2/service/s3 v1.104.0 h1:ta8csKy5vN91F3i5gGR85lFV0srBqySEji7Jroes6rE=
github.com/aws/aws-sdk-go-v2/service/s3 v1.104.0/go.mod h1:77ZAgynvx1txMvDG8gGWoWkO1augYDxkp9JElWFgjQU=
github.com/aws/aws-sdk-go-v2/service/signin v1.2.0 h1:3nXpRcFwRCW8n7HgO2QGy0Dc20eQNfBuUemGQhpF8m8=
github.com/aws/aws-sdk-go-v2/service/signin v1.2.0/go.mod h1:LxYujSTLPRlp2vTtcUO/+1ilrew8ytt6SvQyOgejzFQ=
github.com/aws/aws-sdk-go-v2/service/sso v1.31.3 h1:ey1XLTYXb9PcLt4535632o5kCGXNXEhNb620Dqwuylo=
github.com/aws/aws-sdk-go-v2/service/sso v1.31.3/go.mod h1:Lk7PlmoTYryQmyBG0EXqj5BcUbj3whXdU2s3yGI3EAc=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.6 h1:yLr03zQE/5Eu5l3QU0Si+xMbLMbSDF2YXsigqXngs6g=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.36.6/go.mod h1:Q5N6icH+KJZDLh+ESNwzdv6cZ6vLFF/egy3IOxWhmz4=
github.com/aws/aws-sdk-go-v2/service/sts v1.43.3 h1:VrIhKRCSK1umelSgB9RghvA9RTUYeQffyAS5ApXehNI=
github.com/aws/aws-sdk-go-v2/service/sts v1.43.3/go.mod h1:r8wkDOuLaaMFqFiYAb8dGY2A3gJCOujMc6CFOVC4Zhc=
github.com/aws/smithy-go v1.27.2 h1:y9NPmSE6am6LjEFPfqHqG/jJk7AauQvhCJONKh7kpzk=
github.com/aws/smithy-go v1.27.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/buger/jsonparser v1.6.1 h1:I0phFv0PlbLHnM7TZAVjZ2MJ2/eWRTDyuO7GLR98IEs=
github.com/buger/jsonparser v1.6.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg=
github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w=
github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE=
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
github.com/gabriel-vasile/mimetype v1.4.16 h1:5izNFuvA37st1dDRAcA7TtmngBmRgiIPDmTtiEvjx1E=
github.com/gabriel-vasile/mimetype v1.4.16/go.mod h1:3oFFwxX8kTklZwzIl2aQEDZT0lKY8xH92ST88bAwba4=
github.com/getsentry/sentry-go v0.50.0 h1:gkO59rn/i0RCAXUUTflC5QVbTQGPXbaFabs2olVzc9g=
github.com/getsentry/sentry-go v0.50.0/go.mod h1:+xsDuN+SoRN/xfs1hdq78wnrE3omIZf+FCuh9FOW1C8=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-faker/faker/v4 v4.12.0 h1:yZXxuoQjxN+C2PVgYoDSHGiD9wj6dX1/Ful4p7QQV0k=
github.com/go-faker/faker/v4 v4.12.0/go.mod h1:VFIEwWDd16EdYDLF6NJ5gAAzEp7vz5LgKgJ2iZ17Tdg=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8=
github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.2 h1:d8UmcrM6Nip0hfGZKLGpAvZH37XB4TS0xzK9B56YNCY=
github.com/go-playground/locales v0.14.2/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.2 h1:LCsMLC9RzmbUMNUPVYD15dmcjwYAJhmX8mPZRW4rAVU=
github.com/go-playground/universal-translator v0.18.2/go.mod h1:67VZIMp5lQpDWlnStOct22q1bkdJGJqHghbOtmkawxk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0 h1:vzlTzzi4tHLa/JQdIE5LeXw6SEX5EVVhq/VPqKHnKOk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.34.0/go.mod h1:FHXQZnW5pA0txiMr3jApv9uNJzZ+7mYZd+u+PPenCFU=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-metrics v0.5.1 h1:rfPwUqFU6uZXNvGl4hzjY8LEBsqFVU4si1H9/Hqck/U=
github.com/hashicorp/go-metrics v0.5.1/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE=
github.com/hashicorp/go-metrics v0.6.0 h1:+kjWqHRH2HxAocneVfB/BI6EeWUUHyPhyQZozMT8Ed4=
github.com/hashicorp/go-metrics v0.6.0/go.mod h1:0B52B5pZ7+qm5Zhzs8Fygr87isvmUgr0Zv9rmJ9qsnQ=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs=
github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4=
github.com/hashicorp/go-msgpack/v2 v2.1.5 h1:Ue879bPnutj/hXfmUk6s/jtIK90XxgiUIcXRl656T44=
github.com/hashicorp/go-msgpack/v2 v2.1.5/go.mod h1:bjCsRXpZ7NsJdk45PoCQnzRGDaK8TKm5ZnDI/9y3J4M=
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/raft v1.1.0/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM=
github.com/hashicorp/raft v1.7.3 h1:DxpEqZJysHN0wK+fviai5mFcSYsCkNpFUl1xpAW8Rbo=
github.com/hashicorp/raft v1.7.3/go.mod h1:DfvCGFxpAUPE0L4Uc8JLlTPtc3GzSbdH0MTJCLgnmJQ=
github.com/hashicorp/raft-boltdb v0.0.0-20210409134258-03c10cc3d4ea/go.mod h1:qRd6nFJYYS6Iqnc/8HcUmko2/2Gw8qTFEmxDLii6W5I=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI=
github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw=
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o=
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk=
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw=
github.com/leodido/go-urn v1.5.0 h1:pLqT2kq1zpHW/1D18QMjMpdtX7cekxqtJJjg5ANyWw0=
github.com/leodido/go-urn v1.5.0/go.mod h1:9BORnCDhdPBJNDEX+w1bJisa8yOKYi116VeO96s4ifE=
github.com/mailru/easyjson v0.9.2 h1:dX8U45hQsZpxd80nLvDGihsQ/OxlvTkVUXH2r/8cb2M=
github.com/mailru/easyjson v0.9.2/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mfridman/interpolate v0.2.0 h1:HM9ID8p6CUxoMJX+fECOtGQ2Mu7TW/GIMPyu48nnvUg=
github.com/mfridman/interpolate v0.2.0/go.mod h1:8SfDy95IaPNnIokZh9mvIppmc3fGl8fx+Gu7uusuO9Q=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/ncruces/go-strftime v1.1.0 h1:vtPmPWMkb539RGV9WpWT9EwJGvrOCKvMNI4obWL47Hk=
github.com/ncruces/go-strftime v1.1.0/go.mod h1:yVaq7iwCN09vHRrKBrrflXT0M9tTMG2KmZ9Fj7xeG/g=
github.com/pandatix/go-abnf v0.5.5 h1:EXex5KkRQx4Dm6GnpAcQnIMBs9KiK0uf8p/wq+4t9PM=
github.com/pandatix/go-abnf v0.5.5/go.mod h1:AE0KD3/VNoCjGzc1gqetRKshbI4SYErXQ/8kPenR5mc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pressly/goose/v3 v3.30.1 h1:KO28meBdbAUIdMbTP7bl9dp1FYZGXcYWb2O7miT09lE=
github.com/pressly/goose/v3 v3.30.1/go.mod h1:CHGwuG2acDerUaXwz2i5T18VSauXpYDiL4WxzDvcOIM=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKqbYtNOXuiK0=
github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo=
github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.74.0 h1:6iYW8MsYvmEnXFD9zLGgF0qmReaRhs3OMONu1c/nrLI=
github.com/prometheus/common v0.74.0/go.mod h1:i/02C+FCst5B1etKgWesNrD49n+onplJCqUCtUKkOeA=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.23.0 h1:ad+S6FTkzwaMgacKLM5h6bNKExS+DMH0YiUwXItH/o4=
github.com/prometheus/procfs v0.23.0/go.mod h1:3AVXO0FqLafyYFU/V/IQRZlC8Rgqz8Dm/x6pKLK+RIk=
github.com/rabbitmq/amqp091-go v1.17.0 h1:6KmTqrnJq93cGIE3Q3UnXgsqw6NtLu8MNfFoIbfBAIQ=
github.com/rabbitmq/amqp091-go v1.17.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/rqlite/go-sqlite3 v1.48.0 h1:3z/QU1WEFrywWvhjhLvZ+SBkaoIQZtkNcHgpCaxE1eg=
github.com/rqlite/go-sqlite3 v1.48.0/go.mod h1:XIq9SQymduohsJwPy++jWepF9QJ5gT/S3SkUivYSVZ0=
github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8 h1:BoxiqWvhprOB2isgM59s8wkgKwAoyQH66Twfmof41oE=
github.com/rqlite/gorqlite v0.0.0-20250609141355-ac86a4a1c9a8/go.mod h1:xF/KoXmrRyahPfo5L7Szb5cAAUl53dMWBh9cMruGEZg=
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48 h1:NZ62M+kT0JqhyFUMc8I4SMmfmD4NGJxhb2ePJQXjryc=
github.com/rqlite/raft-boltdb/v2 v2.0.0-20230523104317-c08e70f4de48/go.mod h1:CRnsxgy5G8fAf5J+AM0yrsSdxXHKkIYOaq2sm+Q4DYc=
github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099 h1:5cqkVLdl6sGJSY3kiF2dqaA3bD+8OS5FUdZqO0BxXLU=
github.com/rqlite/rqlite-disco-clients v0.0.0-20250205044118-8ada2b350099/go.mod h1:6SVI8KegsW9Fyu2UQ+uvw0JI5CAILRYRyiQ/OFSJPrs=
github.com/rqlite/rqlite/v10 v10.2.7 h1:fUsbbgoELw+MrKfQ9EkVrm8tA0rdVUe/bYYdtOOsnx4=
github.com/rqlite/rqlite/v10 v10.2.7/go.mod h1:iTG1rLhR0zBBWTHiN33b9o/HXVwaC71xrcdoFaUJecE=
github.com/rqlite/sql v0.0.0-20260224021119-1b2524a41372 h1:2V0y6mzmPj7vQKad76nTL7sZ/lFLj5VKvNjpa6IRxYE=
github.com/rqlite/sql v0.0.0-20260224021119-1b2524a41372/go.mod h1:ib9zVtNgRKiGuoMyUqqL5aNpk+r+++YlyiVIkclVqPg=
github.com/sethvargo/go-retry v0.5.0 h1:JYfFKmVJ8ER06GReN1efzc5cm52BrVsFVzmcHiKJwfY=
github.com/sethvargo/go-retry v0.5.0/go.mod h1:tvsjdKG6xfiCx4LSiUZ06kcv38xvdVQwv8R6/VnnVWg=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/txix-open/bellows v1.2.0 h1:CXv8nQaZtB/micraeRilYyj/gtfv+bqBgP5aPYQgjeY=
github.com/txix-open/bellows v1.2.0/go.mod h1:qbKCy+RTgD30Qpw1fyb3y3jp5Y9mGhLLxgae1l0W92o=
github.com/txix-open/etp/v4 v4.1.3 h1:u9ZyU2yKGgoQ1/DSaElhazWm8xASdqGEdWjoJ2xQlfo=
github.com/txix-open/etp/v4 v4.1.3/go.mod h1:9GK+Aje8BmLFq8Hk4j6Qb976LdU9WECCWAuLK1vAKgM=
github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60 h1:7SZ72lNU69g8eiT5rcRh1ubATZPs/J05NEIN7E47TYM=
github.com/txix-open/go-cmp v0.0.0-20240401171944-16b203530f60/go.mod h1:jzpq0uwcdGq0OSNXZ6vv6UJkCOU/fLPgeoz+KkGDYgo=
github.com/txix-open/grmq v1.12.0 h1:lSPYvwLfTL0+b0xDQmuuN6RaKS3NCEJNK9ccWpOWa8Y=
github.com/txix-open/grmq v1.12.0/go.mod h1:6m9CCTQao/HAFalu5rFOZGJ5KLEP6WzzIwj80Ml3KGE=
github.com/txix-open/isp-kit v1.76.0 h1:kqhX2DuoTfeW7BIshedG26TRIfOgX0QOInm606ssGVg=
github.com/txix-open/isp-kit v1.76.0/go.mod h1:hR9iAlh3x9gEg5GfALrrkN/2SbGkgZQCmwO2GZWjC1M=
github.com/txix-open/jsonschema v1.3.0 h1:XGuOTg22G7PdqfKypjajM20/i5FyGfFYsJKmheebKi4=
github.com/txix-open/jsonschema v1.3.0/go.mod h1:l8YDZ1nvJrw6uxWowSVOxCV/ebiMJyapffW87ZEqH00=
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3 h1:1jE11HLmMHDYYAcE+UmQ5VHgz4stzz0+daJbDWS+sEs=
github.com/txix-open/validator/v10 v10.0.0-20261027072444-85f3391fc5c3/go.mod h1:Yf41v210LFyYAj+tGmDh7PHdGsTaZjdBzHG0ptUvihw=
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.5.0 h1:S7GAl7Fxv12yohbwFfIbQCGDWbQbtDGPET4P/bD4lxU=
go.etcd.io/bbolt v1.5.0/go.mod h1:mkltfYE5aUHQxUct9N9V+Kp7aSjFqjgrhcXIS70Lrdk=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0 h1:jva1c3z2ZFEQ5sTvnLG2tBALNehO+QvdXKQii6eKRoo=
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.72.0/go.mod h1:3pjFS5EnOVfjvYO6/NMdtJFHFQR+8uiGtrZ965nZP4w=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 h1:LxwW/9ctSCv+QkE/cLR7M91ZIkXNMqJtEMi1vCw9U8s=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0/go.mod h1:tOsftB4SslBwwErVEPaenU2RpThXWPIU8DoJHEC4dyw=
go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM=
go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0 h1:julhjPeUH/q/7hinbSdDdqt5h7Zw9YWmRlWRhI0jd54=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.47.0/go.mod h1:Ao2mz688LH/tFf0yMAenidq6k2YNSx6SIY2q6jDACck=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0 h1:aXZXsZ012wOgVkqaiQv+Z/d8V0xKjmg70F6m4CE94lc=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.47.0/go.mod h1:ziu1gUIJhAaxM3EV1e3Ralk5AAyL1UOYz3lJJ4VSI38=
go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI=
go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw=
go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY=
go.opentelemetry.io/otel/metric v1.47.0/go.mod h1:ADGSXxRrXM6bjbvLo535EstVFlPpPYZm4LBKixjDHwU=
go.opentelemetry.io/otel/sdk v1.47.0 h1:zWXEr4j2lFefG87TU6Yg8a7ngfohIKFZHKp0Hf5hC6I=
go.opentelemetry.io/otel/sdk v1.47.0/go.mod h1:VUc24kiOeoGsxG8G9ULx3fWKvB7jMhnGE8Oi607lgR0=
go.opentelemetry.io/otel/sdk/metric v1.47.0 h1:lfISg2j93VT6yqdk9OfUaZmw/GfcZqCCV3jdXtsPnKw=
go.opentelemetry.io/otel/sdk/metric v1.47.0/go.mod h1:ypLp+mW1Nt2x+Szt3b5/i1syodyts49lMOwxpDI3VGw=
go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM=
go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0=
go.opentelemetry.io/proto/otlp v1.11.1 h1:SCrPqH9NE5CmBrOqpjNCiT0X5mGwMyGERXdogfR7Yjw=
go.opentelemetry.io/proto/otlp v1.11.1/go.mod h1:wq8W4aSf6bOy8RZyESOeQFr9Pu7wydWX/TY4sgvrTPg=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.28.0 h1:IZzaP1Fv73/T/pBMLk4VutPl36uNC+OSUh3JLG3FIjo=
go.uber.org/zap v1.28.0/go.mod h1:rDLpOi171uODNm/mxFcuYWxDsqWSAVkFdX4XojSKg/Q=
go.yaml.in/yaml/v2 v2.4.5 h1:a5nxWvYi94DRl6QSLlTbLpVmutgx2qg8EVjnJtuFpwI=
go.yaml.in/yaml/v2 v2.4.5/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM=
go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c=
golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.63.0 h1:HCoTmNh9EpD1PpK8gBNFY4gcTY4N+KQEO8ylfIKqFJ0=
golang.org/x/net v0.63.0/go.mod h1:15JLg3IX1bLjHK264EZQEbIpTiR/KVLuo9CTRWd0pig=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs=
golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs=
golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
golang.org/x/tools v0.0.0-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/api v0.0.0-20261118221215-c8830f628b3f h1:7CbYDSDM5xqpq8v2tNm+Q057COf1lvA0gorVk+304tY=
google.golang.org/genproto/googleapis/api v0.0.0-20261118221215-c8830f628b3f/go.mod h1:CPxXEEQ1S9iJmInAF/8MNc8tKWnya8I8Kni9Zh2hV0M=
google.golang.org/genproto/googleapis/rpc v0.0.0-20261118221215-c8830f628b3f h1:aDW6Vb2T1K0xbAgW+ED8iz39WlgjjX/OKiNh6tXv/+g=
google.golang.org/genproto/googleapis/rpc v0.0.0-20261118221215-c8830f628b3f/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw=
google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ=
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
modernc.org/libc v1.80.2 h1:3+a4fJZvvzg920ZC0mOepnKPGn7cqCaVeDxm/UnrM1A=
modernc.org/libc v1.80.2/go.mod h1:pvo25Rs3OJEbDqhUV9jdEGevxeLJrJeDmNid/AcQV1g=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g=
modernc.org/memory v1.12.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/sqlite v1.62.0 h1:gMaCjSM1qpl+iOjiWhR1LYP3zqrYDI+5GYLGt6veP2g=
modernc.org/sqlite v1.62.0/go.mod h1:Jzjh1mt4s0HuQ0KvtB1LIuHiGRmU2D5pgj8dUhW7/SE=
-58
View File
@@ -1,58 +0,0 @@
package helper
import (
"github.com/integration-system/isp-lib/structure"
"isp-config-service/controllers"
"isp-config-service/domain"
"isp-config-service/entity"
)
type Handlers struct {
// ===== INSTANCE =====
GetInstances func(identities []int32) ([]entity.Instance, error) `method:"get_instances" group:"instance" inner:"true"`
CreateUpdateInstance func(instance entity.Instance) (*entity.Instance, error) `method:"create_update_instance" group:"instance" inner:"true"`
DeleteInstance func(identities []int32) (*domain.DeleteResponse, error) `method:"delete_instance" group:"instance" inner:"true"`
// ===== MODULE =====
GetModules func(identities []int32) ([]entity.Module, error) `method:"get_modules" group:"module" inner:"true"`
GetActiveModules func() ([]entity.Module, error) `method:"get_active_modules" group:"module" inner:"true"`
GetConnectedModules func() (map[string]interface{}, error) `method:"get_connected_modules" group:"module" inner:"true"`
CreateUpdateModule func(module entity.Module) (*entity.Module, error) `method:"create_update_module" group:"module" inner:"true"`
DeleteModule func(identities []int32) (*domain.DeleteResponse, error) `method:"delete_module" group:"module" inner:"true"`
GetModulesInfo func(i structure.Isolation) ([]*domain.ModuleInfo, error) `method:"get_modules_info" group:"module" inner:"true"`
// ===== CONFIG =====
GetConfigs func(identities []int64) ([]entity.Config, error) `method:"get_configs" group:"config" inner:"true"`
GetConfigByInstanceUUIDAndModuleName func(request entity.ModuleInstanceIdentity) (*entity.Config, error) `method:"get_config_by_instance_uuid_and_module_name" group:"config" inner:"true"`
CreateUpdateConfig func(config entity.Config) (*entity.Config, error) `method:"create_update_config" group:"config" inner:"true"`
UpdateActiveConfigByInstanceUUIDAndModuleName func(config domain.ConfigInstanceModuleName) (*entity.Config, error) `method:"update_active_config_by_instance_uuid_and_module_name" group:"config" inner:"true"`
MarkConfigAsActive func(identity domain.LongIdentitiesRequest) (*entity.Config, error) `method:"mark_config_as_active" group:"config" inner:"true"`
DeleteConfig func(identities []int64) (*domain.DeleteResponse, error) `method:"delete_config" group:"config" inner:"true"`
// ===== ROUTING =====
GetRoutes func() (map[string]interface{}, error) `method:"get_routes" group:"routing" inner:"true"`
}
func GetHandlers() *Handlers {
return &Handlers{
GetInstances: controllers.GetInstances,
CreateUpdateInstance: controllers.CreateUpdateInstance,
DeleteInstance: controllers.DeleteInstance,
GetModules: controllers.GetModules,
GetActiveModules: controllers.GetActiveModules,
GetConnectedModules: controllers.GetConnectedModules,
CreateUpdateModule: controllers.CreateUpdateModule,
DeleteModule: controllers.DeleteModule,
GetModulesInfo: controllers.GetModulesAggregatedInfo,
GetConfigs: controllers.GetConfigs,
GetConfigByInstanceUUIDAndModuleName: controllers.GetConfigByInstanceUUIDAndModuleName,
CreateUpdateConfig: controllers.CreateUpdateConfig,
UpdateActiveConfigByInstanceUUIDAndModuleName: controllers.UpdateActiveConfigByInstanceUUIDAndModuleName,
MarkConfigAsActive: controllers.MarkConfigAsActive,
DeleteConfig: controllers.DeleteConfig,
GetRoutes: controllers.GetRoutes,
}
}
+33
View File
@@ -0,0 +1,33 @@
package helpers
import (
"net"
"github.com/txix-open/etp/v4"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/errors"
"github.com/txix-open/isp-kit/log"
"isp-config-service/entity"
)
func ModuleName(conn *etp.Conn) string {
return conn.HttpRequest().Form.Get("module_name")
}
func SplitAddress(backend entity.Backend) (cluster.AddressConfiguration, error) {
host, port, err := net.SplitHostPort(backend.Address)
if err != nil {
return cluster.AddressConfiguration{}, errors.WithMessagef(err, "split backend %s address: %s", backend.ModuleId, backend.Address)
}
return cluster.AddressConfiguration{
IP: host,
Port: port,
}, nil
}
func LogFields(conn *etp.Conn) []log.Field {
return []log.Field{
log.String("moduleName", ModuleName(conn)),
log.String("connId", conn.Id()),
}
}
+35 -227
View File
@@ -1,247 +1,55 @@
package main
import (
"flag"
"github.com/integration-system/isp-lib/bootstrap"
"github.com/valyala/fasthttp"
"isp-config-service/domain"
"isp-config-service/module"
"net/http"
"os"
"os/signal"
"path"
rn "runtime"
"time"
"isp-config-service/conf"
"isp-config-service/generated"
"isp-config-service/helper"
"isp-config-service/model"
"isp-config-service/socket"
"isp-config-service/routes"
"isp-config-service/service/startup"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/integration-system/isp-lib/backend"
"github.com/integration-system/isp-lib/config"
"github.com/integration-system/isp-lib/controller"
"github.com/integration-system/isp-lib/database"
"github.com/integration-system/isp-lib/logger"
"github.com/integration-system/isp-lib/metric"
"github.com/integration-system/isp-lib/structure"
"github.com/integration-system/isp-lib/utils"
"golang.org/x/net/context"
"google.golang.org/grpc"
)
const (
routerModule = "router"
converterModule = "converter"
"github.com/txix-open/isp-kit/bootstrap"
"github.com/txix-open/isp-kit/cluster"
"github.com/txix-open/isp-kit/shutdown"
)
var (
configData *conf.Configuration
echoEndpoint *string
executableFileDir string
version = "0.1.0"
date = "undefined"
version = "1.0.0"
)
func init() {
configData = config.InitConfig(&conf.Configuration{}).(*conf.Configuration)
database.InitDbWithSchema(configData.Database, configData.Database.Schema)
db := database.GetDBManager()
model.InitDbManager(db.Db)
model.SetSchema(configData.Database.Schema)
echoEndpoint = flag.String("echo_endpoint", configData.WS.Grpc.GetAddress(), "endpoint of YourService")
module.Version = version
}
// @title isp-config-service
// @version 3.0.0
// @description Модуль управления конфигурациями
// @license.name GNU GPL v3.0
// @host localhost:9000
// @BasePath /api/config
//go:generate swag init --parseDependency
//go:generate rm -f docs/swagger.json docs/docs.go
func main() {
ex, err := os.Executable()
executableFileDir = path.Dir(ex)
boot := bootstrap.New(
version,
conf.Remote{},
cluster.Endpoints(routes.EndpointDescriptors()),
cluster.GrpcTransport,
)
app := boot.App
logger := app.Logger()
startup, err := startup.New(boot)
if err != nil {
logger.Fatal(err)
boot.Fatal(err)
}
if utils.DEV {
_, filename, _, _ := rn.Caller(0)
executableFileDir = path.Dir(filename)
}
metric.InitCollectors(configData.Metrics, structure.MetricConfiguration{})
metric.InitStatusChecker("routers", checkRouters)
metric.InitStatusChecker("converters", checkConverters)
metric.InitHttpServer(configData.Metrics)
metric.GerHttpRouter().GET("/modules", handleModulesRequest)
app.AddRunners(startup)
app.AddClosers(startup.Closers()...)
createGrpcServer()
createRestServer(runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{OrigName: true, EmitDefaults: true}))
}
func checkRouters() interface{} {
result := make([]string, 0)
instances, err := model.InstanceRep.GetInstances(nil)
if err != nil {
logger.Warn(err)
}
for _, v := range instances {
list := socket.GetModuleAddressList(v.Uuid, routerModule)
for _, v := range list {
result = append(result, v.GetAddress())
}
}
return result
}
func checkConverters() interface{} {
result := make([]string, 0)
instances, err := model.InstanceRep.GetInstances(nil)
if err != nil {
logger.Warn(err)
}
for _, v := range instances {
list := socket.GetModuleAddressList(v.Uuid, converterModule)
for _, v := range list {
result = append(result, v.GetAddress())
}
}
return result
}
// newGateway returns a new gateway server which translates HTTP into gRPC.
func newGateway(ctx context.Context, opts ...runtime.ServeMuxOption) (http.Handler, error) {
mux := runtime.NewServeMux(opts...)
dialOpts := []grpc.DialOption{grpc.WithInsecure()}
err := isp.RegisterBackendServiceHandlerFromEndpoint(ctx, mux, *echoEndpoint, dialOpts)
if err != nil {
logger.Fatalf("failed to serve rest proxy: %v", err)
}
return mux, nil
}
// Start a GRPC server.
func createGrpcServer() {
// Run our server in a goroutine so that it doesn't block.
handlers := helper.GetHandlers()
addr := structure.AddressConfiguration{IP: configData.WS.Grpc.IP, Port: configData.WS.Grpc.Port}
addrOuter := structure.AddressConfiguration{IP: configData.GrpcOuterAddress.IP, Port: configData.GrpcOuterAddress.Port}
backend.StartBackendGrpcServer(addr, backend.GetDefaultService(configData.ModuleName, handlers))
enndpoints := backend.GetEndpoints(configData.ModuleName, handlers)
socket.SetBackendMethods(&structure.BackendDeclaration{
ModuleName: configData.ModuleName,
Version: version,
LibVersion: bootstrap.LibraryVersion,
Endpoints: enndpoints,
Address: addrOuter,
shutdown.On(func() {
logger.Info(app.Context(), "starting shutdown")
app.Shutdown()
logger.Info(app.Context(), "shutdown completed")
})
logger.Infof("EXPORTED MODULE METHODS: %v, module_name: %s, version: %s",
enndpoints, configData.ModuleName, version)
}
// Start a HTTP server.
func createRestServer(opts ...runtime.ServeMuxOption) {
mux := http.NewServeMux()
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
defer cancel()
// === Socket.IO ===
mux.Handle("/socket.io/", socket.Get())
// === REST ===
mux.Handle("/swagger/", controller.StaticHandler(
http.StripPrefix(
"/swagger/", http.FileServer(
http.Dir(path.Join(executableFileDir, "static", "swagger-ui"))))))
gw, err := newGateway(ctx, opts...)
err = app.Run()
if err != nil {
logger.Fatalf("failed to serve: %v", err)
}
mux.Handle("/", gw)
/*r.NotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
})*/
var wait time.Duration
flag.DurationVar(&wait, "graceful-timeout", time.Second*15,
"the duration for which the server gracefully wait for existing connections to finish - e.g. 15s or 1m")
flag.Parse()
restAddress := configData.WS.Rest.GetAddress()
logger.Infof("Serving at %s ...", restAddress)
srv := &http.Server{
Addr: restAddress,
// Good practice to set timeouts to avoid Slowloris attacks.
WriteTimeout: time.Second * 15,
ReadTimeout: time.Second * 15,
IdleTimeout: time.Second * 60,
Handler: mux, // Pass our instance of gorilla/mux in.
}
go func() {
if err := srv.ListenAndServe(); err != nil {
logger.Fatal(err)
}
}()
c := make(chan os.Signal, 1)
// We'll accept graceful shutdowns when quit via SIGINT (Ctrl+C)
// SIGKILL, SIGQUIT or SIGTERM (Ctrl+/) will not be caught.
signal.Notify(c, os.Interrupt)
// Block until we receive our signal.
<-c
// Create a deadline to wait for.
ctx, cancel = context.WithTimeout(context.Background(), wait)
defer cancel()
// Doesn't block if no connections, but will otherwise wait
// until the timeout deadline.
_ = srv.Shutdown(ctx)
// Optionally, you could run srv.Shutdown in a goroutine and block on
// <-ctx.Done() if your application should wait for other services
// to finalize based on context cancellation.
logger.Info("shutting down")
os.Exit(0)
}
func handleModulesRequest(ctx *fasthttp.RequestCtx) {
instances, err := model.InstanceRep.GetInstances(nil)
if err != nil {
logger.Warn(err)
ctx.Error("internal server error", http.StatusInternalServerError)
return
}
result := make(map[string][]*domain.ModuleInfo, len(instances))
for _, i := range instances {
info, err := module.GetAggregatedModuleInfo(i.Uuid)
if err != nil {
logger.Warn(err)
continue
}
for _, inf := range info {
inf.ConfigSchema = nil
inf.Configs = nil
for i := range inf.Status {
s := &inf.Status[i]
s.Endpoints = nil
}
}
result[i.Uuid] = info
}
if bytes, err := utils.ConvertInterfaceToBytes(result, nil); err != nil {
logger.Warn(err)
ctx.Error("internal server error", http.StatusInternalServerError)
} else {
ctx.SetStatusCode(http.StatusOK)
ctx.SetContentType("application/json; charset=utf-8")
ctx.SetBody(bytes)
boot.Fatal(err)
}
}
+33
View File
@@ -0,0 +1,33 @@
package middlewares
import (
"context"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/txix-open/isp-kit/http/httpcli"
"github.com/txix-open/isp-kit/metrics"
"isp-config-service/middlewares/sql_metrics"
)
func SqlOperationMiddleware() httpcli.Middleware {
//nolint:promlinter
sqlQueryDuration := metrics.GetOrRegister(metrics.DefaultRegistry, prometheus.NewSummaryVec(prometheus.SummaryOpts{
Subsystem: "sql",
Name: "query_duration_ms",
Help: "The latencies of sql query",
Objectives: metrics.DefaultObjectives,
}, []string{"operation"}))
return func(next httpcli.RoundTripper) httpcli.RoundTripper {
return httpcli.RoundTripperFunc(func(ctx context.Context, request *httpcli.Request) (*httpcli.Response, error) {
label := sql_metrics.OperationLabelFromContext(ctx)
now := time.Now()
resp, err := next.RoundTrip(ctx, request)
if label != "" {
duration := time.Since(now)
sqlQueryDuration.WithLabelValues(label).Observe(metrics.Milliseconds(duration))
}
return resp, err //nolint:wrapcheck
})
}
}
+20
View File
@@ -0,0 +1,20 @@
package sql_metrics
import (
"context"
)
type tracerContextKey int
const (
labelContextKey = tracerContextKey(2)
)
func OperationLabelToContext(ctx context.Context, label string) context.Context {
return context.WithValue(ctx, labelContextKey, label)
}
func OperationLabelFromContext(ctx context.Context) string {
value, _ := ctx.Value(labelContextKey).(string)
return value
}
+35
View File
@@ -0,0 +1,35 @@
package middlewares
import (
"context"
"slices"
"github.com/txix-open/etp/v4"
"github.com/txix-open/etp/v4/msg"
"github.com/txix-open/isp-kit/log"
"isp-config-service/helpers"
)
type EtpMiddleware func(next etp.Handler) etp.Handler
func EtpLogger(logger log.Logger) EtpMiddleware {
return func(next etp.Handler) etp.Handler {
return etp.HandlerFunc(func(ctx context.Context, conn *etp.Conn, event msg.Event) []byte {
fields := append(
helpers.LogFields(conn),
log.String("event", event.Name),
)
logger.Debug(ctx, "event received", fields...)
return next.Handle(ctx, conn, event)
})
}
}
//nolint:ireturn
func EtpChain(root etp.Handler, middlewares ...EtpMiddleware) etp.Handler {
for i := range slices.Backward(middlewares) {
root = middlewares[i](root)
}
return root
}
@@ -1,5 +0,0 @@
-- +goose Up
CREATE schema if NOT EXISTS "config_service";
-- +goose Down
DROP schema if EXISTS config_service CASCADE;
+81
View File
@@ -0,0 +1,81 @@
-- +goose Up
-- +goose NO TRANSACTION
create table isp_config_service__module
(
id text not null primary key,
name text not null unique,
last_connected_at integer,
last_disconnected_at integer,
created_at integer not null default (unixepoch())
);
create table isp_config_service__config
(
id text not null primary key,
name text not null,
module_id text not null,
data blob not null,
version int not null default 1,
active int not null default 0,
admin_id int not null default 0,
created_at integer not null default (unixepoch()),
updated_at integer not null default (unixepoch()),
foreign key (module_id) references isp_config_service__module (id) on delete cascade on update cascade
);
create index IX_isp_config_service__config__module_id on isp_config_service__config (module_id);
create table isp_config_service__config_history
(
id text not null primary key,
config_id text not null,
data blob not null,
version int not null default 1,
admin_id int not null default 0,
created_at integer not null default (unixepoch()),
foreign key (config_id) references isp_config_service__config (id) on delete cascade on update cascade
);
create index IX_isp_config_service__config_history__config_id on isp_config_service__config_history (config_id);
create table isp_config_service__config_schema
(
id text not null primary key,
module_id text not null unique,
data blob not null,
module_version text not null default 1,
created_at integer not null default (unixepoch()),
updated_at integer not null default (unixepoch()),
foreign key (module_id) references isp_config_service__module (id) on delete cascade on update cascade
);
create table isp_config_service__backend
(
module_id text not null,
address text not null,
version text not null,
lib_version text not null,
module_name text not null,
endpoints blob not null,
required_modules blob not null,
created_at integer not null default (unixepoch()),
updated_at integer not null default (unixepoch()),
primary key (module_id, address),
foreign key (module_id) references isp_config_service__module (id) on delete cascade on update cascade
);
create table isp_config_service__event
(
id integer,
payload blob not null,
created_at integer not null default (unixepoch()),
primary key (id)
);
-- +goose Down
drop table isp_config_service__module;
drop table isp_config_service__config;
drop table isp_config_service__config_history;
drop table isp_config_service__config_schema;
drop table isp_config_service__backend;
drop table isp_config_service__event;
@@ -0,0 +1,17 @@
-- +goose Up
-- +goose NO TRANSACTION
CREATE TABLE isp_config_service__event_autoincrement (
id integer primary key autoincrement,
payload blob not null,
created_at integer not null default (unixepoch())
);
INSERT INTO
isp_config_service__event_autoincrement (id, payload, created_at)
SELECT id, payload, created_at
FROM isp_config_service__event;
DROP TABLE isp_config_service__event;
ALTER TABLE isp_config_service__event_autoincrement RENAME TO isp_config_service__event;
-- +goose Down
@@ -0,0 +1,24 @@
-- +goose Up
-- +goose NO TRANSACTION
drop table isp_config_service__backend;
create table isp_config_service__backend
(
ws_connection_id text not null,
module_id text not null,
address text not null,
version text not null,
lib_version text not null,
module_name text not null,
config_service_node_id text not null,
endpoints blob not null,
required_modules blob not null,
created_at integer not null default (unixepoch()),
primary key (ws_connection_id),
foreign key (module_id) references isp_config_service__module (id) on delete cascade on update cascade
);
create index IX_isp_config_service__backend__module_id on isp_config_service__backend (module_id);
create index IX_isp_config_service__backend__node_id on isp_config_service__backend(config_service_node_id);
-- +goose Down
@@ -0,0 +1,26 @@
-- +goose Up
-- +goose NO TRANSACTION
create table isp_config_service__variable
(
name text primary key,
description text not null,
type text not null,
value text not null,
created_at integer not null default (unixepoch()),
updated_at integer not null default (unixepoch())
);
create table isp_config_service__config_has_variable
(
config_id text not null,
variable_name text not null,
primary key (config_id, variable_name),
foreign key (config_id) references isp_config_service__config (id) on delete cascade on update cascade,
foreign key (variable_name) references isp_config_service__variable (name)
);
create index IX_isp_config_service__config_has_variable__variable_name on isp_config_service__config_has_variable (variable_name);
-- +goose Down
drop table isp_config_service__config_has_variable;
drop table isp_config_service__variable;
@@ -0,0 +1,6 @@
-- +goose Up
-- +goose NO TRANSACTION
alter table isp_config_service__backend add column metrics_autodiscovery blob;
-- +goose Down
alter table isp_config_service__backend drop column metrics_autodiscovery;
@@ -0,0 +1,6 @@
-- +goose Up
-- +goose NO TRANSACTION
alter table isp_config_service__backend add column transport text;
-- +goose Down
alter table isp_config_service__backend drop column transport;
@@ -0,0 +1,6 @@
-- +goose Up
-- +goose NO TRANSACTION
alter table isp_config_service__backend add column module_leader_mode text;
-- +goose Down
alter table isp_config_service__backend drop column module_leader_mode;
+10
View File
@@ -0,0 +1,10 @@
package migrations
import (
"embed"
)
var (
//go:embed *
Migrations embed.FS
)
@@ -1,5 +0,0 @@
-- +goose Up
CREATE schema if NOT EXISTS "config_service";
-- +goose Down
DROP schema if EXISTS config_service CASCADE;
@@ -1,47 +0,0 @@
-- +goose Up
CREATE TABLE instances (
id serial4 NOT NULL PRIMARY KEY,
uuid UUID NOT NULL,
"name" varchar(255) NOT NULL,
created_at timestamp DEFAULT (now() at time zone 'utc') NOT NULL
);
-- +goose StatementBegin
CREATE OR REPLACE FUNCTION update_created_modified_column_date()
RETURNS TRIGGER AS
$body$
BEGIN
IF TG_OP = 'UPDATE' THEN
NEW.created_at = OLD.created_at;
NEW.updated_at = (now() at time zone 'utc');
ELSIF TG_OP = 'INSERT' THEN
NEW.updated_at = (now() at time zone 'utc');
END IF;
RETURN NEW;
END;
$body$ LANGUAGE plpgsql;
-- +goose StatementEnd
-- +goose StatementBegin
CREATE OR REPLACE FUNCTION update_created_column_date()
RETURNS TRIGGER AS
$body$
BEGIN
IF TG_OP = 'UPDATE' THEN
NEW.created_at = OLD.created_at;
ELSIF TG_OP = 'INSERT' THEN
NEW.created_at = (now() at time zone 'utc');
END IF;
RETURN NEW;
END;
$body$ LANGUAGE plpgsql;
-- +goose StatementEnd
CREATE TRIGGER update_customer_modtime BEFORE INSERT OR UPDATE ON instances
FOR EACH ROW EXECUTE PROCEDURE update_created_column_date();
ALTER TABLE instances ADD CONSTRAINT "UQ_instances_uuid" UNIQUE ("uuid");
-- +goose Down
DROP TABLE instances;
@@ -1,24 +0,0 @@
-- +goose Up
CREATE TABLE modules (
id serial4 NOT NULL PRIMARY KEY,
instance_id int4 NOT NULL,
"name" varchar(255) NOT NULL,
"active" bool DEFAULT true,
created_at timestamp DEFAULT (now() at time zone 'utc') NOT NULL,
last_connected_at timestamp,
last_disconnected_at timestamp
);
ALTER TABLE modules
ADD CONSTRAINT "FK_modules_instanceId_instances_id"
FOREIGN KEY ("instance_id") REFERENCES instances ("id")
ON DELETE CASCADE ON UPDATE CASCADE;
CREATE INDEX IX_modules_instanceId ON modules USING hash (instance_id);
CREATE TRIGGER update_customer_modtime BEFORE INSERT OR UPDATE ON modules
FOR EACH ROW EXECUTE PROCEDURE update_created_column_date();
ALTER TABLE modules ADD CONSTRAINT "UQ_modules_instanceId_name" UNIQUE ("instance_id", "name");
-- +goose Down
DROP TABLE modules;
@@ -1,70 +0,0 @@
-- +goose Up
CREATE TABLE configs (
id serial8 NOT NULL PRIMARY KEY,
module_id int4 NOT NULL,
"version" int4 NOT NULL,
"active" bool DEFAULT false,
created_at timestamp DEFAULT (now() at time zone 'utc') NOT NULL,
updated_at timestamp DEFAULT (now() at time zone 'utc') NOT NULL,
"data" jsonb NOT NULL DEFAULT '{}'
);
ALTER TABLE configs
ADD CONSTRAINT "FK_configs_moduleId_modules_id"
FOREIGN KEY ("module_id") REFERENCES modules ("id")
ON DELETE CASCADE ON UPDATE CASCADE;
CREATE INDEX IX_configs_moduleId ON configs USING hash (module_id);
-- +goose StatementBegin
CREATE OR REPLACE FUNCTION deactivate_config()
RETURNS TRIGGER AS
$body$
DECLARE
last_version integer;
BEGIN
NEW.updated_at = (now() at time zone 'utc');
IF TG_OP = 'INSERT'
THEN
EXECUTE format('
SELECT version
FROM %I.configs
WHERE module_id = ' || NEW.module_id || '
ORDER BY created_at DESC
LIMIT 1;
', TG_TABLE_SCHEMA) INTO last_version;
IF last_version IS NOT NULL
THEN
NEW.version = last_version + 1;
ELSE
NEW.version = 1;
END IF;
ELSE
NEW.version = OLD.version;
NEW.created_at = OLD.created_at;
END IF;
IF NEW.active = TRUE
THEN
EXECUTE format('
UPDATE %I.configs
SET active = FALSE,
updated_at = (now() at time zone ''utc'')
WHERE active = TRUE AND ' || NEW.id || ' != id AND module_id = ' || NEW.module_id || ';
', TG_TABLE_SCHEMA);
END IF;
RETURN NEW;
END;
$body$ LANGUAGE plpgsql;
-- +goose StatementEnd
CREATE TRIGGER "deactivate_config"
BEFORE INSERT OR UPDATE ON configs
FOR EACH ROW EXECUTE PROCEDURE deactivate_config();
CREATE TRIGGER update_config_create_time BEFORE INSERT OR UPDATE ON configs
FOR EACH ROW EXECUTE PROCEDURE update_created_column_date();
-- +goose Down
DROP TABLE configs;
DROP FUNCTION deactivate_config;
@@ -1,6 +0,0 @@
-- +goose Up
INSERT INTO instances VALUES (1, 'bf482806-0c3d-4e0d-b9d4-12c037b12d70', 'main', NULL);
SELECT setval(pg_get_serial_sequence('instances', 'id'), 2, FALSE);
-- +goose Down
DELETE FROM instances WHERE id=1
@@ -1,10 +0,0 @@
-- +goose Up
INSERT INTO modules VALUES (1, 1, 'auth', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (2, 1, 'converter', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (3, 1, 'router', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (4, 1, 'system', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (5, 1, 'admin', 't', NULL, NULL, NULL);
SELECT setval(pg_get_serial_sequence('modules', 'id'), 6, FALSE);
-- +goose Down
DELETE FROM modules WHERE id IN (1,2,3,4,5);
@@ -1,11 +0,0 @@
-- +goose Up
INSERT INTO modules VALUES (6, 1, 'user', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (7, 1, 'mobile', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (8, 1, 'awip', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (9, 1, 'mongo-backend', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (10, 1, 'sql-backend', 't', NULL, NULL, NULL);
INSERT INTO modules VALUES (11, 1, 'events', 't', NULL, NULL, NULL);
SELECT setval(pg_get_serial_sequence('modules', 'id'), 12, FALSE);
-- +goose Down
DELETE FROM modules WHERE id IN (6,7,8,9,10,11);
@@ -1,58 +0,0 @@
-- +goose Up
set migration.db_host = 'msk-pgsql.isp.mobi';
set migration.db_port = '5432';
set migration.db_dbname = 'isp-alpha';
set migration.db_user = 'isp-alpha';
set migration.db_pass = 'JxY96xLF8zfh3g8EWvSDtLUBw';
set migration.redis_host = '10.250.9.117';
set migration.redis_port = '6379';
-- auth
INSERT INTO configs VALUES (1, 1, NULL, 't', NULL, NULL, ('{"redis": {' ||
'"ip": "' || current_setting('migration.redis_host') || '", ' ||
'"port": ' || current_setting('migration.redis_port') ||
'}, "header": {"token": {"user": "X-USER-TOKEN", "device": "X-DEVICE-TOKEN", "application": "X-APPLICATION-TOKEN"}, "identity": {"user": "X-USER-IDENTITY", "device": "X-DEVICE-IDENTITY", "domain": "X-DOMAIN-IDENTITY", "system": "X-SYSTEM-IDENTITY", "service": "X-SERVICE-IDENTITY", "application": "X-APPLICATION-IDENTITY"}}, "unauthorized.html": "<HTML><BODY><H1>401 Unauthorized BAD CREDENTIALS</H1></BODY></HTML>"}')::jsonb);
-- converter
INSERT INTO configs VALUES (2, 2, NULL, 't', NULL, NULL, ('{"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9553"}}}')::jsonb);
-- router
INSERT INTO configs VALUES (3, 3, NULL, 't', NULL, NULL, ('{"database": {' ||
'"port": "' || current_setting('migration.db_port') || '", ' ||
'"schema": "admin_service", ' ||
'"address": "' || current_setting('migration.db_host') || '", ' ||
'"database": "' || current_setting('migration.db_dbname') || '", ' ||
'"password": "' || current_setting('migration.db_pass') || '", ' ||
'"username": "' || current_setting('migration.db_user') || '", ' ||
'"createSchema": true}, ' ||
'"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9554"}}' ||
'}')::jsonb);
-- system
INSERT INTO configs VALUES (4, 4, NULL, 't', NULL, NULL, ('{"db": {' ||
'"port": "' || current_setting('migration.db_port') || '", ' ||
'"schema": "system_service", ' ||
'"address": "' || current_setting('migration.db_host') || '", ' ||
'"database": "' || current_setting('migration.db_dbname') || '", ' ||
'"password": "' || current_setting('migration.db_pass') || '", ' ||
'"username": "' || current_setting('migration.db_user') || '", ' ||
'"createSchema": true}, "RedisAddress": {' ||
'"ip": "' || current_setting('migration.redis_host') || '", ' ||
'"port": "' || current_setting('migration.redis_port') || '"' ||
'}, ' ||
'"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9555"}}' ||
'}')::jsonb);
-- admin
INSERT INTO configs VALUES (5, 5, NULL, 't', NULL, NULL, ('{"database": {' ||
'"port": "' || current_setting('migration.db_port') || '", ' ||
'"schema": "admin_service", ' ||
'"address": "' || current_setting('migration.db_host') || '", ' ||
'"database": "' || current_setting('migration.db_dbname') || '", ' ||
'"password": "' || current_setting('migration.db_pass') || '", ' ||
'"username": "' || current_setting('migration.db_user') || '", ' ||
'"createSchema": true}, ' ||
'"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9557"}}' ||
'}')::jsonb);
SELECT setval(pg_get_serial_sequence('configs', 'id'), 6, FALSE);
-- +goose Down
DELETE FROM configs WHERE id IN (1,2,3,4,5)
@@ -1,127 +0,0 @@
-- +goose Up
set migration.db_host = 'msk-pgsql.isp.mobi';
set migration.db_port = '5432';
set migration.db_dbname = 'isp-alpha';
set migration.db_user = 'isp-alpha';
set migration.db_pass = 'JxY96xLF8zfh3g8EWvSDtLUBw';
set migration.redis_host = '10.250.9.117';
set migration.redis_port = '6379';
-- user
INSERT INTO configs VALUES (6, 6, NULL, 't', NULL, NULL, (format('{
"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9556"}},
"database": {
"username": "%s",
"createSchema": true,
"port": "%s",
"schema": "user_service",
"address": "%s",
"database": "%s",
"password": "%s"
},
"redisAddress": {
"ip": "%s",
"port": "%s"
},
"userTokenExpireMs": -1,
"authSmsSystemSender": "",
"authSmsTextTemplate": "Your code {{code}}",
"deviceTokenExpireMs": -1,
"authSmsShortCodeLength": 4,
"authSmsShortCodeExpireMs": 300000
}', current_setting('migration.db_user'),
current_setting('migration.db_port'),
current_setting('migration.db_host'),
current_setting('migration.db_dbname'),
current_setting('migration.db_pass'),
current_setting('migration.redis_host'),
current_setting('migration.redis_port')
)) :: jsonb);
-- mobile
INSERT INTO configs VALUES (7, 7, NULL, 't', NULL, NULL, ('{"database": {' ||
'"port": "' || current_setting('migration.db_port') || '", ' ||
'"schema": "mobile_service", ' ||
'"address": "' || current_setting('migration.db_host') || '", ' ||
'"database": "' || current_setting('migration.db_dbname') || '", ' ||
'"password": "' || current_setting('migration.db_pass') || '", ' ||
'"username": "' || current_setting('migration.db_user') || '", ' ||
'"createSchema": true}, ' ||
'"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9562"}}' ||
'}')::jsonb);
-- awip
INSERT INTO configs VALUES (8, 8, NULL, 't', NULL, NULL, '{
"backends": [
{
"id": "450e754f-aafb-4a9c-8d87-23c6a2da9833",
"url": "http://{{ cname }}-nginx.isp.mobi:18888/ru.isp.starter.awip.backend.ws/backend?wsdl",
"name": "citymatica_user_new",
"wrapList": true,
"createDate": "2018-09-07T09:41:03.853Z",
"clientPoolSize": 0,
"requestTimeout": 30000,
"systemIdentity": "1"
},
{
"id": "74d76314-b28b-11e8-96f8-529269fb1459",
"url": "http://{{ cname }}-nginx.isp.mobi:18880/ru.mp.storage.backend.ws/backend?wsdl",
"name": "citymatica_user_old",
"wrapList": true,
"createDate": "2018-09-07T09:41:03.853Z",
"clientPoolSize": 0,
"requestTimeout": 30000,
"systemIdentity": "1"
},
{
"id": "74d7659e-b28b-11e8-96f8-529269fb1459",
"url": "http://{{ cname }}-nginx.isp.mobi:18890/ru.isp.starter.awip.backend.ws/backend?wsdl",
"name": "citymatica_user_object_storage",
"wrapList": true,
"createDate": "2018-09-07T09:41:03.853Z",
"clientPoolSize": 0,
"requestTimeout": 30000,
"systemIdentity": "1"
},
{
"id": "74d75cc0-b28b-11e8-96f8-529269fb1459",
"url": "http://{{ cname }}-nginx.isp.mobi:18891/ru.isp.starter.awip.backend.ws/backend?wsdl",
"name": "citymatica_user_events",
"wrapList": true,
"createDate": "2018-09-07T09:41:03.853Z",
"clientPoolSize": 0,
"requestTimeout": 30000,
"systemIdentity": "1"
},
{
"id": "d5575047-6588-46d9-be58-b487d42d217c",
"url": "http://{{ cname }}-nginx.isp.mobi:18889/ru.isp.starter.awip.backend.ws/backend?wsdl",
"name": "citymatica_operator",
"wrapList": true,
"createDate": "2018-09-07T09:41:03.853Z",
"clientPoolSize": 0,
"requestTimeout": 30000,
"systemIdentity": "1"
},
{
"id": "74d76094-b28b-11e8-96f8-529269fb1459",
"url": "http://{{ cname }}-nginx.isp.mobi:18895/ru.isp.starter.awip.backend.ws/backend?wsdl",
"name": "citymatica_operator_metrics",
"wrapList": true,
"createDate": "2018-09-07T09:41:03.853Z",
"clientPoolSize": 0,
"requestTimeout": 30000,
"systemIdentity": "1"
}
]
}');
-- mongo-backend
INSERT INTO configs VALUES (9, 9, NULL, 't', NULL, NULL, '{"connections": [],"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9563"}}}');
-- sql-backend
INSERT INTO configs VALUES (10, 10, NULL, 't', NULL, NULL, '{"connections": [], "metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9566"}}}');
-- events
INSERT INTO configs VALUES (11, 11, NULL, 't', NULL, NULL, '{"eventRoutes": [{"handlers": {}, "applicationGroupId": 1}, {"handlers": {}, "applicationGroupId": 5}], "queueEndpoints": []}');
SELECT setval(pg_get_serial_sequence('configs', 'id'), 12, FALSE);
-- +goose Down
DELETE FROM configs WHERE id IN (6,7,8,9,10,11)
@@ -1,9 +0,0 @@
-- +goose Up
ALTER TABLE configs
ADD COLUMN name VARCHAR(255) NOT NULL DEFAULT 'unnamed',
ADD COLUMN description TEXT;
-- +goose Down
ALTER TABLE configs
DROP COLUMN name,
DROP COLUMN description;
@@ -1,23 +0,0 @@
-- +goose Up
CREATE TABLE config_schemas (
id SERIAL4 PRIMARY KEY,
module_id INTEGER NOT NULL,
version VARCHAR(255) NOT NULL,
schema JSONB NOT NULL DEFAULT '{}',
created_at TIMESTAMP NOT NULL DEFAULT (now() at time zone 'utc'),
updated_at TIMESTAMP NOT NULL DEFAULT (now() at time zone 'utc'),
CONSTRAINT FK_module_id__module_id FOREIGN KEY (module_id)
REFERENCES modules (id) ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE TRIGGER update_schema_create_time
BEFORE INSERT OR UPDATE
ON config_schemas
FOR EACH ROW EXECUTE PROCEDURE update_created_column_date();
CREATE INDEX IX_schemes_moduleId
ON config_schemas
USING hash (module_id);
-- +goose Down
DROP TABLE config_schemas;
@@ -1,43 +0,0 @@
-- +goose Up
set migration.db_host = 'msk-pgsql.isp.mobi';
set migration.db_port = '5432';
set migration.db_dbname = 'isp-alpha';
set migration.db_user = 'isp-alpha';
set migration.db_pass = 'JxY96xLF8zfh3g8EWvSDtLUBw';
WITH moduleVar AS (
INSERT INTO modules (instance_id, name, active) VALUES (1, 'template', 't') RETURNING id
)
INSERT INTO configs (module_id, active, data) VALUES (
(SELECT id FROM moduleVar),
't',
('{"database": {' ||
'"port": "' || current_setting('migration.db_port') || '", ' ||
'"schema": "template_service", ' ||
'"address": "' || current_setting('migration.db_host') || '", ' ||
'"database": "' || current_setting('migration.db_dbname') || '", ' ||
'"password": "' || current_setting('migration.db_pass') || '", ' ||
'"username": "' || current_setting('migration.db_user') || '", ' ||
'"createSchema": true}, "defaultLanguage": "en", ' ||
'"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9567"}}' ||
'}')::jsonb);
WITH moduleVar AS (
INSERT INTO modules (instance_id, name, active) VALUES (1, 'message-bundle', 't') RETURNING id
)
INSERT INTO configs (module_id, active, data) VALUES (
(SELECT id FROM moduleVar),
't',
('{"database": {' ||
'"port": "' || current_setting('migration.db_port') || '", ' ||
'"schema": "message_bundle_service", ' ||
'"address": "' || current_setting('migration.db_host') || '", ' ||
'"database": "' || current_setting('migration.db_dbname') || '", ' ||
'"password": "' || current_setting('migration.db_pass') || '", ' ||
'"username": "' || current_setting('migration.db_user') || '", ' ||
'"createSchema": true}, "defaultLanguage": "en", ' ||
'"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9560"}}' ||
'}')::jsonb);
-- +goose Down
@@ -1,88 +0,0 @@
-- +goose Up
set migration.nats_host = '10.250.9.117';
set migration.nats_port = '4223';
set migration.nats_cluster_id = 'test-cluster';
WITH moduleVar AS (INSERT INTO modules (instance_id, name, active) VALUES (1, 'mobile-push', 't') RETURNING id)
INSERT INTO configs (module_id, active, data)
VALUES ((SELECT id FROM moduleVar), 't', (
format('{
"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9561"}},
"firebaseConfig": {
"token_uri": "https://accounts.google.com/o/oauth2/token",
"client_id": "115553569331708875508",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"client_email": "firebase-adminsdk-f70qo@test-ccdab.iam.gserviceaccount.com",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCM7Rl7AmGQSOxx\nUdQs+yY7cwaUmqi2khmsre0/kfJU2zCJxotbYNeyfWJZk3D8hngxnmI6hrYqWEq3\nyy/J8rhI7AmcY3eXC1yyL/sKTClFjyZVEoDcBWTn0HOuM8YAQAqRAx2vznKDquoj\nLgUHl09qTxsVRmPdfc7fKE45OZBdetA/kdIEd4S5J+CKeYB7tpuT+0eL4QUNOzE1\n6SGqYnhA97QD7K3ylhWxKC8U0Ozyqub/OTg7WRLEYV36Z+6Ok0BZkYiCXbUNukST\nXaKc8DGAFrzcu7jW8rJIRZ/uc/Im5judjuMRznzu1SMPVT6pL8HfduGFc23FIAL/\nGjmcDwWbAgMBAAECggEAETe6oDvHPcCbGrE7sg8xOZwxFqDasguhlWZekSC8sb9h\n68NVLWHkmIsXJAiOilvHfZBzQeFJilzlLBVoDk1YVJh6CCBi8RJTTfXsvvJVLIlz\nznsHQVprXKMsLwFmVIt+fv8ZdmxLs2iDWK77sFS9QCjQD0ZdVydSyhL7k6RDzhfP\nw6It0H3JyyqD8W7DOvYSUfi/oZKZvufBAkEauhuiVVyite97cJtV8YNmiVCznOtK\nOw0OpuzemKez0rh673VtEEvUgrvOy5WNtjunoRkNKZkW1JiAWYpf6FpOOFub/lG3\nQPFwjLZeEUa8xc/E2JJP6HQMON0qF5zvtKr4QH/9uQKBgQDByXfLh+56Cu+6E0CL\nigH0GmagwZQnw7/+zhi1AhC2DjxAmXq9Y0kFrmpwr6FXqtRJm5AANOipASsRknaq\n5kAlDCGdqHnw1LDlNbrxywDvTYADo13ebx2cXfxESDfx0gofXehGhfFfOyXJ0lwp\ngXbgxIQFNjv2QWjSdb637ZaOrQKBgQC6KzmZcMAWo7j+eGo0WoAVTCVu/SDcV/sG\nF4+NxhLjMYSuMbBF7BdMy1rJ6g3SrdULGzw0KDeEqo1XzneOyzHOnEiZFKTkgIPQ\n347fWOYTBKMNEJd37jAIHKrrFiyD/pvL2ZLu1mSnCHsi/v5u02gqpf8Vkvwo/5ME\n4BuhB/PWZwKBgQC7V0adl+rfR0VcURJcE+4xi3hdvua4zpAFCD9wde+r4PU0ymuT\nPbGxcV1rVQ8YTojuJBrBaGToRb3aPgrEytWGO0UgQmiofyYIYLo62LMtpXG1krDD\nwg4RRfcEGAEloZWxnzpXO1QOaYLtqpT4dzVys+ihlT3AoplwpO3cqC6d/QKBgEGu\nkmnSX9Mc/F27eizyaRIahXJ9GCTlXYkustUgNvW1OMyEd16UBzxu2p82Vp4n+mwq\ntbjpH31M9wUtsPzOL8pnVS29HNgJh3ggB7ZBFRtMnYI0glwrywJxqtO6RQZkw+7N\n2ostVOGhmmAkevv61luFqVOhQhns4Z/suZK8zYitAoGAHwLWUQViCy0HFkhED5GV\nWrZZFRH2ucpK+ljOp7dbbUPA+dTD2qu/hho3QCaT5odJWap42TbSL6YhZg/7jN7h\nOSQW8DiDPzjUtL1gfqOxJdQavrgR2a2AW054loM0R508699Vx6Hir/ayD4nZ9IUo\nm2meeJVZcknz/L9LXOOIUBk=\n-----END PRIVATE KEY-----\n",
"private_key_id": "88d1af761304de758388747d72931c3457df54ef",
"project_id": "test-ccdab",
"type": "service_account",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-f70qo%%40test-ccdab.iam.gserviceaccount.com"
},
"concurrentSendersCount": 6,
"natsConfig": {
"address": {
"port": "%s",
"ip": "%s"
},
"clusterId": "%s"
}
}', current_setting('migration.nats_port'),
current_setting('migration.nats_host'),
current_setting('migration.nats_cluster_id')
)) :: jsonb);
WITH moduleVar AS (INSERT INTO modules (instance_id, name, active) VALUES (1, 'sms', 't') RETURNING id)
INSERT INTO configs (module_id, active, data)
VALUES ((SELECT id FROM moduleVar), 't', (format('{
"natsConfig": {
"clusterId": "%s",
"address": {
"ip": "%s",
"port": "%s"
}
},
"smppClients": [
{
"default": true,
"poolSize": 1,
"connection": {
"password": "1q2w3e!",
"user": "isp",
"address": {
"ip": "5.187.0.65",
"port": "9931"
}
},
"ResponseTimeoutMs": 5000,
"concurrentSendersCount": 2,
"name": "smsc"
}
],
"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9565"}}
}', current_setting('migration.nats_cluster_id'),
current_setting('migration.nats_host'),
current_setting('migration.nats_port')
)) :: jsonb);
WITH moduleVar AS (INSERT INTO modules (instance_id, name, active) VALUES (1, 'email', 't') RETURNING id)
INSERT INTO configs (module_id, active, data)
VALUES ((SELECT id FROM moduleVar), 't', (format('{
"natsConfig": {
"clusterId": "%s",
"address": {
"ip": "%s",
"port": "%s"
}
},
"smtpClients": [
],
"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9558"}}
}', current_setting('migration.nats_cluster_id'),
current_setting('migration.nats_host'),
current_setting('migration.nats_port')
)) :: jsonb);
-- +goose Down
@@ -1,27 +0,0 @@
-- +goose Up
WITH moduleVar AS (INSERT INTO modules (instance_id, name, active) VALUES (1, 'file-storage', 't')
RETURNING id)
INSERT INTO configs (module_id, active, data)
VALUES ((SELECT id FROM moduleVar), 't', '{
"imageSizeList": [
75,
130,
200,
320,
510,
604,
807
],
"rootDirectory": "./files/",
"maxRequestBodySizeInBytes": 1073741824,
"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9559"}}
}' :: jsonb);
WITH moduleVar AS (INSERT INTO modules (instance_id, name, active) VALUES (1, 'rest-backend', 't')
RETURNING id)
INSERT INTO configs (module_id, active, data)
VALUES ((SELECT id FROM moduleVar), 't', '{
"backends": [], "metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9564"}}
}' :: jsonb);
-- +goose Down
@@ -1,54 +0,0 @@
-- +goose Up
set migrationRead.db_host = 'msk-pgsql.isp.mobi';
set migrationRead.db_port = '5432';
set migrationRead.db_dbname = 'isp-alpha';
set migrationRead.db_user = 'isp-alpha';
set migrationRead.db_pass = 'JxY96xLF8zfh3g8EWvSDtLUBw';
set migrationWrite.db_host = 'msk-pgsql.isp.mobi';
set migrationWrite.db_port = '5432';
set migrationWrite.db_dbname = 'isp-alpha';
set migrationWrite.db_user = 'isp-alpha';
set migrationWrite.db_pass = 'JxY96xLF8zfh3g8EWvSDtLUBw';
set migrationNotification.db_host = 'msk-pgsql.isp.mobi';
set migrationNotification.db_port = '5432';
set migrationNotification.db_dbname = 'isp-alpha';
set migrationNotification.db_user = 'isp-alpha';
set migrationNotification.db_pass = 'JxY96xLF8zfh3g8EWvSDtLUBw';
WITH moduleVar AS (
INSERT INTO modules (instance_id, name, active) VALUES (1, 'mdm', 't') RETURNING id
)
INSERT INTO configs (module_id, active, data) VALUES (
(SELECT id FROM moduleVar),
't',
('{"databaseRead": {' ||
'"port": "' || current_setting('migrationRead.db_port') || '", ' ||
'"schema": "mdm_service", ' ||
'"address": "' || current_setting('migrationRead.db_host') || '", ' ||
'"database": "' || current_setting('migrationRead.db_dbname') || '", ' ||
'"password": "' || current_setting('migrationRead.db_pass') || '", ' ||
'"username": "' || current_setting('migrationRead.db_user') || '", ' ||
'"createSchema": true},' ||
'"metrics": {"gc": true, "memory": true, "address": {"ip": "0.0.0.0", "path": "/metrics", "port": "9568"}},' ||
'"databaseWrite": {' ||
'"port": "' || current_setting('migrationWrite.db_port') || '", ' ||
'"schema": "mdm_service", ' ||
'"address": "' || current_setting('migrationWrite.db_host') || '", ' ||
'"database": "' || current_setting('migrationWrite.db_dbname') || '", ' ||
'"password": "' || current_setting('migrationWrite.db_pass') || '", ' ||
'"username": "' || current_setting('migrationWrite.db_user') || '", ' ||
'"createSchema": true},' ||
'"databaseNotifications": {' ||
'"port": "' || current_setting('migrationNotification.db_port') || '", ' ||
'"schema": "mdm_service", ' ||
'"address": "' || current_setting('migrationNotification.db_host') || '", ' ||
'"database": "' || current_setting('migrationNotification.db_dbname') || '", ' ||
'"password": "' || current_setting('migrationNotification.db_pass') || '", ' ||
'"username": "' || current_setting('migrationNotification.db_user') || '", ' ||
'"createSchema": true}}')::jsonb);
-- +goose Down
@@ -1,90 +0,0 @@
-- +goose Up
set migration.nats_host = '10.250.9.117';
set migration.nats_port = '4223';
set migration.nats_cluster_id = 'test-cluster';
set migration.rabbit_host = '10.250.9.117';
set migration.rabbit_port = '5672';
set migration.rabbit_user = 'guest';
set migration.rabbit_password = 'guest';
set migration.rabbit_system_queue_prefix = 'test';
WITH moduleVar AS (
INSERT INTO modules (instance_id, name, active) VALUES (1, 'mdm-notify', 't') RETURNING id
)
INSERT INTO configs (module_id, active, data) VALUES (
(SELECT id FROM moduleVar),
't',
('{
"notifyConfigurations":[],
"logger": {
"sendAddRequestSudirV1IsOn": true,
"sendFindRequestSudirV1IsOn": true,
"sendUpdateRequestSudirV1IsOn": true,
"sendUpdateRequestSudirV2IsOn": true,
"creatingSystemNotificationsIsOn": true,
"sendErlRequestQueueIsOn": true,
"sendJsonRequestQueueIsOn": true,
"syncLogger": {
"enable": false,
"filename": "/opt/isp/isp-mdm-notify-service/events_logs/events.log.gz"
},
"asyncLogger": {
"enable": false,
"nats": {
"address": {
"ip": "mdm-taxcom-test-nats.isp.mobi",
"port": "4222"
},
"clusterId": "work-cluster"
}
},
"sendAddRequestSudirV1IsOn": true
},
"metrics":{
"gc": true,
"memory": true,
"address": {
"port": "9572",
"ip": "0.0.0.0",
"path": "/metrics"
}
},
"rabbit": {
"routingKey": "notification",
"exchangeName": "notifications",
"systemQueuesPrefix": "' || current_setting('migration.rabbit_system_queue_prefix') || '",
"declareQueueAndExchange": true,
"password": "' || current_setting('migration.rabbit_password') || '",
"user": "' || current_setting('migration.rabbit_user') || '",
"address": {
"ip": "' || current_setting('migration.rabbit_host') || '",
"port": "' || current_setting('migration.rabbit_port') || '"
}
"queue": {
"name": "notifier.queue",
"prefetchCount": 1000
},
},
"logRabbitEnabled": true,
"logRabbit": {
"address": {
"ip": "10.250.9.50",
"port": "5672"
},
"password": "ohk7athXehev3aiGfic2ZeiD",
"routingKey": "mdm-taxcom-test.notify.log",
"exchangeName": "mdm-taxcom-test.notify.log",
"systemQueuesPrefix": "mdm-taxcom-test",
"declareQueueAndExchange": true,
"user": "isp",
"queue": {
"name": "mdm-taxcom-test.notify.log.queue",
"prefetchCount": 300
}
}
}')::jsonb);
-- +goose Down
@@ -1,105 +0,0 @@
-- +goose Up
WITH moduleVar AS (
INSERT INTO modules (instance_id, name, active) VALUES (1, 'mdm-notify', 't') RETURNING id
)
INSERT INTO configs (module_id, active, data) VALUES (
(SELECT id FROM moduleVar),
't',
('{
"rules": {
"1": [
"etalon_id",
"last_name",
"$$documents.#passport",
"vehicles",
"addresses"
]
},
"mappingSchema": {
"$$documents.1000019.ref_num": "DRIVER_LICENSE.DriverLicense",
"gkupays.mesmeter": "[]HOUSE.MesMeterNumber",
"$$documents.1000016.start_dt": "PASSPORT_RF.PassportIssueDate",
"$$addresses.1000009.moscow_district_id": "[]REG_ADDRESS.RegAddressDistrictId",
"$$addresses.7.unom": "[]ADDRESS.RealAddressUnom",
"$$addresses.1000009.unom": "[]REG_ADDRESS.RegAddressUnom",
"$$addresses.1000009.moscow_area_ext_id": "[]REG_ADDRESS.RegAddressAreaId",
"$$addresses.7.moscow_area_ext_id": "[]ADDRESS.RealAddressAreaId",
"$$escredentials.1000004.etalon_id": "[]OLYMPIAD.OlympiadId",
"last_name": "FIO.LastName",
"vehicles.reg_number": "[]VEHICLE.VehicleRegistrationNumber",
"$$contacts.1.ref_num": "REG_DATA.Phone",
"$$addresses.7.corpus_no": "[]ADDRESS.RealAddressCorpus",
"$$users.NOT_SSO.id_value": "USER.LoginName",
"$$addresses.7.residence_num": "[]ADDRESS.RealAddressFlat",
"$$users.SSO.id_value": "USER.LoginName",
"birth_place_line_one": "PASSPORT_RF.PassportBirthPlace",
"$$addresses.7.house_no": "[]ADDRESS.RealAddressHouse",
"$$addresses.1000009.street_name_ex": "[]REG_ADDRESS.RegAddressStreet",
"gkupays.mesaccount": "[]HOUSE.MesAccountNumber",
"vehicles.etalon_id": "[]VEHICLE.VehicleId",
"$$addresses.7.street_id": "[]ADDRESS.RealAddressStreetId",
"$$documents.1000014.ref_num": "COMPLEX_OMS.oms",
"$$addresses.1000009.stroenie_no": "[]REG_ADDRESS.RegAddressBuilding",
"$$addresses.7.moscow_district_id": "[]ADDRESS.RealAddressDistrictId",
"$$addresses.7.unad": "[]ADDRESS.RealAddressUnad",
"vehicles.pts_number": "[]VEHICLE.VehiclePTSNumber",
"$$documents.1000016.identification_issuer": "PASSPORT_RF.PassportIssuer",
"etalon_id": "USER.LoginName",
"$$addresses.1000009.street_id": "[]REG_ADDRESS.RegAddressStreetId",
"$$escredentials.1000003.etalon_id": "[]GIA.GIAId",
"$$addresses.1000009.moscow_district_name": "[]REG_ADDRESS.RegAddressDistrict",
"given_name_one": "FIO.FirstName",
"vehicles.vin_number": "[]VEHICLE.VehicleVin",
"$$escredentials.1000004.login": "[]OLYMPIAD.OlympiadLogin",
"$$escredentials.1000003.doc_number": "[]GIA.GIADocNumber",
"$$addresses.1000009.moscow_area_name": "[]REG_ADDRESS.RegAddressArea",
"gkupays.gkupay_address_rel": "[]HOUSE.EpdAddressId",
"$$addresses.7.building_name": "[]ADDRESS.RealAddressHouseId",
"$$addresses.7.moscow_area_name": "[]ADDRESS.RealAddressArea",
"$$addresses.7.moscow_district_name": "[]ADDRESS.RealAddressDistrict",
"gender_tp_code": "PERSON.Gender",
"$$addresses.7.stroenie_no": "[]ADDRESS.RealAddressBuilding",
"$$documents.1000013.ref_num": "TAX_INFO.INN",
"$$addresses.1000009.building_name": "[]REG_ADDRESS.RegAddressHouseId",
"$$escredentials.1000004.description": "[]OLYMPIAD.OlympiadComment",
"birth_dt": "PERSON.Birthday",
"gkupays.epd": "[]HOUSE.EpdAddressNumber",
"$$addresses.1000009.house_no": "[]REG_ADDRESS.RegAddressHouse",
"$$addresses.1000009.street_omk": "[]REG_ADDRESS.RegAddressStreetOMK",
"$$citizen_relatives.OTHERS.etalon_id": "[]RELATIVES.RltvId",
"vehicles.stsnumber": "[]VEHICLE.VehicleSTSNumber",
"vehicles.description": "[]VEHICLE.VehicleDescription",
"$$addresses.1000009.unad": "[]REG_ADDRESS.RegAddressUnad",
"$$escredentials.1000004.password": "[]OLYMPIAD.OlympiadPassword",
"gkupays.phone": "[]HOUSE.EpdAddressCityPhone",
"$$addresses.7.street_omk": "[]ADDRESS.RealAddressStreetOMK",
"$$documents.1000019.start_dt": "DRIVER_LICENSE.DriverLicenseIssueDate",
"$$addresses.1000009.corpus_no": "[]REG_ADDRESS.RegAddressCorpus",
"$$citizen_relatives.1000004.etalon_id": "[]CHILDREN.ChildId",
"$$documents.1000016.identification_issuer_code": "PASSPORT_RF.PassportIssuerCode",
"$$escredentials.1000003.login": "[]GIA.GIARegCode",
"$$addresses.1000009.residence_num": "[]REG_ADDRESS.RegAddressFlat",
"given_name_two": "FIO.MiddleName",
"$$contacts.2.ref_num": "REG_DATA.Email",
"$$documents.1000015.ref_num": "SNILS.snils",
"$$documents.1000016.ref_num": "PASSPORT_RF.PassportNumber",
"$$addresses.7.street_name_ex": "[]ADDRESS.RealAddressStreet",
"$$documents.1000014.etalon_id": "COMPLEX_OMS.OmsId",
"$$escredentials.1000003.description": "[]GIA.GIAComment",
"$$citizen_relatives.1000003.etalon_id": "[]CHILDREN.ChildId",
"$$documents.1000016.identification_passport_birth_place": "PASSPORT_RF.PassportBirthPlace"
},
"metrics": {
"memory": true,
"address": {
"path": "/metrics",
"port": "9571",
"ip": "0.0.0.0"
},
"gc": true
}
}')::jsonb);
-- +goose Down
@@ -1,66 +0,0 @@
-- +goose Up
set migration.nats_host = '10.250.9.117';
set migration.nats_port = '4223';
set migration.nats_cluster_id = 'test-cluster';
set migration.rabbit_host = '10.250.9.117';
set migration.rabbit_port = '5672';
set migration.rabbit_user = 'guest';
set migration.rabbit_password = 'guest';
WITH moduleVar AS (
INSERT INTO modules (instance_id, name, active) VALUES (1, 'mdm-notify', 't') RETURNING id
)
INSERT INTO configs (module_id, active, data) VALUES (
(SELECT id FROM moduleVar),
't',
('{
"isNatsLoggerEnabled": false,
"nats": {
"address": {
"port": "' || current_setting('migration.nats_port') || '",
"ip": "' || current_setting('migration.nats_host') || '"
},
"clusterId": "' || current_setting('migration.nats_cluster_id') || '"
},
"queue": {
"init": {
"concurrentConsumers": 8,
"name": "init",
"prefetchCount": 10
},
"tempQueue": {
"name": "tempt",
"prefetchCount": 10,
"concurrentConsumers": 128
},
"defaultQueue": {
"concurrentConsumers": 128,
"name": "events",
"prefetchCount": 10
}
},
"rabbit": {
"password": "' || current_setting('migration.rabbit_password') || '",
"reconnectionTimeoutMs": 0,
"user": "' || current_setting('migration.rabbit_user') || '",
"address": {
"ip": "' || current_setting('migration.rabbit_host') || '",
"port": "' || current_setting('migration.rabbit_port') || '"
}
},
"metrics": {
"memory": true,
"address": {
"path": "/metrics",
"port": "9569",
"ip": "0.0.0.0"
},
"gc": true
}
}')::jsonb);
-- +goose Down
@@ -1,14 +0,0 @@
-- +goose Up
WITH moduleVar AS (
INSERT INTO modules (instance_id, name, active) VALUES (1, 'mdm-api', 't') RETURNING id
)
INSERT INTO configs (module_id, active, data) VALUES (
(SELECT id FROM moduleVar),
't',
('{' ||
'"pKAttributeName": "id"' ||
'}')::jsonb);
-- +goose Down
@@ -1,61 +0,0 @@
-- +goose Up
set rabbit.host = '10.250.9.117';
set rabbit.port = '5672';
set rabbit.user = 'guest';
set rabbit.password = 'guest';
set elastic.url = 'http://10.250.9.48:9200';
WITH moduleVar AS (
INSERT INTO modules (instance_id, name, active) VALUES (1, 'mdm-search', 't') RETURNING id
)
INSERT INTO configs (module_id, active, data) VALUES (
(SELECT id FROM moduleVar),
't',
((format('{
"queue": {
"prefetchSize": 1000,
"searcherQueue": "searcher.queue",
"concurrentConsumers": 4
},
"rabbit": {
"user": "%s",
"address": {
"ip": "%s",
"port": "%s"
},
"password": "%s"
},
"elastic": {
"uRL": "%s",
"shards": 1
},
"metrics": {
"address": {
"ip": "0.0.0.0",
"path": "/metrics",
"port": "9573"
},
"gc": true,
"memory": true
},
"isFieldsListWhite": false,
"fieldsList": [
"documents",
"citizen_relatives",
"contacts",
"addresses",
"escredentials",
"users"
]
}', current_setting('rabbit.user'),
current_setting('rabbit.host'),
current_setting('rabbit.port'),
current_setting('rabbit.password'),
current_setting('elastic.url')
)) :: jsonb));
-- +goose Down
-96
View File
@@ -1,96 +0,0 @@
package model
import (
"isp-config-service/entity"
"github.com/go-pg/pg"
"github.com/go-pg/pg/orm"
)
type ConfigRepository struct {
DB orm.DB
}
func (r *ConfigRepository) GetConfigs(identities []int64) ([]entity.Config, error) {
var configs []entity.Config
var err error
if len(identities) > 0 {
err = r.DB.Model(&configs).
Where("id IN (?)", pg.In(identities)).
Order("created_at DESC").
Limit(500).
Select()
} else {
err = r.DB.Model(&configs).
Order("created_at DESC").
Limit(500).
Select()
}
return configs, err
}
func (r *ConfigRepository) GetConfigsByModulesId(modulesId []int32) ([]entity.Config, error) {
var res []entity.Config
err := r.DB.Model(&res).Where("module_id IN (?)", pg.In(modulesId)).Order("created_at DESC").Select()
if err != nil {
return nil, err
}
return res, nil
}
func (r *ConfigRepository) CreateConfig(config *entity.Config) (*entity.Config, error) {
_, err := r.DB.Model(config).
Returning("*").
Insert()
return config, err
}
func (r *ConfigRepository) UpdateConfig(config *entity.Config) (*entity.Config, error) {
_, err := r.DB.Model(config).WherePK().
Returning("*").
Update()
return config, err
}
func (r *ConfigRepository) DeleteConfig(identities []int64) (int, error) {
result, err := r.DB.Exec("DELETE FROM "+schema+".configs WHERE id IN (?)", pg.In(identities))
return result.RowsAffected(), err
}
func (r *ConfigRepository) GetConfigById(identity int64) (*entity.Config, error) {
cfg := new(entity.Config)
err := r.DB.Model(cfg).
Where("id = ?", identity).
First()
if err == pg.ErrNoRows {
return nil, nil
}
return cfg, err
}
func (r *ConfigRepository) GetConfigByInstanceUUIDAndModuleName(instanceUUID string, moduleName string) (*entity.Config, error) {
cfg := new(entity.Config)
err := r.DB.Model(cfg).
Where(`module_id = (SELECT id FROM `+schema+`.modules WHERE name = ?
AND instance_id = (SELECT id FROM `+schema+`.instances WHERE uuid = ?))`, moduleName, instanceUUID).
Where("active = true").
Order("updated_at DESC").
First()
if err == pg.ErrNoRows {
return nil, nil
}
return cfg, err
}
func (r *ConfigRepository) GetModuleNameAndInstanceUUIDByConfigId(configId int64) (entity.ModuleInstanceIdentity, error) {
var cfg entity.ModuleInstanceIdentity
_, err := r.DB.Query(&cfg, `SELECT temp.name, uuid
FROM (SELECT name, instance_id FROM `+schema+`.modules WHERE id =
(SELECT module_id FROM `+schema+`.configs WHERE id = ? AND active = true)) temp
LEFT JOIN `+schema+`.instances s ON s.id = temp.instance_id`, configId)
if err != nil && err == pg.ErrNoRows {
return cfg, nil
}
return cfg, err
}
-73
View File
@@ -1,73 +0,0 @@
package model
import (
"isp-config-service/entity"
"github.com/go-pg/pg"
"github.com/go-pg/pg/orm"
)
type InstanceRepository struct {
DB orm.DB
}
func (r *InstanceRepository) GetInstances(identities []int32) ([]entity.Instance, error) {
var instances []entity.Instance
var err error
if len(identities) > 0 {
err = r.DB.Model(&instances).
Where("id IN (?)", pg.In(identities)).
Order("created_at DESC").
Limit(500).
Select()
} else {
err = r.DB.Model(&instances).
Order("created_at DESC").
Limit(500).
Select()
}
return instances, err
}
func (r *InstanceRepository) CreateInstance(instance entity.Instance) (entity.Instance, error) {
_, err := r.DB.Model(&instance).
Returning("id").
Returning("created_at").
Insert()
return instance, err
}
func (r *InstanceRepository) UpdateInstance(instance entity.Instance) (entity.Instance, error) {
_, err := r.DB.Model(&instance).WherePK().
Returning("id").
Returning("created_at").
Update()
return instance, err
}
func (r *InstanceRepository) DeleteInstance(identities []int32) (int, error) {
result, err := r.DB.Exec("DELETE FROM "+schema+".instances WHERE id IN (?)", pg.In(identities))
return result.RowsAffected(), err
}
func (r *InstanceRepository) GetInstanceById(identity int32) (entity.Instance, error) {
var module entity.Instance
err := r.DB.Model(&module).
Where("id = ?", identity).
First()
if err != nil && err == pg.ErrNoRows {
return module, nil
}
return module, err
}
func (r *InstanceRepository) GetInstanceByUuid(instanceUuid string) (entity.Instance, error) {
var instance entity.Instance
err := r.DB.Model(&instance).
Where("uuid = ?", instanceUuid).
First()
if err != nil && err == pg.ErrNoRows {
return instance, nil
}
return instance, err
}
-135
View File
@@ -1,135 +0,0 @@
package model
import (
"isp-config-service/entity"
"github.com/go-pg/pg"
"github.com/go-pg/pg/orm"
"time"
)
type ModulesRepository struct {
DB orm.DB
}
func (r *ModulesRepository) GetModules(identities []int32) ([]entity.Module, error) {
var modules []entity.Module
var err error
if len(identities) > 0 {
err = r.DB.Model(&modules).
Where("id IN (?)", pg.In(identities)).
Order("created_at DESC").
Limit(500).
Select()
} else {
err = r.DB.Model(&modules).
Order("created_at DESC").
Limit(500).
Select()
}
return modules, err
}
func (r *ModulesRepository) GetActiveModules() ([]entity.Module, error) {
var modules []entity.Module
err := r.DB.Model(&modules).
Order("created_at DESC").
Where("active = true").
Limit(500).
Select()
return modules, err
}
func (r *ModulesRepository) CreateModule(module entity.Module) (entity.Module, error) {
_, err := r.DB.Model(&module).
Returning("id").
Returning("active").
Returning("created_at").
Insert()
return module, err
}
func (r *ModulesRepository) UpdateModule(module entity.Module) (entity.Module, error) {
_, err := r.DB.Model(&module).WherePK().
Returning("id").
Returning("active").
Returning("created_at").
Update()
return module, err
}
func (r *ModulesRepository) DeleteModule(identities []int32) (int, error) {
result, err := r.DB.Exec("DELETE FROM "+schema+".modules WHERE id IN (?)", pg.In(identities))
return result.RowsAffected(), err
}
func (r *ModulesRepository) GetModuleById(identity int32) (entity.Module, error) {
var module entity.Module
err := r.DB.Model(&module).
Where("id = ?", identity).
First()
if err != nil && err == pg.ErrNoRows {
return module, nil
}
return module, err
}
func (r *ModulesRepository) GetModuleByInstanceIdAndName(instanceId int32, moduleName string) (entity.Module, error) {
var module entity.Module
err := r.DB.Model(&module).
Where("name = ?", moduleName).
Where("instance_id = ?", instanceId).
First()
if err == pg.ErrNoRows {
return module, nil
}
return module, err
}
func (r *ModulesRepository) UpdateModuleDisconnect(instanceUuid string, moduleName string) error {
var module entity.Module
err := r.DB.Model(&module).
Where("name = ?", moduleName).
Where("instance_id = (SELECT id FROM "+schema+".instances WHERE uuid = ?)", instanceUuid).
First()
if err != nil {
return err
}
if module.Id != 0 {
module.LastDisconnectedAt = time.Now()
_, err := r.DB.Model(&module).WherePK().Update()
if err != nil {
return err
}
}
return err
}
func (r *ModulesRepository) GetModulesByInstanceUuid(instanceUuid string) ([]entity.Module, error) {
var res []entity.Module
err := r.DB.Model(&res).
Where("instance_id = (SELECT id FROM "+schema+".instances WHERE uuid = ?)", instanceUuid).
Select()
if err != nil {
return nil, err
}
return res, nil
}
func (r *ModulesRepository) GetModulesByInstanceUuidAndName(instanceUuid string, name string) (*entity.Module, error) {
res := new(entity.Module)
err := r.DB.Model(res).
Where("instance_id = (SELECT id FROM "+schema+".instances WHERE uuid = ?)", instanceUuid).
Where("name = ?", name).
First()
if err == pg.ErrNoRows {
return nil, nil
}
if err != nil {
return nil, err
}
return res, nil
}
-24
View File
@@ -1,24 +0,0 @@
package model
import (
"github.com/go-pg/pg"
)
var (
schema = ""
ConfigRep ConfigRepository
ModulesRep ModulesRepository
InstanceRep InstanceRepository
SchemaRep SchemaRepository
)
func SetSchema(s string) {
schema = s
}
func InitDbManager(db *pg.DB) {
ConfigRep = ConfigRepository{db}
ModulesRep = ModulesRepository{db}
InstanceRep = InstanceRepository{db}
SchemaRep = SchemaRepository{db}
}
-30
View File
@@ -1,30 +0,0 @@
package model
import (
"github.com/go-pg/pg"
"github.com/go-pg/pg/orm"
"isp-config-service/entity"
)
type SchemaRepository struct {
DB orm.DB
}
func (r *SchemaRepository) InsertConfigSchema(s *entity.ConfigSchema) (*entity.ConfigSchema, error) {
_, err := r.DB.Model(s).Returning("*").Insert()
return s, err
}
func (r *SchemaRepository) UpdateConfigSchema(s *entity.ConfigSchema) (*entity.ConfigSchema, error) {
_, err := r.DB.Model(s).Returning("*").WherePK().Update()
return s, err
}
func (r *SchemaRepository) GetSchemasByModulesId(modulesId []int32) ([]entity.ConfigSchema, error) {
var res []entity.ConfigSchema
err := r.DB.Model(&res).Where("module_id IN (?)", pg.In(modulesId)).Select()
if err != nil {
return nil, err
}
return res, nil
}
-134
View File
@@ -1,134 +0,0 @@
package module
import (
"github.com/integration-system/isp-lib/config"
"isp-config-service/conf"
"isp-config-service/domain"
st "isp-config-service/entity"
"isp-config-service/model"
"isp-config-service/socket"
"sort"
"time"
)
var (
startAt = time.Now()
Version = "0.1.0"
)
func GetAggregatedModuleInfo(instanceUuid string) ([]*domain.ModuleInfo, error) {
modules, err := model.ModulesRep.GetModulesByInstanceUuid(instanceUuid)
if err != nil {
return nil, err
}
config := config.Get().(*conf.Configuration)
modules = append(modules, st.Module{
Id: -1,
Name: config.ModuleName,
Active: true,
CreatedAt: startAt,
InstanceId: -1,
})
l := len(modules)
res := make([]*domain.ModuleInfo, l)
m := make(map[int32]*domain.ModuleInfo, l)
idList := make([]int32, l)
for i, module := range modules {
idList[i] = module.Id
info := &domain.ModuleInfo{
Id: module.Id,
Name: module.Name,
Active: module.Active,
CreatedAt: module.CreatedAt,
LastConnectedAt: module.LastConnectedAt,
LastDisconnectedAt: module.LastDisconnectedAt,
}
m[module.Id] = info
res[i] = info
}
configs, err := model.ConfigRep.GetConfigsByModulesId(idList)
if err != nil {
return nil, err
}
for _, cfg := range configs {
info := m[cfg.ModuleId]
info.Configs = append(info.Configs, cfg)
}
schemas, err := model.SchemaRep.GetSchemasByModulesId(idList)
if err != nil {
return nil, err
}
for _, s := range schemas {
info := m[s.ModuleId]
schema := s.Schema
info.ConfigSchema = &schema
}
connMap := socket.GetModuleConnectionIdMapByInstanceId(instanceUuid)
routes := socket.GetRoutes().Routes
//converters := socket.GetConverters()
//routers := socket.GetRouters()
roomsStat := socket.GetRoomsCount()
for _, info := range res {
if info.Id == -1 {
info.Status = append(info.Status, domain.Connection{
Address: config.GrpcOuterAddress,
Version: Version,
Endpoints: socket.ConfigServiceBackendDeclaration.Endpoints,
LibVersion: socket.ConfigServiceBackendDeclaration.LibVersion,
EstablishedAt: startAt,
})
} else if conns, connected := connMap[info.Name]; connected {
for _, conId := range conns {
hasRoutes := false
var data *domain.Connection
if backend, ok := routes[conId]; ok {
data = &domain.Connection{
Version: backend.Version,
LibVersion: backend.LibVersion,
Address: backend.Address,
Endpoints: backend.Endpoints,
}
hasRoutes = true
} else if roomsStat[instanceUuid][info.Name] <= 0 {
continue
}
if c, ok := socket.GetConnectionById(instanceUuid, conId); ok {
if !hasRoutes {
data = &domain.Connection{
Version: "unknown",
}
/*if router, ok := routers[conId]; ok {
data.Address = router
} else if converter, ok := converters[conId]; ok {
data.Address = converter
}*/
}
data.EstablishedAt = c.EstablishedAt
}
info.Status = append(info.Status, *data)
}
}
}
for _, s := range res {
sort.Slice(s.Status, func(i, j int) bool {
return s.Status[i].EstablishedAt.Before(s.Status[j].EstablishedAt)
})
for _, con := range s.Status {
sort.Slice(con.Endpoints, func(i, j int) bool {
return con.Endpoints[i].Path < con.Endpoints[j].Path
})
}
}
sort.Slice(res, func(i, j int) bool {
return res[i].Name < res[j].Name
})
return res, nil
}
-28
View File
@@ -1,28 +0,0 @@
syntax = "proto3";
// /home/andrey/Applications/protoc/bin/protoc -I ./ proto/system.proto --go_out=plugins=grpc:./
option java_multiple_files = true;
option java_package = "io.grpc.convertService";
option java_outer_classname = "ConvertServiceProto";
package isp;
import "google/api/annotations.proto";
import "google/protobuf/struct.proto";
message Message {
oneof body {
google.protobuf.Struct structBody = 1;
google.protobuf.ListValue listBody = 2;
google.protobuf.NullValue NullBody = 3;
}
}
service BackendService {
// ===== SYSTEM =====
rpc Request (Message) returns (Message) {
option (google.api.http) = {
post: "/api"
body: "*"
};
}
}
-134
View File
@@ -1,134 +0,0 @@
{
"swagger": "2.0",
"info": {
"title": "proto/backend_service.proto",
"version": "version not set"
},
"schemes": [
"http",
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/api": {
"post": {
"summary": "===== SYSTEM =====",
"operationId": "Request",
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/ispMessage"
}
}
},
"parameters": [
{
"name": "Grpc-Metadata-proxy_method_name",
"in": "header",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/ispMessage"
}
}
],
"tags": [
"BackendService"
]
}
}
},
"definitions": {
"ispMessage": {
"type": "object",
"properties": {
"structBody": {
"$ref": "#/definitions/protobufStruct"
},
"listBody": {
"$ref": "#/definitions/protobufListValue"
},
"NullBody": {
"$ref": "#/definitions/protobufNullValue"
}
}
},
"protobufListValue": {
"type": "object",
"properties": {
"values": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufValue"
},
"description": "Repeated field of dynamically typed values."
}
},
"description": "`ListValue` is a wrapper around a repeated field of values.\n\nThe JSON representation for `ListValue` is JSON array."
},
"protobufNullValue": {
"type": "string",
"enum": [
"NULL_VALUE"
],
"default": "NULL_VALUE",
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
},
"protobufStruct": {
"type": "object",
"properties": {
"fields": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/protobufValue"
},
"description": "Unordered map of dynamically typed values."
}
},
"description": "`Struct` represents a structured data value, consisting of fields\nwhich map to dynamically typed values. In some languages, `Struct`\nmight be supported by a native representation. For example, in\nscripting languages like JS a struct is represented as an\nobject. The details of that representation are described together\nwith the proto support for the language.\n\nThe JSON representation for `Struct` is JSON object."
},
"protobufValue": {
"type": "object",
"properties": {
"null_value": {
"$ref": "#/definitions/protobufNullValue",
"description": "Represents a null value."
},
"number_value": {
"type": "number",
"format": "double",
"description": "Represents a double value."
},
"string_value": {
"type": "string",
"description": "Represents a string value."
},
"bool_value": {
"type": "boolean",
"format": "boolean",
"description": "Represents a boolean value."
},
"struct_value": {
"$ref": "#/definitions/protobufStruct",
"description": "Represents a structured value."
},
"list_value": {
"$ref": "#/definitions/protobufListValue",
"description": "Represents a repeated `Value`."
}
},
"description": "`Value` represents a dynamically typed value which can be either\nnull, a number, a string, a boolean, a recursive struct value, or a\nlist of values. A producer of value is expected to set one of that\nvariants, absence of any variant indicates an error.\n\nThe JSON representation for `Value` is JSON value."
}
}
}
Loaded 100 of 176 files, more files were not shown because too many files have changed in this diff. Show more