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

Compare with Current View Page History

« Previous Version 2 Next »


  1. 사전 조건
    1. IntelliJ CE버전이 필요 합니다.
  2. Git 프로젝트를 Import 합니다.
  3. redis container를 실행합니다.
  4. Spring boot 어플리케이션을 실행 합니다.
  5. curl로 호출해 봅니다.

[root@workspace-vm workspace]# git clone https://github.com/Sanses/sanse-reactive-link-shortener-sample-app.git
Cloning into 'sanse-reactive-link-shortener-sample-app'...
remote: Enumerating objects: 79, done.
remote: Counting objects: 100% (79/79), done.
remote: Compressing objects: 100% (67/67), done.
remote: Total 79 (delta 17), reused 45 (delta 3), pack-reused 0
Unpacking objects: 100% (79/79), done.
[root@workspace-vm workspace]# 
[root@workspace-vm workspace]# 
[root@workspace-vm workspace]# ls
sanse-reactive-link-shortener-sample-app
[root@workspace-vm workspace]# cd sanse-reactive-link-shortener-sample-app/
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# ls -al
total 40
drwxr-xr-x. 6 root root  172 May  7 12:17 .
drwxr-xr-x. 3 root root   54 May  7 12:17 ..
drwxr-xr-x. 8 root root  163 May  7 12:17 .git
-rw-r--r--. 1 root root  268 May  7 12:17 .gitignore
-rw-r--r--. 1 root root   77 May  7 12:17 lombok.config
drwxr-xr-x. 3 root root   21 May  7 12:17 .mvn
-rwxr-xr-x. 1 root root 9113 May  7 12:17 mvnw
-rw-r--r--. 1 root root 5810 May  7 12:17 mvnw.cmd
-rw-r--r--. 1 root root 3116 May  7 12:17 pom.xml
-rw-r--r--. 1 root root  951 May  7 12:17 README.md
drwxr-xr-x. 4 root root   30 May  7 12:17 src
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# 
## 프로젝트 빌드
[root@workspace-vm sanse-reactive-link-shortener-sample-app]# ./mvnw clean package
[INFO] Scanning for projects...
~~~~~~~~~~~~~~~~~ 생략 ~~~~~~~~~~~~~~~~~~
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:23 min
[INFO] Finished at: 2019-05-07T12:24:56Z
[INFO] ------------------------------------------------------------------------
## 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