Skip to content

Commit

Permalink
Chore: redis 연결을 위한 설정 파일 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
seonghooni committed Apr 1, 2024
1 parent 641d629 commit 0f8c072
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/depoly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ jobs:
#
# - name: Build with Gradle 8.5
# run: gradle build
- name: yml 파일확인
run: ls

- name: zip file 생성
run: |
Expand Down
2 changes: 2 additions & 0 deletions docker/docker-compose.blue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ services:
- "8081:8080"
# 컨테이너의 이름
container_name: spring-blue
extra_hosts:
- "host.docker.internal:host-gateway"
4 changes: 2 additions & 2 deletions docker/docker-compose.green.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ services:
ports:
- "8082:8080"
container_name: spring-green

extra_hosts:
- "host.docker.internal:host-gateway"

# 도커의 역할
# blue 8081 green 8082
# spring tomcat 8080 임



# Nginx Docker
# 80 -> 8082 -> 8080
2 changes: 1 addition & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ cd /home/ubuntu/app
# 환경변수 DOCKER_APP_NAME을 spring으로 설정
DOCKER_APP_NAME=spring


# 실행중인 blue가 있는지 확인
# 프로젝트의 실행 중인 컨테이너를 확인하고, 해당 컨테이너가 실행 중인지 여부를 EXIST_BLUE 변수에 저장
EXIST_BLUE=$(sudo docker-compose -p ${DOCKER_APP_NAME}-blue -f docker-compose.blue.yml ps | grep Up)
Expand Down Expand Up @@ -47,6 +46,7 @@ else

echo "blue 중단 시작 : $(date +%Y)-$(date +%m)-$(date +%d) $(date +%H):$(date +%M):$(date +%S)" >> /home/ubuntu/deploy.log
sudo docker-compose -p ${DOCKER_APP_NAME}-blue -f docker-compose.blue.yml down

sudo docker image prune -af

echo "blue 중단 완료 : $(date +%Y)-$(date +%m)-$(date +%d) $(date +%H):$(date +%M):$(date +%S)" >> /home/ubuntu/deploy.log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;

Expand All @@ -12,12 +13,18 @@
public class RedisConfig {
@Value("${spring.data.redis.host}")
private String host;

@Value("${spring.data.redis.port}")
private int port;

@Value("${spring.data.redis.password}")
private String password;

@Bean
public RedisConnectionFactory redisConnectionFactory(){
return new LettuceConnectionFactory(host,port);
RedisStandaloneConfiguration config = new RedisStandaloneConfiguration(host, port);
config.setPassword(password);
return new LettuceConnectionFactory(config);
}

}
2 changes: 1 addition & 1 deletion submodule-config

0 comments on commit 0f8c072

Please sign in to comment.