Do Not Think!!!

Posted
Filed under 01010101
Add
$ iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

Delete
$ iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
Posted
Filed under 01010101
AWS EC2 + Ubuntu 14.04 + OpenJDK 8 + AWS SDK Java 이용해서 S3 접속하면 PKIX SSL 에러 발생

Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387) ~[na:1.8.0_91]    at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) ~[na:1.8.0_91]    at sun.security.validator.Validator.validate(Validator.java:260) ~[na:1.8.0_91]    at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324) ~[na:1.8.0_91]    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229) ~[na:1.8.0_91]    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124) ~[na:1.8.0_91]    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1491) ~[na:1.8.0_91]    ... 99 common frames omittedCaused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target    at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141) ~[na:1.8.0_91]    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126) ~[na:1.8.0_91]    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280) ~[na:1.8.0_91]    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382) ~[na:1.8.0_91]    ... 105 common frames omitted

해결방법
$ sudo /var/lib/dpkg/info/ca-certificates-java.postinst configure


참고
http://stackoverflow.com/a/30699960


Posted
Filed under 01010101
$ hostnamectl set-hostname new_hostname

$ vi /etc/hosts
127.0.0.1 new_hostname
Posted
Filed under 01010101
$ gradle -q dependencies


The example of Spring Boot project
+--- org.springframework.boot:spring-boot-devtools: -> 1.3.6.RELEASE
|    +--- org.springframework.boot:spring-boot:1.3.6.RELEASE
|    |    +--- org.springframework:spring-core:4.2.7.RELEASE
|    |    |    \--- commons-logging:commons-logging:1.2
|    |    \--- org.springframework:spring-context:4.2.7.RELEASE
|    |         +--- org.springframework:spring-aop:4.2.7.RELEASE
|    |         |    +--- aopalliance:aopalliance:1.0
|    |         |    +--- org.springframework:spring-beans:4.2.7.RELEASE
|    |         |    |    \--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    |         |    \--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    |         +--- org.springframework:spring-beans:4.2.7.RELEASE (*)
|    |         +--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    |         \--- org.springframework:spring-expression:4.2.7.RELEASE
|    |              \--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    \--- org.springframework.boot:spring-boot-autoconfigure:1.3.6.RELEASE
|         \--- org.springframework.boot:spring-boot:1.3.6.RELEASE (*)
+--- org.springframework.boot:spring-boot-starter-web: -> 1.3.6.RELEASE
|    +--- org.springframework.boot:spring-boot-starter:1.3.6.RELEASE
|    |    +--- org.springframework.boot:spring-boot:1.3.6.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-autoconfigure:1.3.6.RELEASE (*)
|    |    +--- org.springframework.boot:spring-boot-starter-logging:1.3.6.RELEASE
|    |    |    +--- ch.qos.logback:logback-classic:1.1.7
|    |    |    |    +--- ch.qos.logback:logback-core:1.1.7
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.20 -> 1.7.21
|    |    |    +--- org.slf4j:jcl-over-slf4j:1.7.21
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.21
|    |    |    +--- org.slf4j:jul-to-slf4j:1.7.21
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.21
|    |    |    \--- org.slf4j:log4j-over-slf4j:1.7.21
|    |    |         \--- org.slf4j:slf4j-api:1.7.21
|    |    +--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    |    \--- org.yaml:snakeyaml:1.16
|    +--- org.springframework.boot:spring-boot-starter-validation:1.3.6.RELEASE
|    |    +--- org.springframework.boot:spring-boot-starter:1.3.6.RELEASE (*)
|    |    +--- org.apache.tomcat.embed:tomcat-embed-el:8.0.36
|    |    \--- org.hibernate:hibernate-validator:5.2.4.Final
|    |         +--- javax.validation:validation-api:1.1.0.Final
|    |         +--- org.jboss.logging:jboss-logging:3.2.1.Final -> 3.3.0.Final
|    |         \--- com.fasterxml:classmate:1.1.0
|    +--- com.fasterxml.jackson.core:jackson-databind:2.6.7
|    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.6.0 -> 2.6.7
|    |    \--- com.fasterxml.jackson.core:jackson-core:2.6.7
|    +--- org.springframework:spring-web:4.2.7.RELEASE
|    |    +--- org.springframework:spring-aop:4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-beans:4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-context:4.2.7.RELEASE (*)
|    |    \--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    \--- org.springframework:spring-webmvc:4.2.7.RELEASE
|         +--- org.springframework:spring-beans:4.2.7.RELEASE (*)
|         +--- org.springframework:spring-context:4.2.7.RELEASE (*)
|         +--- org.springframework:spring-core:4.2.7.RELEASE (*)
|         +--- org.springframework:spring-expression:4.2.7.RELEASE (*)
|         \--- org.springframework:spring-web:4.2.7.RELEASE (*)
+--- org.springframework.boot:spring-boot-starter-jetty: -> 1.3.6.RELEASE
|    +--- org.eclipse.jetty:jetty-servlets:9.2.17.v20160517
|    |    +--- org.eclipse.jetty:jetty-continuation:9.2.17.v20160517
|    |    +--- org.eclipse.jetty:jetty-http:9.2.17.v20160517
|    |    |    \--- org.eclipse.jetty:jetty-util:9.2.17.v20160517
|    |    +--- org.eclipse.jetty:jetty-util:9.2.17.v20160517
|    |    \--- org.eclipse.jetty:jetty-io:9.2.17.v20160517
|    |         \--- org.eclipse.jetty:jetty-util:9.2.17.v20160517
|    +--- org.eclipse.jetty:jetty-webapp:9.2.17.v20160517
|    |    +--- org.eclipse.jetty:jetty-xml:9.2.17.v20160517
|    |    |    \--- org.eclipse.jetty:jetty-util:9.2.17.v20160517
|    |    \--- org.eclipse.jetty:jetty-servlet:9.2.17.v20160517
|    |         \--- org.eclipse.jetty:jetty-security:9.2.17.v20160517
|    |              \--- org.eclipse.jetty:jetty-server:9.2.17.v20160517
|    |                   +--- javax.servlet:javax.servlet-api:3.1.0
|    |                   +--- org.eclipse.jetty:jetty-http:9.2.17.v20160517 (*)
|    |                   \--- org.eclipse.jetty:jetty-io:9.2.17.v20160517 (*)
|    +--- org.eclipse.jetty.websocket:websocket-server:9.2.17.v20160517
|    |    +--- org.eclipse.jetty.websocket:websocket-common:9.2.17.v20160517
|    |    |    +--- org.eclipse.jetty.websocket:websocket-api:9.2.17.v20160517
|    |    |    +--- org.eclipse.jetty:jetty-util:9.2.17.v20160517
|    |    |    \--- org.eclipse.jetty:jetty-io:9.2.17.v20160517 (*)
|    |    +--- org.eclipse.jetty.websocket:websocket-client:9.2.17.v20160517
|    |    |    +--- org.eclipse.jetty:jetty-util:9.2.17.v20160517
|    |    |    +--- org.eclipse.jetty:jetty-io:9.2.17.v20160517 (*)
|    |    |    \--- org.eclipse.jetty.websocket:websocket-common:9.2.17.v20160517 (*)
|    |    +--- org.eclipse.jetty.websocket:websocket-servlet:9.2.17.v20160517
|    |    |    +--- org.eclipse.jetty.websocket:websocket-api:9.2.17.v20160517
|    |    |    \--- javax.servlet:javax.servlet-api:3.1.0
|    |    +--- org.eclipse.jetty:jetty-servlet:9.2.17.v20160517 (*)
|    |    \--- org.eclipse.jetty:jetty-http:9.2.17.v20160517 (*)
|    \--- org.eclipse.jetty.websocket:javax-websocket-server-impl:9.2.17.v20160517
|         +--- org.eclipse.jetty:jetty-annotations:9.2.17.v20160517
|         |    +--- org.eclipse.jetty:jetty-plus:9.2.17.v20160517
|         |    |    +--- org.eclipse.jetty:jetty-webapp:9.2.17.v20160517 (*)
|         |    |    \--- org.eclipse.jetty:jetty-jndi:9.2.17.v20160517
|         |    |         \--- org.eclipse.jetty:jetty-util:9.2.17.v20160517
|         |    +--- org.eclipse.jetty:jetty-webapp:9.2.17.v20160517 (*)
|         |    +--- javax.annotation:javax.annotation-api:1.2
|         |    +--- org.ow2.asm:asm:5.0.1
|         |    \--- org.ow2.asm:asm-commons:5.0.1
|         |         \--- org.ow2.asm:asm-tree:5.0.1
|         |              \--- org.ow2.asm:asm:5.0.1
|         +--- org.eclipse.jetty.websocket:javax-websocket-client-impl:9.2.17.v20160517
|         |    +--- org.eclipse.jetty.websocket:websocket-client:9.2.17.v20160517 (*)
|         |    \--- javax.websocket:javax.websocket-api:1.0
|         +--- org.eclipse.jetty.websocket:websocket-server:9.2.17.v20160517 (*)
|         \--- javax.websocket:javax.websocket-api:1.0
+--- org.springframework.boot:spring-boot-starter-actuator: -> 1.3.6.RELEASE
|    +--- org.springframework.boot:spring-boot-starter:1.3.6.RELEASE (*)
|    \--- org.springframework.boot:spring-boot-actuator:1.3.6.RELEASE
|         +--- org.springframework.boot:spring-boot:1.3.6.RELEASE (*)
|         +--- org.springframework.boot:spring-boot-autoconfigure:1.3.6.RELEASE (*)
|         +--- com.fasterxml.jackson.core:jackson-databind:2.6.7 (*)
|         +--- org.springframework:spring-core:4.2.7.RELEASE (*)
|         \--- org.springframework:spring-context:4.2.7.RELEASE (*)
+--- org.springframework.boot:spring-boot-starter-security: -> 1.3.6.RELEASE
|    +--- org.springframework.boot:spring-boot-starter:1.3.6.RELEASE (*)
|    +--- org.springframework:spring-aop:4.2.7.RELEASE (*)
|    +--- org.springframework.security:spring-security-config:4.0.4.RELEASE
|    |    +--- aopalliance:aopalliance:1.0
|    |    +--- org.springframework.security:spring-security-core:4.0.4.RELEASE
|    |    |    +--- aopalliance:aopalliance:1.0
|    |    |    +--- org.springframework:spring-aop:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    |    |    +--- org.springframework:spring-beans:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    |    |    +--- org.springframework:spring-context:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    |    |    +--- org.springframework:spring-core:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    |    |    \--- org.springframework:spring-expression:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-aop:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-beans:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-context:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    |    \--- org.springframework:spring-core:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|    \--- org.springframework.security:spring-security-web:4.0.4.RELEASE
|         +--- aopalliance:aopalliance:1.0
|         +--- org.springframework.security:spring-security-core:4.0.4.RELEASE (*)
|         +--- org.springframework:spring-beans:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|         +--- org.springframework:spring-context:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|         +--- org.springframework:spring-core:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|         +--- org.springframework:spring-expression:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
|         \--- org.springframework:spring-web:4.2.5.RELEASE -> 4.2.7.RELEASE (*)
+--- org.springframework.boot:spring-boot-starter-data-jpa: -> 1.3.6.RELEASE
|    +--- org.springframework.boot:spring-boot-starter:1.3.6.RELEASE (*)
|    +--- org.springframework.boot:spring-boot-starter-aop:1.3.6.RELEASE
|    |    +--- org.springframework.boot:spring-boot-starter:1.3.6.RELEASE (*)
|    |    +--- org.springframework:spring-aop:4.2.7.RELEASE (*)
|    |    \--- org.aspectj:aspectjweaver:1.8.9
|    +--- org.springframework.boot:spring-boot-starter-jdbc:1.3.6.RELEASE
|    |    +--- org.springframework.boot:spring-boot-starter:1.3.6.RELEASE (*)
|    |    +--- org.apache.tomcat:tomcat-jdbc:8.0.36
|    |    |    \--- org.apache.tomcat:tomcat-juli:8.0.36
|    |    \--- org.springframework:spring-jdbc:4.2.7.RELEASE
|    |         +--- org.springframework:spring-beans:4.2.7.RELEASE (*)
|    |         +--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    |         \--- org.springframework:spring-tx:4.2.7.RELEASE
|    |              +--- org.springframework:spring-beans:4.2.7.RELEASE (*)
|    |              \--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    +--- org.hibernate:hibernate-entitymanager:4.3.11.Final
|    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA -> 3.3.0.Final
|    |    +--- org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1
|    |    +--- org.hibernate:hibernate-core:4.3.11.Final
|    |    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA -> 3.3.0.Final
|    |    |    +--- org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1
|    |    |    +--- dom4j:dom4j:1.6.1
|    |    |    |    \--- xml-apis:xml-apis:1.0.b2
|    |    |    +--- org.hibernate.common:hibernate-commons-annotations:4.0.5.Final
|    |    |    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA -> 3.3.0.Final
|    |    |    |    \--- org.jboss.logging:jboss-logging-annotations:1.2.0.Beta1
|    |    |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final
|    |    |    +--- org.javassist:javassist:3.18.1-GA
|    |    |    +--- antlr:antlr:2.7.7
|    |    |    \--- org.jboss:jandex:1.1.0.Final
|    |    +--- dom4j:dom4j:1.6.1 (*)
|    |    +--- org.hibernate.common:hibernate-commons-annotations:4.0.5.Final (*)
|    |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final
|    |    \--- org.javassist:javassist:3.18.1-GA
|    +--- javax.transaction:javax.transaction-api:1.2
|    +--- org.springframework.data:spring-data-jpa:1.9.4.RELEASE
|    |    +--- org.springframework.data:spring-data-commons:1.11.4.RELEASE
|    |    |    +--- org.springframework:spring-core:4.1.9.RELEASE -> 4.2.7.RELEASE (*)
|    |    |    +--- org.springframework:spring-beans:4.1.9.RELEASE -> 4.2.7.RELEASE (*)
|    |    |    +--- org.slf4j:slf4j-api:1.7.13 -> 1.7.21
|    |    |    \--- org.slf4j:jcl-over-slf4j:1.7.13 -> 1.7.21 (*)
|    |    +--- org.springframework:spring-orm:4.1.9.RELEASE -> 4.2.7.RELEASE
|    |    |    +--- org.springframework:spring-beans:4.2.7.RELEASE (*)
|    |    |    +--- org.springframework:spring-core:4.2.7.RELEASE (*)
|    |    |    +--- org.springframework:spring-jdbc:4.2.7.RELEASE (*)
|    |    |    \--- org.springframework:spring-tx:4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-context:4.1.9.RELEASE -> 4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-aop:4.1.9.RELEASE -> 4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-tx:4.1.9.RELEASE -> 4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-beans:4.1.9.RELEASE -> 4.2.7.RELEASE (*)
|    |    +--- org.springframework:spring-core:4.1.9.RELEASE -> 4.2.7.RELEASE (*)
|    |    +--- org.slf4j:slf4j-api:1.7.13 -> 1.7.21
|    |    \--- org.slf4j:jcl-over-slf4j:1.7.13 -> 1.7.21 (*)
|    \--- org.springframework:spring-aspects:4.2.7.RELEASE
|         \--- org.aspectj:aspectjweaver:1.8.9
+--- pl.allegro.tech.boot:handlebars-spring-boot-starter:0.2.12
|    +--- com.github.jknack:handlebars-springmvc:4.0.4
|    |    +--- com.github.jknack:handlebars:4.0.4 -> 4.0.5
|    |    |    +--- org.apache.commons:commons-lang3:3.1 -> 3.4
|    |    |    +--- org.antlr:antlr4-runtime:4.5.1-1
|    |    |    +--- org.mozilla:rhino:1.7R4
|    |    |    \--- org.slf4j:slf4j-api:1.6.4 -> 1.7.21
|    |    \--- org.springframework:spring-webmvc:3.1.1.RELEASE -> 4.2.7.RELEASE (*)
|    +--- org.springframework.boot:spring-boot-starter-web:1.3.2.RELEASE -> 1.3.6.RELEASE (*)
|    \--- com.github.jknack:handlebars-guava-cache:4.0.4
|         +--- com.github.jknack:handlebars:4.0.4 -> 4.0.5 (*)
|         \--- com.google.guava:guava:14.0.1
+--- com.github.jknack:handlebars-helpers:4.0.5
|    \--- com.github.jknack:handlebars:4.0.5 (*)
+--- com.amazonaws:aws-java-sdk-ses:1.11.13
|    \--- com.amazonaws:aws-java-sdk-core:1.11.13
|         +--- commons-logging:commons-logging:1.1.3 -> 1.2
|         +--- org.apache.httpcomponents:httpclient:4.5.2
|         |    +--- org.apache.httpcomponents:httpcore:4.4.4 -> 4.4.5
|         |    +--- commons-logging:commons-logging:1.2
|         |    \--- commons-codec:commons-codec:1.9
|         +--- com.fasterxml.jackson.core:jackson-databind:2.6.6 -> 2.6.7 (*)
|         +--- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.6.6
|         |    \--- com.fasterxml.jackson.core:jackson-core:2.6.6 -> 2.6.7
|         \--- joda-time:joda-time:2.8.1 -> 2.8.2
+--- commons-io:commons-io:2.5
+--- org.apache.commons:commons-lang3:3.4
+--- org.apache.commons:commons-collections4:4.1
+--- org.projectlombok:lombok:1.16.8
\--- org.mariadb.jdbc:mariadb-java-client:1.4.6
Posted
Filed under 01010101
ntp 설치
$ sudo apt-get install ntp

