1. 사전 조건
    1. SRRD DevEnv on Desktop PC 환경설정을 검토 합니다.


SWRS Docker 배경지식



1. Git Fork

2. Git Clone

C:\Users\sanse\workspace>git clone https://github.com/Sanses/reactive-link-shortener-sample-app.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
               0 File(s)              0 bytes
               3 Dir(s)  93,214,756,864 bytes free

3. Build Application

mvnw clean package
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 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

docker run -d -p 6379:6379 --name redis redis
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

java -jar demo-0.0.1-SNAPSHOT.jar
C:\Users\sanse\workspace\reactive-link-shortener-sample-app\target>java -jar demo-0.0.1-SNAPSHOT.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.0.RELEASE)

2020-09-06 21:43:31.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}
2020-09-06 21:43:31.855  WARN 11288 --- [           main] reactor.netty.tcp.TcpResources           : [http] resources will use the default ConnectionProvider: PooledConnectionProvider {name=http, poolFactory=reactor.netty.resources.ConnectionProvider$$Lambda$198/233021551@76b10754}
2020-09-06 21:43:37.550  INFO 11288 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port(s): 8080
2020-09-06 21:43:37.566  INFO 11288 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 11.739 seconds (JVM running for 13.57)

6. Call Api

curl -XPOST http://localhost:8080/link -H "Content-Type: application/json" -d "{\"link\":\"http://wiki.iisanse.com\"}"
C:\Users\sanse\workspace\reactive-link-shortener-sample-app>curl -XPOST http://localhost:8080/link -H "Content-Type: application/json" -d "{\"link\":\"http://wiki.iisanse.com\"}"
{"shortenedLink":"http://localhost:8080/ruEadd"}

  • No labels
Write a comment…