Compare commits

...

5 commits

4 changed files with 96 additions and 69 deletions

View file

@ -5,45 +5,59 @@ MAINTAINER Glenn Y. Rolland <glenux@glenux.net>
ENV ETHERPAD_VERSION 1.8.18
# RUN = docker run ... + docker commit
RUN apt-get update \
&& apt-get install -y curl unzip mariadb-client netcat \
&& apt-get install -y unzip mariadb-client netcat \
&& apt-get clean \
&& rm -r /var/lib/apt/lists/*
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log
WORKDIR /opt/
RUN curl -SL \
https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION}.zip \
> etherpad.zip && unzip etherpad \
RUN cd /opt \
&& wget \
https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION}.zip \
-O etherpad.zip \
&& unzip etherpad \
&& rm etherpad.zip \
&& mv etherpad-lite-${ETHERPAD_VERSION} etherpad-lite
&& mv etherpad-lite-${ETHERPAD_VERSION} etherpad \
&& useradd --home-dir /opt/etherpad etherpad \
&& chown -R etherpad:etherpad /opt/etherpad
WORKDIR /opt/etherpad-lite
COPY --chown=etherpad parseurl.sh /parseurl.sh
COPY --chown=etherpad entrypoint.sh /entrypoint.sh
COPY parseurl.py /parseurl.py
COPY entrypoint.sh /entrypoint.sh
# Pre-install
RUN chmod +x /entrypoint.sh \
&& npm install \
ep_author_neat ep_headings2 \
ep_set_title_on_pad ep_adminpads \
ep_workspaces ep_comments_page \
ep_font_color ep_table_of_contents \
ep_delete_after_delay \
ep_offline_edit \
ep_prompt_for_name \
&& bin/installDeps.sh \
&& sed -i 's/^node/exec\ node/' bin/run.sh \
WORKDIR /opt/etherpad
USER etherpad
# Pre-install some plugins
RUN bin/installDeps.sh \
&& cd src \
&& npm install --save-prod \
github:alxndr42/ep_expiration \
ep_author_neat \
ep_headings2 \
ep_comments_page \
ep_font_color \
ep_offline_edit \
ep_prompt_for_name \
ep_workspaces \
ep_table_of_contents \
ep_adminpads \
&& cd .. \
&& rm settings.json \
&& ln -s var/settings.json settings.json
# ep_delete_after_delay \
# ep_set_title_on_pad \
# && sed -i 's/^node/exec\ node/' bin/run.sh \
# ep_mypads
# meta-données
VOLUME /opt/etherpad-lite/var
VOLUME /opt/etherpad/var
EXPOSE 9001
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bin/run.sh", "--root"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["./src/bin/run.sh"]
# bin/run.sh

View file

@ -1,15 +1,7 @@
# Etherpad Lite image for docker
This is a docker image for [Etherpad Lite](http://etherpad.org/) collaborative
text editor. The Dockerfile for this image has been inspired by the
[official Wordpress](https://registry.hub.docker.com/_/wordpress/) Dockerfile and
[johbo's etherpad-lite](https://registry.hub.docker.com/u/johbo/etherpad-lite/)
image.
This image uses an mysql container for the backend for the pads. It is based
on debian jessie instead of the official node docker image, since the latest
stable version of etherpad-lite does not support npm 2.
on latest nodejs image.
## About Etherpad Lite
@ -17,7 +9,7 @@ stable version of etherpad-lite does not support npm 2.
Etherpad allows you to edit documents collaboratively in real-time, much like a live multi-player editor that runs in your browser. Write articles, press releases, to-do lists, etc. together with your friends, fellow students or colleagues, all working on the same document at the same time.
![alt text](http://i.imgur.com/zYrGkg3.gif "Etherpad in action on PrimaryPad")
![alt text](http://i.imgur.com/zYrGkg3.gif "Etherpad in action")
All instances provide access to all data through a well-documented API and supports import/export to many major data exchange formats. And if the built-in feature set isn't enough for you, there's tons of plugins that allow you to customize your instance to suit your needs.
@ -25,26 +17,44 @@ You don't need to set up a server and install Etherpad in order to use it. Just
## Quickstart
First you need a running mysql container, for example:
Copy-paste the following content in a `docker-compose.yml` file
```bash
$ docker network create ep_network
$ docker run -d --network ep_network -e MYSQL_ROOT_PASSWORD=password --name ep_mysql mysql
```yaml
---
version: "3.4"
services:
db:
image: mariadb:10.3
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes:
- db_data:/var/lib/mysql
environment:
MARIADB_ROOT_PASSWORD: insecure
MARIADB_DATABASE: etherpad
etherpad:
build:
context: .
dockerfile: Dockerfile
image: glenux/etherpad:latest
environment:
DATABASE_URL: mysql://root:insecure:3306@db/etherpad
ETHERPAD_ADMIN_USER: admin
ETHERPAD_ADMIN_PASSWORD: insecure
NODE_ENV: production
ports:
- 9001:9001
volumes:
db_data:
```
Finally you can start an instance of Etherpad Lite:
```bash
$ docker run -d \
--network ep_network \
-e ETHERPAD_DB_HOST=ep_mysql \
-e ETHERPAD_DB_PASSWORD=password \
-p 9001:9001 \
tvelocity/etherpad-lite
```
Then run `docker-compose up`
Etherpad will automatically create an `etherpad` database in the specified mysql
server if it does not already exist.
You can now access Etherpad Lite from http://localhost:9001/
## Environment variables
@ -53,9 +63,6 @@ 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.
* `ETHERPAD_ADMIN_PASSWORD`: If set, an admin account is enabled for Etherpad,
and the /admin/ interface is accessible via it.
@ -65,7 +72,7 @@ Otherwise the user can set it to another username.
* `ETHERPAD_DB_HOST`: Hostname of the mysql databse to use. Defaults to `mysql`
* `ETHERPAD_DB_USER`: By default Etherpad Lite will attempt to connect as root
to the mysql container.
* `ETHERPAD_DB_PASSWORD`: MySQL password to use, mandatory. If legacy links
* `ETHERPAD_DB_PASS`: MySQL password to use, mandatory. If legacy links
are used and ETHERPAD_DB_USER is root, then `MYSQL_ENV_MYSQL_ROOT_PASSWORD` is
automatically used.
* `ETHERPAD_DB_NAME`: The mysql database to use. Defaults to *etherpad*. If the
@ -73,3 +80,4 @@ database is not available, it will be created when the container is launched.
The generated settings.json file will be available as a volume under
*/opt/etherpad-lite/var/*.

View file

@ -4,24 +4,25 @@ version: "3.4"
services:
db:
image: mariadb:10.3
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes:
- db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: insecure
MYSQL_DATABASE: etherpad
MARIADB_ROOT_PASSWORD: insecure
MARIADB_DATABASE: etherpad
etherpad:
build: .
build:
context: .
dockerfile: Dockerfile
image: glenux/etherpad:latest
environment:
DATABASE_URL: mysql://root:insecure@db/etherpad
DATABASE_URL: mysql://root:insecure:3306@db/etherpad
ETHERPAD_ADMIN_USER: admin
ETHERPAD_ADMIN_PASSWORD: insecure
NODE_ENV: production
ports:
- "9001:9001"
depends_on:
- "db"
- 9001:9001
volumes:
db_data: {}

View file

@ -96,18 +96,22 @@ EOF
fi
cat <<- EOF >> settings.json
"ep_expiration" : {
"enabled": true,
"max_days": 30
}
}
EOF
fi
if ! grep -q '/* GLENUX BEGIN */' src/static/css/pad.css ; then
cat >> src/static/css/pad.css <<-MARK
/* GLENUX BEGIN */
body#innerdocbody {
font-size: 16px;
line-height: 20px
}
MARK
cat >> src/static/css/pad.css <<- MARK
/* GLENUX BEGIN */
body#innerdocbody {
font-size: 16px;
line-height: 20px
}
MARK
fi
exec "$@"