Skip to content
This repository was archived by the owner on Nov 22, 2022. It is now read-only.
Open
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
13 changes: 13 additions & 0 deletions aws/parameterstore-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Thumbs.db
.DS_Store
.gradle
build/
target/
out/
.idea
*.iml
*.ipr
*.iws
.project
.settings
.classpath
4 changes: 4 additions & 0 deletions aws/parameterstore-demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM openjdk:8u171-alpine3.7
RUN apk --no-cache add curl
COPY build/libs/*-all.jar parameterstore-demo.jar
CMD java ${JAVA_OPTS} -jar parameterstore-demo.jar
9 changes: 9 additions & 0 deletions aws/parameterstore-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Micronaut & AWS Metadata/Parameter Store Demo

The sample project contains three files of interest:

1. `src/main/groovy/com/example/bootstrap/Bootstrap.groovy` - access and log out AWS metadata from the `ServiceStartedEvent`
2. `src/main/resources/bootstrap.yml` - configures distributed configuration from Parameter Store
3. `src/main/groovy/com/example/controllers/AmazonConfigurationController.groovy` - binds to a Parameter Store value and renders it to the controller response

Note that `Bootstrap` and `AmazonConfigurationController` require an EC2 environment to be enabled.
54 changes: 54 additions & 0 deletions aws/parameterstore-demo/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
plugins {
id "io.spring.dependency-management" version "1.0.6.RELEASE"
id "com.github.johnrengelman.shadow" version "4.0.2"
}

apply plugin:"application"
apply plugin:"groovy"

version "0.1"
group "com.example"

repositories {
mavenLocal()
mavenCentral()
maven { url "https://jcenter.bintray.com" }
}

dependencyManagement {
imports {
mavenBom 'io.micronaut:micronaut-bom:1.1.0'
}
}

dependencies {
compile "io.micronaut:micronaut-http-client"
compile "io.micronaut:micronaut-http-server-netty"
compile "io.micronaut:micronaut-runtime-groovy"
compile "io.micronaut:micronaut-validation"
compile "io.micronaut:micronaut-management"
compile "io.micronaut:micronaut-discovery-client"
compile "io.micronaut.configuration:micronaut-aws-common"
compile "com.amazonaws:aws-java-sdk-ssm:1.11.308"

compileOnly "io.micronaut:micronaut-inject-groovy"
runtime "ch.qos.logback:logback-classic:1.2.3"
testCompile("org.spockframework:spock-core") {
exclude group: "org.codehaus.groovy", module: "groovy-all"
}
testCompile "io.micronaut:micronaut-inject-groovy"
testCompile "junit:junit:4.12"
testCompile "io.micronaut:micronaut-inject-java"
testCompile "org.hamcrest:hamcrest-all:1.3"
}

shadowJar {
mergeServiceFiles()
}

run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1')

mainClassName = "com.example.Application"
tasks.withType(GroovyCompile) {
groovyOptions.forkOptions.jvmArgs.add('-Dgroovy.parameters=true')
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Sat Feb 09 15:58:24 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
172 changes: 172 additions & 0 deletions aws/parameterstore-demo/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions aws/parameterstore-demo/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions aws/parameterstore-demo/micronaut-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
profile: service
defaultPackage: com.example
---
testFramework: spock
sourceLanguage: groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.example

import io.micronaut.runtime.Micronaut
import groovy.transform.CompileStatic

@CompileStatic
class Application {
static void main(String[] args) {
Micronaut.run(Application)
}
}
Loading