Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZDM-295 Enhance docker-compose components #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! I liked this approach to build the image on the fly and then re-use it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 😄

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main goal for the docker-compose infrastructure was testing the automation in an environment as similar as possible to the real production environment, meaning distribute machines/VMs running multiple proxy instances/replicas.
I understand that for demo purposes we may only need one instance, so I'd suggest moving the number of replicas into that new env file and making the default as 3, so we can easily tweak it when needed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. Reverted the change and moved the number of replicas to the .env file as suggested.


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