Skip to content
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 etherpad-lite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ already exist. You can now access Etherpad Lite from http://localhost:9001/
This image supports the following environment variables:

* `ETHERPAD_TITLE`: Title of the Etherpad Lite instance. Defaults to "Etherpad".
* `ETHERPAD_PORT`: Port of the Etherpad Lite instance. Defaults to 9001.
* `ETHERPAD_SESSION_KEY`: Session key for the Etherpad Lite configuraition. You
can set this in case of migrating from another installation. A value is
automatically generated by default.
Expand Down
32 changes: 25 additions & 7 deletions etherpad-lite/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,42 @@ if [ -z "$ETHERPAD_DB_PASSWORD" ]; then
fi

: ${ETHERPAD_TITLE:=Etherpad}
: ${ETHERPAD_PORT:=9001}
: ${ETHERPAD_SESSION_KEY:=$(
node -p "require('crypto').randomBytes(32).toString('hex')")}

# Check if database already exists
RESULT=`mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} \
# Check DB connectivity

for ((i=0;i<20;i++))
do
DB_CONNECTABLE=$(mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} -hmysql -e 'status' >/dev/null 2>&1; echo "$?")
if [[ DB_CONNECTABLE -eq 0 ]]; then
break
fi
sleep 1
done

if [[ $DB_CONNECTABLE -eq 0 ]]; then
# Check if database already exists
RESULT=`mysql -u${ETHERPAD_DB_USER} -p${ETHERPAD_DB_PASSWORD} \
-hmysql --skip-column-names \
-e "SHOW DATABASES LIKE '${ETHERPAD_DB_NAME}'"`

if [ "$RESULT" != $ETHERPAD_DB_NAME ]; then
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} -hmysql \
-e "create database ${ETHERPAD_DB_NAME}"
fi
fi

if [ ! -f settings.json ]; then
if [ ! -f settings.json ]; then

cat <<- EOF > settings.json
{
"title": "${ETHERPAD_TITLE}",
"ip": "0.0.0.0",
"port" : 9001,
"port" :${ETHERPAD_PORT},
"sessionKey" : "${ETHERPAD_SESSION_KEY}",
"dbType" : "mysql",
"dbSettings" : {
Expand Down Expand Up @@ -76,6 +89,11 @@ if [ ! -f settings.json ]; then
cat <<- EOF >> settings.json
}
EOF
fi

exec "$@"
else
echo "Cannot connect to Mysql"
exit $DB_CONNECTABLE
fi

exec "$@"
2 changes: 1 addition & 1 deletion syncthing/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM debian:jessie

ENV SYNCTHING_VERSION 0.10.30
ENV SYNCTHING_VERSION 0.11.0

RUN apt-get update && apt-get install -y ca-certificates --no-install-recommends && rm -rf /var/lib/apt/lists/*

Expand Down