Jonathan Rosenbaum
7 years ago
7 changed files with 336 additions and 0 deletions
@ -0,0 +1,72 @@ |
|||||
|
version: '2.1' |
||||
|
|
||||
|
# etherpad and etherdraw |
||||
|
# currently 1.6.2 |
||||
|
# settings.json |
||||
|
# https://github.com/ether/etherpad-lite/blob/develop/settings.json.template |
||||
|
|
||||
|
services: |
||||
|
|
||||
|
etherpad: |
||||
|
build: ./etherpad |
||||
|
image: bikebike/etherpad-node-alpine:1.6.2 |
||||
|
container_name: pad |
||||
|
ports: |
||||
|
- "9001:9001" |
||||
|
volumes: |
||||
|
- settings:/opt/etherpad-lite/var |
||||
|
- node_modules:/opt/etherpad-lite/node_modules |
||||
|
external_links: |
||||
|
- ${SQL_CONTAINTER:-mysql} |
||||
|
env_file: |
||||
|
- pad_environment |
||||
|
environment: |
||||
|
- MYSQL_ROOT_PASSWORD=${PAD_PASSWORD:-password} |
||||
|
- MYSQL_DATABASE=${PAD_DATABASE:-pad} |
||||
|
- ETHERPAD_DB_HOST=${DB_HOST:-mysql} |
||||
|
- ETHERPAD_DB_NAME=${PAD_DATABASE:-pad} |
||||
|
- ETHERPAD_DB_PASSWORD=${PAD_PASSWORD:-password} |
||||
|
- ETHERPAD_TITLE=${PAD_TITLE:-Online Flip Chart} |
||||
|
- ETHERPAD_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin_password} |
||||
|
- ETHERPAD_ADMIN_USER=${ADMIN_USER:-admin} |
||||
|
- ETHERDRAW_HOST=${DRAW_HOST:-localhost:9002} |
||||
|
network_mode: "bridge" |
||||
|
logging: |
||||
|
driver: "json-file" |
||||
|
options: |
||||
|
max-size: "10m" |
||||
|
max-file: "3" |
||||
|
restart: always |
||||
|
|
||||
|
etherdraw: |
||||
|
build: ./etherdraw |
||||
|
image: bikebike/etherdraw-node-alpine:1.6.2 |
||||
|
container_name: draw |
||||
|
ports: |
||||
|
- "9002:9002" |
||||
|
volumes: |
||||
|
- draw_settings:/opt/draw/var |
||||
|
external_links: |
||||
|
- ${SQL_CONTAINTER:-mysql} |
||||
|
env_file: |
||||
|
- draw_environment |
||||
|
environment: |
||||
|
- MYSQL_ROOT_PASSWORD=${DRAW_PASSWORD:-password} |
||||
|
- MYSQL_DATABASE=${DRAW_DATABASE:-draw} |
||||
|
- ETHERPAD_DB_HOST=${DB_HOST:-mysql} |
||||
|
- ETHERPAD_DB_NAME=${DRAW_DATABASE:-draw} |
||||
|
- ETHERPAD_DB_PASSWORD=${DRAW_PASSWORD:-password} |
||||
|
- ETHERPAD_TITLE=${DRAW_TITLE:-Ether Draw} |
||||
|
- ETHERPAD_PORT=${DRAW_PORT:-9002} |
||||
|
network_mode: "bridge" |
||||
|
logging: |
||||
|
driver: "json-file" |
||||
|
options: |
||||
|
max-size: "10m" |
||||
|
max-file: "3" |
||||
|
restart: always |
||||
|
|
||||
|
volumes: |
||||
|
settings: |
||||
|
node_modules: |
||||
|
draw_settings: |
@ -0,0 +1,28 @@ |
|||||
|
# etherdraw # |
||||
|
|
||||
|
# node 9.2 |
||||
|
FROM node:9-alpine |
||||
|
MAINTAINER Jonathan Rosenbaum <fspc@freesoftwarepc.com> |
||||
|
|
||||
|
RUN apk update; apk add bash git giflib-dev libjpeg-turbo-dev curl mysql-client python2 pkgconfig cairo-dev make g++ |
||||
|
|
||||
|
WORKDIR /opt/ |
||||
|
|
||||
|
RUN git clone git://github.com/JohnMcLear/draw.git |
||||
|
|
||||
|
ENV PYTHON=/usr/bin/python2 |
||||
|
|
||||
|
WORKDIR draw |
||||
|
|
||||
|
RUN bin/installDeps.sh && rm settings.json |
||||
|
|
||||
|
COPY entrypoint.sh /entrypoint.sh |
||||
|
|
||||
|
RUN sed -i 's/^node/exec\ node/' bin/run.sh |
||||
|
|
||||
|
VOLUME /opt/draw/var /opt/draw/node_module |
||||
|
RUN ln -s var/settings.json settings.json |
||||
|
|
||||
|
EXPOSE 9002 |
||||
|
ENTRYPOINT ["/entrypoint.sh"] |
||||
|
CMD ["bin/run.sh", "--root"] |
@ -0,0 +1,95 @@ |
|||||
|
#!/bin/bash |
||||
|
set -e |
||||
|
|
||||
|
: ${ETHERPAD_DB_TYPE:=mysql} |
||||
|
: ${ETHERPAD_DB_HOST:=mysql} |
||||
|
: ${ETHERPAD_DB_USER:=root} |
||||
|
: ${ETHERPAD_DB_NAME:=etherpad} |
||||
|
: ${ETHERPAD_DB_CHARSET:=utf8mb4} |
||||
|
ETHERPAD_DB_NAME=$( echo $ETHERPAD_DB_NAME | sed 's/\./_/g' ) |
||||
|
|
||||
|
# ETHERPAD_DB_PASSWORD is mandatory in mysql container, so we're not offering |
||||
|
# any default. If we're linked to MySQL through legacy link, then we can try |
||||
|
# using the password from the env variable MYSQL_ENV_MYSQL_ROOT_PASSWORD |
||||
|
if [ "$ETHERPAD_DB_USER" = 'root' ]; then |
||||
|
: ${ETHERPAD_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$ETHERPAD_DB_PASSWORD_FILE" ]; then |
||||
|
: ${ETHERPAD_DB_PASSWORD:=$(cat $ETHERPAD_DB_PASSWORD_FILE)} |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$ETHERPAD_DB_PASSWORD" ]; then |
||||
|
echo >&2 'error: missing required ETHERPAD_DB_PASSWORD environment variable' |
||||
|
echo >&2 ' Did you forget to -e ETHERPAD_DB_PASSWORD=... ?' |
||||
|
echo >&2 |
||||
|
echo >&2 ' (Also of interest might be ETHERPAD_DB_PASSWORD_FILE, ETHERPAD_DB_USER and ETHERPAD_DB_NAME.)' |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
: ${ETHERPAD_TITLE:=Etherpad} |
||||
|
: ${ETHERPAD_PORT:=9001} |
||||
|
|
||||
|
# Check if database already exists |
||||
|
if [ "$ETHERPAD_DB_TYPE" == 'mysql' ]; then |
||||
|
RESULT=`mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} \ |
||||
|
-h${ETHERPAD_DB_HOST} --skip-column-names \ |
||||
|
-e "SHOW DATABASES LIKE '${ETHERPAD_DB_NAME}'"` |
||||
|
|
||||
|
if [ "$RESULT" != $ETHERPAD_DB_NAME ]; then |
||||
|
# mysql database does not exist, create it |
||||
|
echo "Creating database ${ETHERPAD_DB_NAME}" |
||||
|
|
||||
|
mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} -h${ETHERPAD_DB_HOST} \ |
||||
|
-e "create database ${ETHERPAD_DB_NAME}" |
||||
|
fi |
||||
|
fi |
||||
|
if [ "$ETHERPAD_DB_TYPE" == 'postgres' ]; then |
||||
|
export PGPASSWORD=${ETHERPAD_DB_PASSWORD} |
||||
|
if psql -U ${ETHERPAD_DB_USER} -h ${ETHERPAD_DB_HOST} postgres -lqt | cut -d \| -f 1 | grep -qw ${ETHERPAD_DB_NAME}; then |
||||
|
true |
||||
|
else |
||||
|
# postgresql database does not exist, create it |
||||
|
echo "Creating database ${ETHERPAD_DB_NAME}" |
||||
|
psql -U ${ETHERPAD_DB_USER} -h ${ETHERPAD_DB_HOST} postgres \ |
||||
|
-c "create database ${ETHERPAD_DB_NAME}" |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
if [ ! -f settings.json ]; then |
||||
|
|
||||
|
cat <<- EOF > settings.json |
||||
|
{ |
||||
|
"title": "${ETHERPAD_TITLE}", |
||||
|
"ip": "0.0.0.0", |
||||
|
"port" :${ETHERPAD_PORT}, |
||||
|
"dbType" : "${ETHERPAD_DB_TYPE}", |
||||
|
"dbSettings" : { |
||||
|
"user" : "${ETHERPAD_DB_USER}", |
||||
|
"host" : "${ETHERPAD_DB_HOST}", |
||||
|
"password": "${ETHERPAD_DB_PASSWORD}", |
||||
|
"database": "${ETHERPAD_DB_NAME}", |
||||
|
"charset": "${ETHERPAD_DB_CHARSET}" |
||||
|
} |
||||
|
EOF |
||||
|
|
||||
|
if [ $ETHERPAD_ADMIN_PASSWORD ]; then |
||||
|
|
||||
|
: ${ETHERPAD_ADMIN_USER:=admin} |
||||
|
|
||||
|
cat <<- EOF >> settings.json |
||||
|
"users": { |
||||
|
"${ETHERPAD_ADMIN_USER}": { |
||||
|
"password": "${ETHERPAD_ADMIN_PASSWORD}", |
||||
|
"is_admin": true |
||||
|
} |
||||
|
}, |
||||
|
EOF |
||||
|
fi |
||||
|
|
||||
|
cat <<- EOF >> settings.json |
||||
|
} |
||||
|
EOF |
||||
|
fi |
||||
|
|
||||
|
exec "$@" |
@ -0,0 +1,38 @@ |
|||||
|
# node 9.2 |
||||
|
FROM node:9-alpine |
||||
|
MAINTAINER Jonathan Rosenbaum <fspc@freesoftwarepc.com> |
||||
|
|
||||
|
# npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade |
||||
|
# npm WARN deprecated node-uuid@1.4.8: Use uuid module instead |
||||
|
# npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue |
||||
|
# npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree. |
||||
|
# npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue |
||||
|
|
||||
|
ENV ETHERPAD_VERSION 1.6.2 |
||||
|
|
||||
|
RUN apk update; apk add bash curl gzip unzip mysql-client |
||||
|
|
||||
|
WORKDIR /opt/ |
||||
|
|
||||
|
RUN curl -SL \ |
||||
|
https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION}.zip \ |
||||
|
> etherpad.zip && unzip etherpad && rm etherpad.zip && \ |
||||
|
mv etherpad-lite-${ETHERPAD_VERSION} etherpad-lite |
||||
|
|
||||
|
WORKDIR etherpad-lite |
||||
|
|
||||
|
RUN bin/installDeps.sh && rm settings.json |
||||
|
COPY entrypoint.sh /entrypoint.sh |
||||
|
|
||||
|
RUN sed -i 's/^node/exec\ node/' bin/run.sh |
||||
|
|
||||
|
VOLUME /opt/etherpad-lite/var /opt/etherpad-lite/node_module |
||||
|
RUN ln -s var/settings.json settings.json |
||||
|
RUN npm install ep_adminpads ep_align ep_authornames ep_comments_page \ |
||||
|
ep_copy_paste_images ep_define ep_draw ep_font_color ep_font_family \ |
||||
|
ep_font_size ep_headings ep_message_all ep_offline_edit \ |
||||
|
ep_page_view ep_print ep_simpletextsearch ep_spellcheck |
||||
|
|
||||
|
EXPOSE 9001 |
||||
|
ENTRYPOINT ["/entrypoint.sh"] |
||||
|
CMD ["bin/run.sh", "--root"] |
@ -0,0 +1,103 @@ |
|||||
|
#!/bin/bash |
||||
|
set -e |
||||
|
|
||||
|
: ${ETHERPAD_DB_TYPE:=mysql} |
||||
|
: ${ETHERPAD_DB_HOST:=mysql} |
||||
|
: ${ETHERPAD_DB_USER:=root} |
||||
|
: ${ETHERPAD_DB_NAME:=etherpad} |
||||
|
: ${ETHERPAD_DB_CHARSET:=utf8mb4} |
||||
|
ETHERPAD_DB_NAME=$( echo $ETHERPAD_DB_NAME | sed 's/\./_/g' ) |
||||
|
|
||||
|
# ETHERPAD_DB_PASSWORD is mandatory in mysql container, so we're not offering |
||||
|
# any default. If we're linked to MySQL through legacy link, then we can try |
||||
|
# using the password from the env variable MYSQL_ENV_MYSQL_ROOT_PASSWORD |
||||
|
if [ "$ETHERPAD_DB_USER" = 'root' ]; then |
||||
|
: ${ETHERPAD_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD} |
||||
|
fi |
||||
|
|
||||
|
if [ -n "$ETHERPAD_DB_PASSWORD_FILE" ]; then |
||||
|
: ${ETHERPAD_DB_PASSWORD:=$(cat $ETHERPAD_DB_PASSWORD_FILE)} |
||||
|
fi |
||||
|
|
||||
|
if [ -z "$ETHERPAD_DB_PASSWORD" ]; then |
||||
|
echo >&2 'error: missing required ETHERPAD_DB_PASSWORD environment variable' |
||||
|
echo >&2 ' Did you forget to -e ETHERPAD_DB_PASSWORD=... ?' |
||||
|
echo >&2 |
||||
|
echo >&2 ' (Also of interest might be ETHERPAD_DB_PASSWORD_FILE, ETHERPAD_DB_USER and ETHERPAD_DB_NAME.)' |
||||
|
exit 1 |
||||
|
fi |
||||
|
|
||||
|
: ${ETHERPAD_TITLE:=Etherpad} |
||||
|
: ${ETHERPAD_PORT:=9001} |
||||
|
|
||||
|
# Check if database already exists |
||||
|
if [ "$ETHERPAD_DB_TYPE" == 'mysql' ]; then |
||||
|
RESULT=`mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} \ |
||||
|
-h${ETHERPAD_DB_HOST} --skip-column-names \ |
||||
|
-e "SHOW DATABASES LIKE '${ETHERPAD_DB_NAME}'"` |
||||
|
|
||||
|
if [ "$RESULT" != $ETHERPAD_DB_NAME ]; then |
||||
|
# mysql database does not exist, create it |
||||
|
echo "Creating database ${ETHERPAD_DB_NAME}" |
||||
|
|
||||
|
mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} -h${ETHERPAD_DB_HOST} \ |
||||
|
-e "create database ${ETHERPAD_DB_NAME}" |
||||
|
fi |
||||
|
fi |
||||
|
if [ "$ETHERPAD_DB_TYPE" == 'postgres' ]; then |
||||
|
export PGPASSWORD=${ETHERPAD_DB_PASSWORD} |
||||
|
if psql -U ${ETHERPAD_DB_USER} -h ${ETHERPAD_DB_HOST} postgres -lqt | cut -d \| -f 1 | grep -qw ${ETHERPAD_DB_NAME}; then |
||||
|
true |
||||
|
else |
||||
|
# postgresql database does not exist, create it |
||||
|
echo "Creating database ${ETHERPAD_DB_NAME}" |
||||
|
psql -U ${ETHERPAD_DB_USER} -h ${ETHERPAD_DB_HOST} postgres \ |
||||
|
-c "create database ${ETHERPAD_DB_NAME}" |
||||
|
fi |
||||
|
fi |
||||
|
|
||||
|
if [ ! -f settings.json ]; then |
||||
|
|
||||
|
cat <<- EOF > settings.json |
||||
|
{ |
||||
|
"title": "${ETHERPAD_TITLE}", |
||||
|
"ip": "0.0.0.0", |
||||
|
"port" :${ETHERPAD_PORT}, |
||||
|
"dbType" : "${ETHERPAD_DB_TYPE}", |
||||
|
"dbSettings" : { |
||||
|
"user" : "${ETHERPAD_DB_USER}", |
||||
|
"host" : "${ETHERPAD_DB_HOST}", |
||||
|
"password": "${ETHERPAD_DB_PASSWORD}", |
||||
|
"database": "${ETHERPAD_DB_NAME}", |
||||
|
"charset": "${ETHERPAD_DB_CHARSET}" |
||||
|
}, |
||||
|
EOF |
||||
|
|
||||
|
if [ $ETHERPAD_ADMIN_PASSWORD ]; then |
||||
|
|
||||
|
: ${ETHERPAD_ADMIN_USER:=admin} |
||||
|
|
||||
|
cat <<- EOF >> settings.json |
||||
|
"defaultPadText" : "", |
||||
|
"users": { |
||||
|
"${ETHERPAD_ADMIN_USER}": { |
||||
|
"password": "${ETHERPAD_ADMIN_PASSWORD}", |
||||
|
"is_admin": true |
||||
|
} |
||||
|
}, |
||||
|
EOF |
||||
|
fi |
||||
|
|
||||
|
cat <<- EOF >> settings.json |
||||
|
"ep_comments_page": { |
||||
|
"displayCommentAsIcon": true, |
||||
|
"highlightSelectedText": true |
||||
|
}, |
||||
|
"ep_draw": { |
||||
|
"host": "${ETHERDRAW_HOST}" |
||||
|
} |
||||
|
} |
||||
|
EOF |
||||
|
fi |
||||
|
|
||||
|
exec "$@" |
Loading…
Reference in new issue