Skip to content

Instantly share code, notes, and snippets.

View awgreene's full-sized avatar

Alexander Greene awgreene

  • Red Hat
  • Ruston, WA
View GitHub Profile
from sys import argv
from time import sleep
# Set time to first argument
time = argv[1]
# Set seconds to integer representation of time
seconds = int(time)
# Make sure time provided is greater than or equal to zero
# Build from the latest Python 3 image
FROM python:3
# Add the scripts folder from our project to the image
ADD ./scripts ./scripts
# Run our Python script
CMD [ "python", "./scripts/Countdown.py" ]
# Build from the latest Python 3 Image
FROM python:3
# Add the scripts folder from our project to the image
ADD ./scripts ./scripts
# Run our Python script
CMD python ./scripts/Countdown.py $TIME
FROM cassandra:3.11
LABEL maintainer="awgreene"
RUN sed -i "s/authenticator:\ AllowAllAuthenticator/authenticator:\ PasswordAuthenticator/g" /etc/cassandra/cassandra.yaml
RUN sed -i "s/authorizer:\ AllowAllAuthorizer/authorizer:\ org.apache.cassandra.auth.CassandraAuthorizer/g" /etc/cassandra/cassandra.yaml
FROM cassandra:3.11
LABEL maintainer="awgreene"
ADD ./scripts ./scripts
CMD ["./scripts/cassandraInitAdmin.sh"]
# Check that all envirment variables have been set.
echo "CASSANDRA_IP:$CASSANDRA_IP"
echo "CASSANDRA_PORT:$CASSANDRA_PORT"
echo "CASSANDRA_ADMIN_USERNAME:$CASSANDRA_ADMIN_USERNAME"
echo "CASSANDRA_ADMIN_PASSWORD:$CASSANDRA_ADMIN_PASSWORD"
# Echo all commands for debug.
set -x
# Inject the username and password of new admin into the cql script.
CREATE USER IF NOT EXISTS <CASSANDRA_ADMIN_USERNAME> WITH PASSWORD '<CASSANDRA_ADMIN_PASSWORD>' SUPERUSER;
ALTER USER cassandra WITH PASSWORD '<RANDOM_PASSWORD>' NOSUPERUSER;
FROM cassandra:3.11
LABEL maintainer="awgreene"
ADD ./scripts ./scripts
CMD ["./scripts/cassandraInitKeyspace.sh"]