로컬 환경에서는 redis를 설치한 후 실행이 정상적으로 작동이 되었는데, Github Actions를 통해 빌드하고 도커 이미지를 만들어서 배포하는 과정에서 연결이 안되는 문제가 발생하였다.
🚨버그가 발생한 상황
오류 메시지
io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:6379
Caused by: java.net.ConnectException: Connection refused
at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]
at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946) ~[na:na]
at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337) ~[netty-transport-4.1.109.Final.jar!/:4.1.109.Final]
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:339) ~[netty-transport-4.1.109.Final.jar!/:4.1.109.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776) ~[netty-transport-4.1.109.Final.jar!/:4.1.109.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.109.Final.jar!/:4.1.109.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.109.Final.jar!/:4.1.109.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.109.Final.jar!/:4.1.109.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.109.Final.jar!/:4.1.109.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.109.Final.jar!/:4.1.109.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.109.Final.jar!/:4.1.109.Final]
at java.base/java.lang.Thread.run(Thread.java:840) ~[na:na]
🤗 해결
Docker Compose(여러 컨테이너로 구성된 애플리케이션을 정의하고 실행하기 위한 도구)를 사용해서 redis container를 종속하는 spring server를 실행하여 해결하였다.
🐞 버그 설명
로컬 환경에서는 redis를 설치한 후 실행이 정상적으로 작동이 되었는데, Github Actions를 통해 빌드하고 도커 이미지를 만들어서 배포하는 과정에서 연결이 안되는 문제가 발생하였다.
🚨버그가 발생한 상황
🤗 해결
Docker Compose(여러 컨테이너로 구성된 애플리케이션을 정의하고 실행하기 위한 도구)를 사용해서 redis container를 종속하는 spring server를 실행하여 해결하였다.