Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: support read-only api-db connections #122

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ The deployment requires:
| `KEYCLOAK_CLIENT_SECRET` | Client secret of `lagoon-opensearch-sync` Keycloak client. | |
| `OPENSEARCH_ADMIN_PASSWORD` | Password for the Opensearch `admin` user. | |

3. Command `/lagoon-opensearch-sync`.
3. If you are utilising a read-only connection to the api-db, either via a read-replica, or dedicated account:

| Name | Description | Example |
| --- | --- | --- |
| `API_DB_RO_ADDRESS` | Internal service name of an API DB read-only replica. | `lagoon-core-api-db` |
| `API_DB_RO_USERNAME` | Read-only user for the API DB. | |
| `API_DB_RO_PASSWORD` | Password for the read-only user for the API DB. | |

4. Command `/lagoon-opensearch-sync`.

## Advanced usage

Expand Down
6 changes: 3 additions & 3 deletions cmd/lagoon-opensearch-sync/dump-projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

// DumpProjectsCmd represents the `dump-projects` command.
type DumpProjectsCmd struct {
APIDBAddress string `kong:"required,env='API_DB_ADDRESS',help='Lagoon API DB Address (host[:port])'"`
APIDBAddress string `kong:"required,env='API_DB_RO_ADDRESS,API_DB_ADDRESS',help='Lagoon API DB Address (host[:port])'"`
APIDBDatabase string `kong:"default='infrastructure',env='API_DB_DATABASE',help='Lagoon API DB Database Name'"`
APIDBPassword string `kong:"required,env='API_DB_PASSWORD',help='Lagoon API DB Password'"`
APIDBUsername string `kong:"default='api',env='API_DB_USERNAME',help='Lagoon API DB Username'"`
APIDBPassword string `kong:"required,env='API_DB_RO_PASSWORD,API_DB_PASSWORD',help='Lagoon API DB Password'"`
APIDBUsername string `kong:"default='api',env='API_DB_RO_USERNAME,API_DB_USERNAME',help='Lagoon API DB Username'"`
}

// Run the dump-projects command.
Expand Down
6 changes: 3 additions & 3 deletions cmd/lagoon-opensearch-sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ type SyncCmd struct {
Objects []string `kong:"enum='tenants,roles,rolesmapping,indexpatterns,indextemplates',default='tenants,roles,rolesmapping,indexpatterns,indextemplates',help='Opensearch objects which will be synchronized'"`
LegacyIndexPatternDelimiter bool `kong:"default='false',help='Use the legacy -* index pattern delimiter instead of -_-*'"`
// lagoon DB client fields
APIDBAddress string `kong:"required,env='API_DB_ADDRESS',help='Lagoon API DB Address (host[:port])'"`
APIDBAddress string `kong:"required,env='API_DB_RO_ADDRESS,API_DB_ADDRESS',help='Lagoon API DB Address (host[:port])'"`
APIDBDatabase string `kong:"default='infrastructure',env='API_DB_DATABASE',help='Lagoon API DB Database Name'"`
APIDBPassword string `kong:"required,env='API_DB_PASSWORD',help='Lagoon API DB Password'"`
APIDBUsername string `kong:"default='api',env='API_DB_USERNAME',help='Lagoon API DB Username'"`
APIDBPassword string `kong:"required,env='API_DB_RO_PASSWORD,API_DB_PASSWORD',help='Lagoon API DB Password'"`
APIDBUsername string `kong:"default='api',env='API_DB_RO_USERNAME,API_DB_USERNAME',help='Lagoon API DB Username'"`
// keycloak client fields
KeycloakClientID string `kong:"default='lagoon-opensearch-sync',env='KEYCLOAK_CLIENT_ID',help='Keycloak OAuth2 Client ID'"`
KeycloakClientSecret string `kong:"required,env='KEYCLOAK_CLIENT_SECRET',help='Keycloak OAuth2 Client Secret'"`
Expand Down
Loading