ntp 실행
$ sudo service ntp start

처음 시간맞추기
$ sudo service ntp stop
$ sudo ntpd -gq
$ sudo service ntp start
Posted
Filed under 01010101
location /
proxy_pass http://wsbackend;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Posted
Filed under 01010101

Open JDK 8

$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk


Nginx Latest Stable

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:nginx/stable
$ sudo apt-get update
$ sudo apt-get install nginx


Gradle Latest Stable

$ sudo add-apt-repository ppa:cwchien/gradle
$ sudo apt-get update
$ sudo apt-get install gradle
Posted
Filed under 글로 기록하기
간단하게 빠르게 restful api 프로토타이핑을 해야 하는 상황에서
node.js 로 할려다가,

Travelog API 를 node.js 만들다 보니, 콜백 스트레스가 너무 심함
현재 다른 프로젝트를 Spring 으로 진행하고 있는데,
너무 오랜만에 다시 Spring 을 접했기 때문에 너무 헤매고 있는 상황.

Spring 에 익숙해지는 계기가 될 수 있지 않을까 하는 기대감에 Spring Boot 사용 결정!





Posted
Filed under 01010101

install nginx

$ sudo apt-get install nginx

install mariadb

$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
$ sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'

$ sudo apt-get update
$ sudo apt-get install mariadb-server

install tomcat

$ sudo apt-get install tomcat7
download tomcat8
https://tomcat.apache.org/download-80.cgi

install java

$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk

configure nginx

$ sudo vi /etc/nginx/sites-enable/example.com
server {
    server_name example.com;
    rewrite ^ http://www.example.com$request_uri? permanent;
}

server {
    server_name *.example.com;

    root /var/lib/tomcat-8/webapps/ROOT/;
    index index.html;

    location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8080/;
    }
}

configure tomcat

...