Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
Installing pip and cqlsh so that we run a CQL command at boot
Browse files Browse the repository at this point in the history
  • Loading branch information
brecke committed Jul 7, 2017
1 parent 773407d commit 925b585
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libyaml-dev \
make \
patch \
python-pip \
xz-utils \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
Expand Down Expand Up @@ -121,12 +122,16 @@ WORKDIR /opt/etherpad/
RUN /opt/etherpad/bin/installDeps.sh

# Next two lines are production config ONLY
# RUN sed -i -e 's/dbType\" : \"dirty/dbType\" : \"cassandra/g' settings.json
# RUN sed -i -e 's/"filename" : "var\/dirty.db"/"clientOptions": {"keyspace": "etherpad", "contactPoints": ["localhost"]},"columnFamily": "Etherpad"/g' settings.json
RUN sed -i -e 's/dbType\" : \"dirty/dbType\" : \"cassandra/g' settings.json
RUN sed -i -e 's/"filename" : "var\/dirty.db"/"clientOptions": {"keyspace": "etherpad", "port": "9160", "contactPoints": ["oae-cassandra"]},"columnFamily": "Etherpad"/g' settings.json

RUN sed -i -e 's/defaultPadText" : ".*"/defaultPadText" : ""/g' settings.json
RUN echo "13SirapH8t3kxUh5T5aqWXhXahMzoZRA" > APIKEY.txt

# We need to run a specific cqlsh command before this works
RUN pip install cqlsh==4.0.1
RUN echo "CREATE KEYSPACE etherpad WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};" > /tmp/.create_etherpad_keyspace.cql3

# Install ep_headings module
RUN cd /opt/etherpad && npm install ep_headings

Expand All @@ -152,7 +157,9 @@ EXPOSE 9001

RUN groupadd --gid 1001 etherpad && useradd --uid 1001 --gid etherpad --shell /bin/bash --create-home etherpad

CMD ["bin/run.sh", "--root"]
CMD cqlsh -f /tmp/.create_etherpad_keyspace.cql3 oae-cassandra 9160 && bin/run.sh --root
# CMD ["bin/run.sh", "--root"]

# TODO try to run this as non-root if possible
# CMD ["su", "-", "etherpad", "-c", "/bin/sh /opt/etherpad/bin/run.sh"]
# CMD ["su", "-", "etherpad", "-c", "/bin/sh /opt/etherpad/bin/run.sh"]

0 comments on commit 925b585

Please sign in to comment.