...
Widget Connector |
---|
...
- Docker Desktop을 설치 합니다.
- Windows의 경우 Pro OS가 필요합니다.
- IntelliJ CE버전이 필요 합니다.
...
|
Info |
---|
|
...
Info |
---|
https://github.com/spring-academy/reactive-link-shortener-sample-app |
Info | |
---|---|
|
1. Git Fork
2. Git Clone
Code Block | ||
---|---|---|
| ||
C:\Users\sanse\workspace>git clone https://github.com/Sanses/ | ||
Code Block | ||
## 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 .git Cloning into 'reactive-link-shortener-sample-app'... remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (10/10), done. remote: Total 73 (delta 2), reused 0 (delta 0), pack-reused 62 Unpacking objects: 100% (73/73), 57.02 KiB | 70.00 KiB/s, done. C:\Users\sanse\workspace>dir Volume in drive C is Windows Volume Serial Number is 24E4-A55B Directory of C:\Users\sanse\workspace 2020-09-06 오후 09:33 <DIR> . 2020-09-06 오후 09:33 <DIR> .. 2020-09-06 오후 09:33 <DIR> reactive-link-shortener-sample-app COMMAND 0 File(s) CREATED 0 bytes STATUS 3 Dir(s) 93,214,756,864 bytes free |
3. Build Application
Code Block | ||
---|---|---|
| ||
C:\Users\sanse\workspace\reactive-link-shortener-sample-app>mvnw clean Found "C:\Users\sanse\workspace\reactive-link-shortener-sample-app\.mvn\wrapper\maven-wrapper.jar" [INFO] Scanning 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]# for projects... [INFO] [INFO] --------------------------< com.example:demo >-------------------------- [INFO] Building demo 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ demo --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.316 s [INFO] Finished at: 2020-09-06T21:36:09+09:00 [INFO] ------------------------------------------------------------------------ C:\Users\sanse\workspace\reactive-link-shortener-sample-app>mvnw package Found "C:\Users\sanse\workspace\reactive-link-shortener-sample-app\.mvn\wrapper\maven-wrapper.jar" [INFO] Scanning for projects... [INFO] [INFO] --------------------------< com.example:demo >-------------------------- [INFO] Building demo 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ demo --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ demo --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 02:11 min [INFO] Finished at: 2020-09-06T21:38:34+09:00 [INFO] ------------------------------------------------------------------------ |
4. Run Redis Container
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
C:\Users\sanse\workspace\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
bf5952930446: Pull complete
911b8422b695: Pull complete
093b947e0ade: Pull complete
c7616728f575: Pull complete
61a55f107028: Pull complete
0ee3e0cb4e07: Pull complete
Digest: sha256:933c6c01829165885ea8468d87f71127b1cb76a711311e6c63708097e92ee3d1
Status: Downloaded newer image for redis:latest
a1bb2185039c29b801c57ee99644c3179481b33dd73d58fcde90bcf2099a89dc
|
5. Run Application
Code Block | ||
---|---|---|
| ||
Code Block | ||
| ||
C:\Users\sanse\workspace\ & [1] 39968 [root@workspace-vm sanse-reactive-link-shortener-sample-app]# \target>java -jar demo-0.0.1-SNAPSHOT.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.1.0.RELEASE) 20192020-0509-0706 1221:2943: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 3996831.839 WARN 11288 --- [ main] reactor.netty.tcp.TcpResources : [http] resources will use the default LoopResources: DefaultLoopResources {prefix=reactor-http, daemon=true, selectCount=4, workerCount=4} 20192020-0509-0706 1221:2943:2931.783855 WARN 3996811288 --- [ main] reactor.netty.tcp.TcpResources : [http] resources will use the default ConnectionProvider: PooledConnectionProvider {name=http, poolFactory=reactor.netty.resources.ConnectionProvider$$Lambda$196ConnectionProvider$$Lambda$198/146305349@6483f5ae233021551@76b10754} 20192020-0509-0706 1221:2943:3137.012550 INFO 3996811288 --- [ main] o.s.b.web.embedded.netty.NettyWebServer : Netty started on port(s): 8080 20192020-0509-0706 1221:2943:3137.016566 INFO 3996811288 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 311.06739 seconds (JVM running for 313.582) [root@workspace-vm sanse-reactive-link-shortener-sample-app]# | ||
Code Block | ||
57) |
6. Call Api
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
C:\Users\sanse\workspace\## 어플리케이션 호출 [root@workspace-vm sanse-reactive-link-shortener-sample-app]#app>curl curl -XPOST http://localhost:8080/link -H "Content-Type: application/json" -d '"{\"link\":\"http://wiki.thesanseiisanse.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"} | ||||||||
Code Block | ||||||||
## 어플리케이션 종료 [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]# ruEadd"} |