You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »


  1. 사전 조건
    1. Docker Desktop을 설치 합니다.
      1. Windows의 경우 Pro OS가 필요합니다.
    2. IntelliJ CE버전이 필요 합니다.
  2. IntelliJ에서 Git 프로젝트를 Import 합니다.
  3. IntelliJ Teminal에서 redis container를 실행합니다.
  4. IntelliJ에서 Spring boot 어플리케이션을 실행 합니다.
  5. curl로 호출해 봅니다.

## Redis Container 실행
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# docker run -d -p 6379:6379 --name redis redis
Unable to find image 'redis:latest' locally
latest: Pulling from library/redis
27833a3ba0a5: Pull complete 
cde8019a4b43: Pull complete 
97a473b37fb2: Pull complete 
c6fe0dfbb7e3: Pull complete 
39c8f5ba1240: Pull complete 
cfbdd870cf75: Pull complete 
Digest: sha256:000339fb57e0ddf2d48d72f3341e47a8ca3b1beae9bdcb25a96323095b72a79b
Status: Downloaded newer image for redis:latest
8ebd440fdd83ac7cc6c55cc278aedf690420bc63cf3bb5864db12ed78247e0e8
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
8ebd440fdd83        redis               "docker-entrypoint.s   About a minute ago   Up About a minute   0.0.0.0:6379->6379/tcp   redis
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
## 어플리케이션 실행
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# java -jar target/demo-0.0.1-SNAPSHOT.jar &
[1] 39968
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.0.RELEASE)

2019-05-07 12:29:28.572  INFO 39968 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication v0.0.1-SNAPSHOT on workspace-vm with PID 39968 (/root/workspace/sanse-reactive-link-shortener-sample-app/target/demo-0.0.1-SNAPSHOT.jar started by root in /root/workspace/sanse-reactive-link-shortener-sample-app)
2019-05-07 12:29:28.578  INFO 39968 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2019-05-07 12:29:29.347  INFO 39968 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2019-05-07 12:29:29.350  INFO 39968 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-05-07 12:29:29.378  INFO 39968 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 15ms. Found 0 repository interfaces.
2019-05-07 12:29:29.783  WARN 39968 --- [           main] reactor.netty.tcp.TcpResources           : [http] resources will use the default LoopResources: DefaultLoopResources {prefix=reactor-http, daemon=true, selectCount=4, workerCount=4}
2019-05-07 12:29:29.783  WARN 39968 --- [           main] reactor.netty.tcp.TcpResources           : [http] resources will use the default ConnectionProvider: PooledConnectionProvider {name=http, poolFactory=reactor.netty.resources.ConnectionProvider$$Lambda$196/146305349@6483f5ae}
2019-05-07 12:29:31.012  INFO 39968 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port(s): 8080
2019-05-07 12:29:31.016  INFO 39968 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 3.06 seconds (JVM running for 3.582)

[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
## 어플리케이션 호출
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# curl -XPOST http://localhost:8080/link -H "Content-Type: application/json" -d '{"link":"http://wiki.thesanse.com"}'
2019-05-07 12:30:14.689  INFO 39968 --- [-server-epoll-6] io.lettuce.core.EpollProvider            : Starting with epoll library
2019-05-07 12:30:14.691  INFO 39968 --- [-server-epoll-6] io.lettuce.core.KqueueProvider           : Starting without optional kqueue library
{"shortenedLink":"http://localhost:8080/kRqbye"}
## 어플리케이션 종료
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# ps -eaf | grep java
root      39968  34937  0 12:29 pts/0    00:00:08 java -jar target/demo-0.0.1-SNAPSHOT.jar
root      41676  34937  0 12:47 pts/0    00:00:00 grep --color=auto java
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# kill -9 39968
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
[1]+  Killed                  java -jar target/demo-0.0.1-SNAPSHOT.jar
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
  • No labels