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

DynamoDB config support for local #82

Closed
missourian55 opened this issue Nov 22, 2019 · 6 comments
Closed

DynamoDB config support for local #82

missourian55 opened this issue Nov 22, 2019 · 6 comments

Comments

@missourian55
Copy link

Please provide configuration support for local dynamoDB. We want to configure the relay proxy to local dynamoDB in local/test environments.

We need to pass in 4 dummy configurations

  1. AWS access_key
  2. AWS secret_key
  3. AWS region
  4. DynamoDB endpoint URL

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

A sample JAVA dynamo client

AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().withEndpointConfiguration(
new AwsClientBuilder.EndpointConfiguration("http://localhost:8000", "us-west-2"))
.build(); ```

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/CodeSamples.Java.html
@eli-darkly
Copy link
Contributor

It sounds like the only new parameter you would need is for the endpoint URL, since it is already possible to set the AWS keys and region via environment variables or local AWS config files. Is that right?

@missourian55
Copy link
Author

you are correct. My bad

LaunchDarklyCI pushed a commit that referenced this issue Dec 20, 2019
@bwoskow-ld
Copy link
Member

The ability to specify an endpoint URL is added in 5.9.0. Thank you for your feedback!

@missourian55
Copy link
Author

Thank you, just gave this is a try I am getting below error

INFO: 2019/12/21 04:15:32 ld-relay.go:59: Starting LaunchDarkly relay version 5.9.0 with configuration file /ldr/ld-relay.conf plus environment variables
INFO: 2019/12/21 04:15:32 relay.go:542: Using DynamoDB feature store: DEV_LAUNCHDARKLY with prefix: ld:test:dev
INFO: 2019/12/21 04:15:32 logging.go:264: INFO: DynamoDBFeatureStore: Using DynamoDB table DEV_LAUNCHDARKLY
[env: test-dev] 2019/12/21 04:15:32 INFO: Proxying events for this environment
[env:test-dev] 2019/12/21 04:15:32 INFO: Starting LaunchDarkly client 4.13.1
[env: test-dev] 2019/12/21 04:15:32 INFO: Starting LaunchDarkly streaming connection
[env: test-dev] 2019/12/21 04:15:32 INFO: Waiting up to 10000 milliseconds for LaunchDarkly client to start...
[env: test-dev] 2019/12/21 04:15:32 INFO: Connecting to LaunchDarkly stream
INFO: 2019/12/21 04:15:32 metrics.go:203: Successfully registered Prometheus exporter.
INFO: 2019/12/21 04:15:32 ld-relay.go:106: Starting server listening on port 8030
[env: test-dev] 2019/12/21 04:15:33 WARN: Detected persistent store unavailability; updates will be cached until it recovers
[env: test-dev] 2019/12/21 04:15:33 ERROR: Error initializing store: failed to get existing items prior to Init: MissingRegion: could not find region configuration
[env: test-dev] 2019/12/21 04:15:42 WARN: Timeout encountered waiting for LaunchDarkly client initialization
[env: test-dev] 2019/12/21 04:15:42 ERROR: Error initializing LaunchDarkly client for test-dev: timeout encountered waiting for LaunchDarkly client initialization

Config

    [main]
    streamUri = "https://stream.launchdarkly.com"
    baseUri = "https://app.launchdarkly.com"
    exitOnError = true
    port = 8030
    heartbeatIntervalSecs = 15

    #[redis]
    #host = "redis.default.svc.cluster.local"
    #port = 6379
    #localTtl = 30000

    [DynamoDB]
    enabled = true
    url = "http://dynamodb:8000"
    localTtl = 30000

    [events]
    eventsUri = "https://events.launchdarkly.com"
    sendEvents = true
    flushIntervalSecs = 5
    samplingInterval = 0
    capacity = 10000

    [environment "test-dev"]
    sdkKey = "real-key-goes here"
    mobileKey = ""
    envId = ""
    prefix="ld:test:dev"
    tableName = "DEV_LAUNCHDARKLY"

    [prometheus]
    enabled = true
    port = 8031
    prefix = ""
---

In Kubernetes deployment of relay I inject below three

        env:
          - name: AWS_ACCESS_KEY_ID
            value: >-
              fake_access
          - name: AWS_SECRET_ACCESS_KEY
            value: >-
              fake_secret_access
          - name: AWS_DEFAULT_REGION
            value: >-
              us-west-2

@eli-darkly
Copy link
Contributor

@missourian55 - Have you tried setting the variable AWS_REGION instead of AWS_DEFAULT_REGION? I believe that some of the AWS tools use one and some use the other, and that the AWS Go SDK used by Relay might require AWS_REGION. Relay does not directly set any of those AWS parameters so it is really just a matter of setting the right environment variables.

@missourian55
Copy link
Author

missourian55 commented Dec 21, 2019

Please ignore below comments, documentation clearly dictates that tables has to be created before hand. All working now..

@eli-darkly Thank you that resolved "missing region" error, do I need to create the table in advance or relay proxy will create the required tables? I am seeing a new error

[env: test-dev] 2019/12/21 15:57:54 WARN: Detected persistent store unavailability; updates will be cached until it recovers
[env: test-dev] 2019/12/21 15:57:54 ERROR: Error initializing store: failed to get existing items prior to Init: ResourceNotFoundException: Cannot do operations on a non-existent table
	status code: 400, request id: 7a04b629-67bc-434c-96ba-1228f98a8b38
[env: test-dev] 2019/12/21 15:58:03 WARN: Timeout encountered waiting for LaunchDarkly client initialization
[env: test-dev] 2019/12/21 15:58:03 ERROR: Error initializing LaunchDarkly client for test-dev: timeout encountered waiting for LaunchDarkly client initialization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants