Saturday, May 21, 2016

Upload HTTPS Cert to Cloudfront

23:28:23 ~/data/dronze/keys $ aws iam upload-server-certificate \
   --server-certificate-name dronze.com --certificate-body file://dronze_com_crt.pem \
   --private-key file://dronze_com.key --certificate-chain file://dronze_com.ca-bundle \
   --path /cloudfront/production/
{
    "ServerCertificateMetadata": {
        "ServerCertificateId": "ASCAIDAGVOZBPZ6VJTK7A",
        "ServerCertificateName": "dronze.com",
        "Expiration": "2017-05-22T23:59:59Z",
        "Path": "/cloudfront/production/",
        "Arn": "arn:aws:iam::705212546939:server-certificate/cloudfront/production/dronze.com",
        "UploadDate": "2016-05-22T06:30:39.224Z"
    }
}

Tuesday, May 03, 2016

How to set your log4j2 file to support the lambda appender.

Add to your gradle config:

compile 'com.amazonaws:aws-lambda-java-log4j:1.0.0'
and How to set your log4j2 file to support the lambda appender.


<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO" packages="com.amazonaws.services.lambda.runtime.log4j">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %C - %msg%n"/>
</Console>
<LambdaAppender name="LambdaAppender">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %X{AWSRequestId} %-5p %c{1}:%L - %m%n"/>
</LambdaAppender>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console" />
</Root>
<Logger name="com.dronze.aws.lambda" level="debug" additivity="false">
<AppenderRef ref="LambdaAppender" />
</Logger>
</Loggers>
</Configuration>

Monday, May 02, 2016

Allowing profiles to be passed to bootRun

Allowing profiles to be passed to bootRun

bootRun {
addResources = false
//pass command line args
if ( project.hasProperty('jvmArgs') ) {
jvmArgs project.jvmArgs.split('\\s+')
}
}
view raw bootRun.gradle hosted with ❤ by GitHub

$ ./gradlew bootRun -PjvmArgs="-Dspring.profiles.active=docker"

Spring Profiles

Spring Profiles

Spring Profiles provide a way to segregate parts of your application configuration and make it only available in certain environments. Any@Component or @Configuration can be marked with @Profile to limit when it is loaded:
@Configuration
@Profile("production")
public class ProductionConfiguration {

    // ...

}
In the normal Spring way, you can use a spring.profiles.active Environment property to specify which profiles are active. You can specify the property in any of the usual ways, for example you could include it in your application.properties:
spring.profiles.active=dev,hsqldb
or specify on the command line using the switch --spring.profiles.active=dev,hsqldb.