Skip to content

Commit

Permalink
feat(): first implementation of dynamodb repository
Browse files Browse the repository at this point in the history
compliant with Gravitee.io 1.5

fix gravitee-io/issues#558
  • Loading branch information
NicolasGeraud committed May 14, 2017
1 parent 00ce57d commit f051980
Show file tree
Hide file tree
Showing 56 changed files with 5,776 additions and 128 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,3 +20,4 @@ target/
.classpath
.settings/
.project
native-libs
99 changes: 82 additions & 17 deletions README.md
Expand Up @@ -4,35 +4,100 @@

AWS DynamoDB repository

## Requirement
## Installing
Move the *gravitee-repository-dynamodb-1.0.0-SNAPSHOT.zip* in the **Gravitee** */plugins* directory.

The minimum requirement is :
* Maven3
* Jdk8
## Create tables
You can create tables using the [Amazon aws CLI](http://docs.aws.amazon.com/cli/latest/).
All scripts are located in the `scripts` folder.
If you want to create table on your local dynamoDb, you have to provide the endpoint url:
```
$ cd scripts
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-api.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-apikey.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-application.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-event.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-eventsearchindex.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-group.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-membership.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-page.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-plan.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-subscription.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-tag.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-tenant.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-user.json
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json file://createtable-view.json
```

## Configure

For user gravitee snapshot, You need the declare the following repository in you maven settings :
### Credentials
You can configure credentials throw `gravitee.yml`

https://oss.sonatype.org/content/repositories/snapshots
```
management:
type: dynamodb
dynamodb:
#http://docs.aws.amazon.com/general/latest/gr/rande.html#ddb_region
awsRegion: eu-west-2
awsAccessKeyId: YOUR-ACCESS-KEY-ID
awsSecretKey: YOUR-SECRET-ACCESS-KEY
```

Or you can use the default AWS credential mechanism to set options:
http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.html

This means you can set credentials via :
1. Environment variables
2. Java system properties
3. The default credentials profile file
4. Amazon ECS container credentials
5. EC2 instance profile credentials


## Building
### How to run a local DynamoDB
You can setup a local DynamoDB following this guide: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

But to get started quickly, we provide a Docker image
```
$ git clone https://github.com/gravitee-io/gravitee-repository-dynamodb.git
$ cd gravitee-repository-dynamodb
$ mvn clean package
docker run -p 8000:8000 graviteeio/dynamodb
```

## Installing
To configure Gravitee.io APIM to connect to your local instance you have to configure your local endpoint:

Unzip the gravitee-repository-dynamodb-1.0.0-SNAPSHOT.zip in the gravitee home directory.

```
management:
type: dynamodb
dynamodb:
#http://docs.aws.amazon.com/general/latest/gr/rande.html#ddb_region
awsRegion: eu-west-2
awsAccessKeyId: local-dynamodb
awsSecretKey: xxx
awsEndpoint: http://localhost:8000
```

And configure your AWS CLI to use your local dynamodb :
```
$ export AWS_ACCESS_KEY_ID=local-dynamodb
$ export AWS_SECRET_ACCESS_KEY=xxx
$ aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json ...
```

## Configuration
## Development
### Requirement

repository.dynamodb options :
The minimum requirement is :
* Maven3
* Jdk8

| Parameter | default |
| ------------------------------------------------ | ---------: |
For user gravitee snapshot, You need the declare the following repository in you maven settings :

https://oss.sonatype.org/content/repositories/snapshots
### Building

```
$ git clone https://github.com/gravitee-io/gravitee-repository-dynamodb.git
$ cd gravitee-repository-dynamodb
$ mvn clean package
```

0 comments on commit f051980

Please sign in to comment.