-
Notifications
You must be signed in to change notification settings - Fork 2
Initial implementation #1
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
Open
tjcelaya
wants to merge
7
commits into
autopilotpattern:master
Choose a base branch
from
tjcelaya:feature/working
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3c66fe7
Forked from autopilotpattern/postgres and partially working
tjcelaya b3d9a0c
More onChange changes
tjcelaya faf4bb0
Multi-DC peering almost working
tjcelaya da0e66b
Fix seeds key format
tjcelaya 156ac19
Preventing every node from bootstrapping itself. One node can grab th…
tjcelaya f459b69
Configuration for smaller cassandra nodes
tjcelaya 28b890e
Fix session expiration issue
tjcelaya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .DS_Store | ||
| *.pyc | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| FROM cassandra:3.11.0 | ||
|
|
||
| # install wget unzip and dig plus python modules | ||
| RUN set -ex \ | ||
| && apt-get update \ | ||
| && apt-get install --no-install-recommends -y wget unzip dnsutils python-dev gcc \ | ||
| && wget --quiet -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py \ | ||
| && python /tmp/get-pip.py \ | ||
| && pip install \ | ||
| # trying to use cqlsh to do this stuff, installing cassandra-driver takes _forever_ | ||
| # cassandra-driver==3.12.0 \ | ||
| python-Consul==0.7.2 \ | ||
| manta==2.6.0 \ | ||
| pyyaml==3.12 \ | ||
| && apt-get purge -y python-dev gcc \ | ||
| && rm /tmp/get-pip.py \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Consul | ||
| # Releases at https://releases.hashicorp.com/consul | ||
| RUN set -ex \ | ||
| && export CONSUL_VERSION=1.0.1 \ | ||
| && export CONSUL_CHECKSUM=eac5755a1d19e4b93f6ce30caaf7b3bd8add4557b143890b1c07f5614a667a68 \ | ||
| && wget --quiet -O /tmp/consul.zip "https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip" \ | ||
| && echo "${CONSUL_CHECKSUM} /tmp/consul.zip" | sha256sum -c \ | ||
| && unzip /tmp/consul -d /usr/local/bin \ | ||
| && rm /tmp/consul.zip \ | ||
| && mkdir -p /etc/consul \ | ||
| && mkdir -p /var/lib/consul \ | ||
| && mkdir /config | ||
|
|
||
| # Install Consul template | ||
| # Releases at https://releases.hashicorp.com/consul-template/ | ||
| RUN set -ex \ | ||
| && export CONSUL_TEMPLATE_VERSION=0.19.0 \ | ||
| && export CONSUL_TEMPLATE_CHECKSUM=31dda6ebc7bd7712598c6ac0337ce8fd8c533229887bd58e825757af879c5f9f \ | ||
| && wget --quiet -O /tmp/consul-template.zip "https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip" \ | ||
| && echo "${CONSUL_TEMPLATE_CHECKSUM} /tmp/consul-template.zip" | sha256sum -c \ | ||
| && unzip /tmp/consul-template.zip -d /usr/local/bin \ | ||
| && rm /tmp/consul-template.zip | ||
|
|
||
| # Add Containerpilot and set its configuration | ||
| ENV CONTAINERPILOT /etc/containerpilot.json5 | ||
| ENV CONTAINERPILOT_VERSION 3.3.3 | ||
|
|
||
| RUN export CONTAINERPILOT_CHECKSUM=8d680939a8a5c8b27e764d55a78f5e3ae7b42ef4 \ | ||
| && export archive=containerpilot-${CONTAINERPILOT_VERSION}.tar.gz \ | ||
| && wget --quiet -O /tmp/${archive} \ | ||
| "https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VERSION}/${archive}" \ | ||
| && echo "${CONTAINERPILOT_CHECKSUM} /tmp/${archive}" | sha1sum -c \ | ||
| && tar zxf /tmp/${archive} -C /usr/local/bin \ | ||
| && rm /tmp/${archive} | ||
|
|
||
| COPY etc/containerpilot.json5 /etc/containerpilot.json5 | ||
|
|
||
| ### Cassandra-specific setup follows | ||
|
|
||
| COPY etc/containerpilot_handler /usr/local/bin/containerpilot_handler | ||
| COPY etc/containerpilot_handler.py /usr/local/bin/containerpilot_handler.py | ||
| COPY etc/cassandra.yaml.ctmpl /etc/cassandra/cassandra.yaml.ctmpl | ||
|
|
||
| # disable the automatic seed configuration that enables single-node bootstrapping | ||
| # the first line corresponds to "always set self as seed" | ||
| # the second line actually inserts CASSANDRA_SEEDS into the cassandra.yaml | ||
| RUN sed -ri '/CASSANDRA_SEEDS.*CASSANDRA_BROADCAST_ADDRESS/d' /docker-entrypoint.sh && \ | ||
| sed -ri '/sed -ri.*CASSANDRA_SEEDS.*\/cassandra.yaml/d' /docker-entrypoint.sh | ||
|
|
||
|
|
||
| EXPOSE 7000 7001 7199 9042 9160 | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/containerpilot"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Autopilot Pattern Cassandra | ||
|
|
||
| A blueprint for running Apache Cassandra using the [Autopilot Pattern](http://autopilotpattern.io/). | ||
|
|
||
| Environment variables: | ||
|
|
||
| - `CASSANDRA_CLUSTER_NAME`: Name of cluster. Cassandra instances can only join a cluster with the | ||
| same `CASSANDRA_CLUSTER_NAME`. Changing this to something other than "Test Cluster" | ||
| is **strongly recommended**. | ||
| - `CASSANDRA_USER`: New user account to create upon cluster initialization. Setting this parameter | ||
| to something other than "cassandra" is **strongly recommended**. | ||
| - `CASSANDRA_PASSWORD`: password for `CASSANDRA_USER`. | ||
| - `CASSANDRA_KEYSPACES`: Comma-seperated list of keyspaces. | ||
| - `CASSANDRA_TOPOLOGY`: JSON map describing keyspaces and their respective datacenters and | ||
| replication factors, e.g. for a cluster deployed with at least 2 nodes in `us-east-1` and | ||
| `us-sw-1` Triton datacenters having a single keyspace named `demo`: | ||
| ``` | ||
| { "demo": { "us-sw-1": 2 }, { "us-east-1": 2 } } | ||
| ``` | ||
|
|
||
| Notes: | ||
|
|
||
| ``` | ||
| cd examples/compose | ||
| docker-compose up -d --scale cassandra=3 | ||
| # for a cqlsh shell: | ||
| docker-compose exec cassandra cqlsh cassandra | ||
|
|
||
| cqlsh> CREATE KEYSPACE demo WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': 2 }; | ||
| USE demo; | ||
|
|
||
| ``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for using ContainerPilot 3.3.3?
You should at least include the series of fixes for memory leaks (#488 and #493) that were addressed with 3.4.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for calling that out, the majority of this Dockerfile was plundered from autopilotpattern/postgres but I hadn't gotten the change to review versions. Fixing this in the next commit.