Skip to content

Commit

Permalink
ZDM-295 Enhance docker-compose components
Browse files Browse the repository at this point in the history
* Created Dockerfiles for jumphost, proxy, and client
* Migrated installation of packages and user setup from docker-entrypoint into
  Dockerfile for jumphost, proxy, and client
* Increased retry sleep time to 20s for jumphost's ssh connection test,
  and key scan
* Increased retry sleep time to 20s for proxy's ssh key check
* Added functionality to jumphost to detect container names and ip address of
  proxy, origin (Cassandra node), and target (Cassandra node) containers and
  record information to a shared hosts file
* Added functionality to client to read ip address information of proxies and
  Cassandra nodes from shared hosts file
* Updated test carried out by client to initially insert data into the
  Cassandra origin node, then every minute insert data via the ZDM proxy, read
  data back via ZDM proxy, and then read data back directly from each
  Cassandra node
* Fixed issue where ansible will fail to provision proxy hosts if less than
  three existed by making the jumphost dynamically generate the
  zdm_ansible_inventory file
  • Loading branch information
ossarga committed Sep 30, 2022
1 parent ec5d978 commit fd0e80c
Show file tree
Hide file tree
Showing 13 changed files with 438 additions and 216 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NETWORK_SUBNET=192.168.100.0/24
35 changes: 0 additions & 35 deletions compose/client-entrypoint.sh

This file was deleted.

110 changes: 0 additions & 110 deletions compose/jumphost-entrypoint.sh

This file was deleted.

46 changes: 0 additions & 46 deletions compose/proxy-entrypoint.sh

This file was deleted.

7 changes: 0 additions & 7 deletions compose/zdm_ansible_inventory

This file was deleted.

40 changes: 22 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,60 @@ networks:
ipam:
driver: default
config:
- subnet: 192.168.100.0/24
- subnet: $NETWORK_SUBNET

services:
origin:
image: cassandra:3.11
restart: unless-stopped
environment:
- CASSANDRA_CLUSTER_NAME='origin_cluster'
- CASSANDRA_NUM_TOKENS=32
- CASSANDRA_DC=datacenter1
- CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch
networks:
proxy:

target:
image: cassandra:4.0
restart: unless-stopped
environment:
- CASSANDRA_CLUSTER_NAME='target_cluster'
- CASSANDRA_DC=datacenter1
- CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch
networks:
proxy:

proxy:
image: thesoul/ubuntu-dind:docker-20.10.12
build: ./docker-compose/services/proxy
restart: unless-stopped
tty: true
privileged: true
volumes:
- .:/opt/zdm-proxy-automation
- ./compose/keys:/run/keys
entrypoint:
- /opt/zdm-proxy-automation/compose/proxy-entrypoint.sh
- ./docker-compose/services/proxy/proxy-entrypoint.sh:/usr/bin/proxy-entrypoint.sh
- ./docker-compose/share:/run/zdm-proxy-automation/
networks:
proxy:
deploy:
mode: replicated
replicas: 3

jumphost:
image: ubuntu:20.04
build: ./docker-compose/services/jumphost
restart: unless-stopped
tty: true
environment:
- CIDR_IP_SUBNET=$NETWORK_SUBNET
volumes:
- .:/opt/zdm-proxy-automation
- ./compose/keys:/run/keys
entrypoint:
- /opt/zdm-proxy-automation/compose/jumphost-entrypoint.sh
- ./docker-compose/services/jumphost/jumphost-entrypoint.sh:/usr/bin/jumphost-entrypoint.sh
- ./docker-compose/share:/run/zdm-proxy-automation/
- ./ansible/:/opt/zdm-proxy-automation/ansible/
networks:
proxy:

client:
image: ubuntu:20.04
build: ./docker-compose/services/client
restart: unless-stopped
tty: true
volumes:
- .:/opt/zdm-proxy-automation
entrypoint:
- /opt/zdm-proxy-automation/compose/client-entrypoint.sh
- ./docker-compose/services/client/client-entrypoint.sh:/usr/bin/client-entrypoint.sh
- ./docker-compose/share:/run/zdm-proxy-automation/
networks:
proxy:
23 changes: 23 additions & 0 deletions docker-compose/services/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:20.04

ENV ZDM_PROXY_RUN /run/zdm-proxy-automation
ENV HOSTS_FILE ${ZDM_PROXY_RUN}/hostsfile

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive \
apt-get -y install \
iproute2 \
net-tools \
iputils-ping \
python3 \
python3-pip \
tzdata

RUN python3 -m pip install -U cqlsh

# Fix timezone in client
RUN ln -fs /usr/share/zoneinfo/Australia/Sydney /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata

ENTRYPOINT ["client-entrypoint.sh"]
CMD [""]
Loading

0 comments on commit fd0e80c

Please sign in to comment.