예제 Redis 구성
예제 Redis 구성 (Example Redis Configuration)
Redis에 의존하는 프로젝트를 위한 지속적 통합(CI) 파이프라인 구성 방법을 안내합니다. Drone이 처음이라면 먼저 튜토리얼과 빌드 구성 가이드를 읽어 보세요.
출처: Drone CI Docs
본문
기본 예제 (Basic Example)
아래 예제는 Redis 서비스 컨테이너를 실행하는 파이프라인을 보여줍니다. 데이터베이스 서버는 redis:6379에서 사용할 수 있으며, 호스트명은 서비스 컨테이너 이름과 일치합니다.
kind: pipeline
name: default
steps:
- name: test
image: redis
commands:
- sleep 5
- redis-cli -h redis ping
- redis-cli -h redis set FOO bar
- redis-cli -h redis get FOO
services:
- name: redis
image: redis
자주 겪는 문제 (Common Problems)
초기화 (Initialization)
컨테이너에 연결할 수 없다면 Redis가 초기화를 마치고 연결을 받기 시작할 충분한 시간을 확보했는지 확인하세요.
kind: pipeline
name: default
steps:
- name: test
image: redis
commands:
- sleep 15
- redis-cli -h redis ping
잘못된 호스트명 (Incorrect Hostname)
Redis 컨테이너에 연결할 때는 127.0.0.1이나 localhost를 사용할 수 없습니다. 연결에 실패한다면 redis 서비스 컨테이너 이름에 해당하는 올바른 호스트명을 사용하고 있는지 확인하세요.
잘못된 예:
steps:
- name: test
image: redis
commands:
- sleep 15
- redis-cli -h localhost ping
올바른 예:
steps:
- name: test
image: redis
commands:
- sleep 15
- redis-cli -h redis ping
더 알아보기 (Learn more)
- Example Redis Configuration — Redis 서비스 예제
- Services — 서비스 컨테이너 개요