Move Redis cluster docker yml to separate file (#11162)

This commit is contained in:
Martin Angers 2023-04-12 15:14:28 -04:00 committed by GitHub
parent 1ebfbb14eb
commit 9aab3d628c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 100 additions and 90 deletions

View File

@ -60,7 +60,7 @@ jobs:
# Pre-starting dependencies here means they are ready to go when we need them. # Pre-starting dependencies here means they are ready to go when we need them.
- name: Start Infra Dependencies - name: Start Infra Dependencies
# Use & to background this # Use & to background this
run: FLEET_MYSQL_IMAGE=${{ matrix.mysql }} docker-compose up -d mysql_test redis redis-cluster-1 redis-cluster-2 redis-cluster-3 redis-cluster-4 redis-cluster-5 redis-cluster-6 redis-cluster-setup minio saml_idp mailhog mailpit & run: FLEET_MYSQL_IMAGE=${{ matrix.mysql }} docker-compose -f docker-compose.yml -f docker-compose-redis-cluster.yml up -d mysql_test redis redis-cluster-1 redis-cluster-2 redis-cluster-3 redis-cluster-4 redis-cluster-5 redis-cluster-6 redis-cluster-setup minio saml_idp mailhog mailpit &
# It seems faster not to cache Go dependencies # It seems faster not to cache Go dependencies
- name: Install Go Dependencies - name: Install Go Dependencies

View File

@ -0,0 +1,89 @@
---
version: "2"
services:
redis-cluster-setup:
image: redis:5
command: redis-cli --cluster create 172.20.0.31:7001 172.20.0.32:7002 172.20.0.33:7003 172.20.0.34:7004 172.20.0.35:7005 172.20.0.36:7006 --cluster-yes --cluster-replicas 1
networks:
cluster_network:
ipv4_address: 172.20.0.30
depends_on:
- redis-cluster-1
- redis-cluster-2
- redis-cluster-3
- redis-cluster-4
- redis-cluster-5
- redis-cluster-6
redis-cluster-1:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7001:7001"
volumes:
- ./tools/redis-tests/redis-cluster-1.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.31
redis-cluster-2:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7002:7002"
volumes:
- ./tools/redis-tests/redis-cluster-2.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.32
redis-cluster-3:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7003:7003"
volumes:
- ./tools/redis-tests/redis-cluster-3.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.33
redis-cluster-4:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7004:7004"
volumes:
- ./tools/redis-tests/redis-cluster-4.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.34
redis-cluster-5:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7005:7005"
volumes:
- ./tools/redis-tests/redis-cluster-5.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.35
redis-cluster-6:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7006:7006"
volumes:
- ./tools/redis-tests/redis-cluster-6.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.36
networks:
cluster_network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/24

View File

@ -81,86 +81,6 @@ services:
ports: ports:
- "6379:6379" - "6379:6379"
redis-cluster-setup:
image: redis:5
command: redis-cli --cluster create 172.20.0.31:7001 172.20.0.32:7002 172.20.0.33:7003 172.20.0.34:7004 172.20.0.35:7005 172.20.0.36:7006 --cluster-yes --cluster-replicas 1
networks:
cluster_network:
ipv4_address: 172.20.0.30
depends_on:
- redis-cluster-1
- redis-cluster-2
- redis-cluster-3
- redis-cluster-4
- redis-cluster-5
- redis-cluster-6
redis-cluster-1:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7001:7001"
volumes:
- ./tools/redis-tests/redis-cluster-1.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.31
redis-cluster-2:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7002:7002"
volumes:
- ./tools/redis-tests/redis-cluster-2.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.32
redis-cluster-3:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7003:7003"
volumes:
- ./tools/redis-tests/redis-cluster-3.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.33
redis-cluster-4:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7004:7004"
volumes:
- ./tools/redis-tests/redis-cluster-4.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.34
redis-cluster-5:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7005:7005"
volumes:
- ./tools/redis-tests/redis-cluster-5.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.35
redis-cluster-6:
image: redis:5
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- "7006:7006"
volumes:
- ./tools/redis-tests/redis-cluster-6.conf:/usr/local/etc/redis/redis.conf
networks:
cluster_network:
ipv4_address: 172.20.0.36
saml_idp: saml_idp:
image: fleetdm/docker-idp:latest image: fleetdm/docker-idp:latest
environment: environment:
@ -223,10 +143,3 @@ volumes:
mysql-persistent-volume: mysql-persistent-volume:
data-minio: data-minio:
networks:
cluster_network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/24

View File

@ -71,6 +71,14 @@ Make sure it is available in your `PATH`. To execute the basic unit and integrat
REDIS_TEST=1 MYSQL_TEST=1 make test REDIS_TEST=1 MYSQL_TEST=1 make test
``` ```
Note that on a Linux system, the Redis tests will include running in cluster mode, so the docker Redis Cluster setup must be running. This implies starting the docker dependencies as follows:
```
# start both the default docker-compose.yml and the redis cluster-specific
# docker-compose-redis-cluster.yml
$ docker-compose -f docker-compose.yml -f docker-compose-redis-cluster.yml up
```
### Go unit tests ### Go unit tests
To run all Go unit tests, run the following: To run all Go unit tests, run the following:

View File

@ -24,9 +24,9 @@ import (
"github.com/kolide/kit/version" "github.com/kolide/kit/version"
) )
// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Get AppConfig // Get AppConfig
// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
type appConfigResponse struct { type appConfigResponse struct {
fleet.AppConfig fleet.AppConfig