Compare commits
24 commits
master-nod
...
master
Author | SHA1 | Date | |
---|---|---|---|
e49f063e6b | |||
53c863d76c | |||
7f11442012 | |||
b93a767757 | |||
9304d4ce07 | |||
a850f2ceff | |||
58a1320e7b | |||
5a658e416b | |||
b9ebe9704e | |||
1f4b9248d5 | |||
67328423b9 | |||
edb63a971c | |||
9ffe51eb5c | |||
7d8c313f60 | |||
3aa7fd1bcf | |||
29926827e4 | |||
3a357cd480 | |||
03d46458e1 | |||
0e9bf1bd91 | |||
f83ffb2776 | |||
20d9c94d16 | |||
bf08c7690a | |||
97157e3a2c | |||
9b43cb41ed |
7 changed files with 207 additions and 196 deletions
76
Dockerfile
76
Dockerfile
|
@ -1,45 +1,63 @@
|
||||||
# Stable version of etherpad doesn't support npm 2
|
# Stable version of etherpad doesn't support npm 2
|
||||||
|
|
||||||
FROM node:14-slim
|
FROM node:18.1
|
||||||
MAINTAINER Glenn Y. Rolland <glenux@glenux.net>
|
MAINTAINER Glenn Y. Rolland <glenux@glenux.net>
|
||||||
|
|
||||||
ENV ETHERPAD_VERSION 1.8.7
|
ENV ETHERPAD_VERSION 1.8.18
|
||||||
|
|
||||||
# RUN = docker run ... + docker commit
|
RUN apt-get update \
|
||||||
RUN apt-get update && \
|
&& apt-get install -y unzip mariadb-client netcat \
|
||||||
apt-get install -y curl unzip mysql-client python 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 cd /opt \
|
||||||
|
&& wget \
|
||||||
RUN curl -SL \
|
|
||||||
https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION}.zip \
|
https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION}.zip \
|
||||||
> etherpad.zip && unzip etherpad && \
|
-O etherpad.zip \
|
||||||
rm etherpad.zip && \
|
&& unzip etherpad \
|
||||||
mv etherpad-lite-${ETHERPAD_VERSION} etherpad-lite
|
&& rm etherpad.zip \
|
||||||
|
&& 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
|
WORKDIR /opt/etherpad
|
||||||
RUN bin/installDeps.sh && rm settings.json \
|
USER etherpad
|
||||||
&& chmod +x /entrypoint.sh \
|
|
||||||
&& sed -i 's/^node/exec\ node/' bin/run.sh \
|
# Pre-install some plugins
|
||||||
&& ln -s var/settings.json settings.json \
|
RUN bin/installDeps.sh \
|
||||||
&& npm install \
|
&& cd src \
|
||||||
ep_author_neat ep_headings2 \
|
&& npm install --save-prod \
|
||||||
ep_set_title_on_pad ep_adminpads \
|
github:alxndr42/ep_expiration \
|
||||||
ep_workspaces ep_comments_page \
|
ep_author_neat \
|
||||||
ep_font_color ep_table_of_contents \
|
ep_headings2 \
|
||||||
&& npm audit fix
|
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
|
# ep_mypads
|
||||||
|
|
||||||
# meta-données
|
# meta-données
|
||||||
VOLUME /opt/etherpad-lite/var
|
VOLUME /opt/etherpad/var
|
||||||
EXPOSE 9001
|
EXPOSE 9001
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
CMD ["bin/run.sh", "--root"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
CMD ["./src/bin/run.sh"]
|
||||||
|
# bin/run.sh
|
||||||
|
|
||||||
|
|
13
Makefile
13
Makefile
|
@ -6,10 +6,19 @@ TAG:=$(shell TZ=UTC date +"%Y%m%d")
|
||||||
all:
|
all:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
docker build -t $(USERNAME)/$(IMAGE):$(TAG) .
|
docker-compose build
|
||||||
|
|
||||||
run:
|
run:
|
||||||
# remplir ici
|
docker-compose up --detach
|
||||||
|
|
||||||
|
logs:
|
||||||
|
docker-compose logs -f
|
||||||
|
|
||||||
|
shell:
|
||||||
|
docker-compose exec etherpad bash
|
||||||
|
|
||||||
|
kill:
|
||||||
|
docker-compose kill
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
# remplir ici
|
# remplir ici
|
||||||
|
|
64
README.md
64
README.md
|
@ -1,15 +1,7 @@
|
||||||
# Etherpad Lite image for docker
|
# 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
|
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
|
on latest nodejs image.
|
||||||
stable version of etherpad-lite does not support npm 2.
|
|
||||||
|
|
||||||
## About Etherpad Lite
|
## 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.
|
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.
|
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
|
## Quickstart
|
||||||
|
|
||||||
First you need a running mysql container, for example:
|
Copy-paste the following content in a `docker-compose.yml` file
|
||||||
|
|
||||||
```bash
|
```yaml
|
||||||
$ docker network create ep_network
|
---
|
||||||
$ docker run -d --network ep_network -e MYSQL_ROOT_PASSWORD=password --name ep_mysql mysql
|
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:
|
Then run `docker-compose up`
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker run -d \
|
|
||||||
--network ep_network \
|
|
||||||
-e ETHERPAD_DB_HOST=ep_mysql \
|
|
||||||
-e ETHERPAD_DB_PASSWORD=password \
|
|
||||||
-p 9001:9001 \
|
|
||||||
tvelocity/etherpad-lite
|
|
||||||
```
|
|
||||||
|
|
||||||
Etherpad will automatically create an `etherpad` database in the specified mysql
|
Etherpad will automatically create an `etherpad` database in the specified mysql
|
||||||
server if it does not already exist.
|
server if it does not already exist.
|
||||||
|
|
||||||
You can now access Etherpad Lite from http://localhost:9001/
|
You can now access Etherpad Lite from http://localhost:9001/
|
||||||
|
|
||||||
## Environment variables
|
## 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_TITLE`: Title of the Etherpad Lite instance. Defaults to "Etherpad".
|
||||||
* `ETHERPAD_PORT`: Port of the Etherpad Lite instance. Defaults to 9001.
|
* `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,
|
* `ETHERPAD_ADMIN_PASSWORD`: If set, an admin account is enabled for Etherpad,
|
||||||
and the /admin/ interface is accessible via it.
|
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_HOST`: Hostname of the mysql databse to use. Defaults to `mysql`
|
||||||
* `ETHERPAD_DB_USER`: By default Etherpad Lite will attempt to connect as root
|
* `ETHERPAD_DB_USER`: By default Etherpad Lite will attempt to connect as root
|
||||||
to the mysql container.
|
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
|
are used and ETHERPAD_DB_USER is root, then `MYSQL_ENV_MYSQL_ROOT_PASSWORD` is
|
||||||
automatically used.
|
automatically used.
|
||||||
* `ETHERPAD_DB_NAME`: The mysql database to use. Defaults to *etherpad*. If the
|
* `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
|
The generated settings.json file will be available as a volume under
|
||||||
*/opt/etherpad-lite/var/*.
|
*/opt/etherpad-lite/var/*.
|
||||||
|
|
||||||
|
|
|
@ -4,23 +4,25 @@ version: "3.4"
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: mariadb:10.3
|
image: mariadb:10.3
|
||||||
|
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||||
volumes:
|
volumes:
|
||||||
- db_data:/var/lib/mysql
|
- db_data:/var/lib/mysql
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: insecure
|
MARIADB_ROOT_PASSWORD: insecure
|
||||||
MYSQL_DATABASE: etherpad
|
MARIADB_DATABASE: etherpad
|
||||||
|
|
||||||
etherpad:
|
etherpad:
|
||||||
build: .
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
image: glenux/etherpad:latest
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: mysql://root:insecure@db/etherpad
|
DATABASE_URL: mysql://root:insecure:3306@db/etherpad
|
||||||
ETHERPAD_ADMIN_USER: admin
|
ETHERPAD_ADMIN_USER: admin
|
||||||
ETHERPAD_ADMIN_PASSWORD: insecure
|
ETHERPAD_ADMIN_PASSWORD: insecure
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
ports:
|
ports:
|
||||||
- "9001:9001"
|
- 9001:9001
|
||||||
depends_on:
|
|
||||||
- "db"
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db_data: {}
|
db_data: {}
|
||||||
|
|
56
entrypoint.sh
Normal file → Executable file
56
entrypoint.sh
Normal file → Executable file
|
@ -1,30 +1,27 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
chmod +x /parseurl.py
|
eval "$(sh /parseurl.sh "$DATABASE_URL" ETHERPAD_DB)"
|
||||||
/parseurl.py ETHERPAD_DB_
|
|
||||||
eval "$(/parseurl.py ETHERPAD_DB_)"
|
|
||||||
|
|
||||||
# ETHERPAD_DB_PASSWORD is mandatory in mysql container, so we're not offering
|
# ETHERPAD_DB_PASS 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
|
# 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
|
# using the password from the env variable MYSQL_ENV_MYSQL_ROOT_PASSWORD
|
||||||
# if [ "$ETHERPAD_DB_USERNAME" = 'root' ]; then
|
# if [ "$ETHERPAD_DB_USER" = 'root' ]; then
|
||||||
# : ${ETHERPAD_DB_PASSWORD:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
|
# : ${ETHERPAD_DB_PASS:=$MYSQL_ENV_MYSQL_ROOT_PASSWORD}
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
if [ -z "$ETHERPAD_DB_USERNAME" ]; then
|
if [ -z "$ETHERPAD_DB_USER" ]; then
|
||||||
echo >&2 'error: missing required ETHERPAD_DB_USERNAME environment variable'
|
echo >&2 'error: missing required ETHERPAD_DB_USER environment variable'
|
||||||
echo >&2 ' Did you forget to -e ETHERPAD_DB_USERNAME=... ?'
|
echo >&2 ' Did you forget to -e ETHERPAD_DB_USER=... ?'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$ETHERPAD_DB_PASSWORD" ]; then
|
if [ -z "$ETHERPAD_DB_PASS" ]; then
|
||||||
echo >&2 'error: missing required ETHERPAD_DB_PASSWORD environment variable'
|
echo >&2 'error: missing required ETHERPAD_DB_PASS environment variable'
|
||||||
echo >&2 ' Did you forget to -e ETHERPAD_DB_PASSWORD=... ?'
|
echo >&2 ' Did you forget to -e ETHERPAD_DB_PASS=... ?'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RANDOM_STRING="$(node -p "require('crypto').randomBytes(32).toString('hex')")}"
|
|
||||||
|
|
||||||
# Sanitize DB information
|
# Sanitize DB information
|
||||||
ETHERPAD_DB_HOST="${ETHERPAD_DB_HOST:-}"
|
ETHERPAD_DB_HOST="${ETHERPAD_DB_HOST:-}"
|
||||||
|
@ -32,7 +29,6 @@ ETHERPAD_DB_PORT="${ETHERPAD_DB_PORT:-3306}"
|
||||||
|
|
||||||
# Sanitize etherpad info
|
# Sanitize etherpad info
|
||||||
ETHERPAD_PORT="${ETHERPAD_PORT:-9001}"
|
ETHERPAD_PORT="${ETHERPAD_PORT:-9001}"
|
||||||
ETHERPAD_SESSION_KEY="${ETHERPAD_SESSION_KEY:-$RANDOM_STRING}"
|
|
||||||
ETHERPAD_TITLE="${ETHERPAD_TITLE:-Etherpad}"
|
ETHERPAD_TITLE="${ETHERPAD_TITLE:-Etherpad}"
|
||||||
|
|
||||||
# Wait for database
|
# Wait for database
|
||||||
|
@ -47,8 +43,8 @@ sleep 1
|
||||||
|
|
||||||
# Check if database already exists
|
# Check if database already exists
|
||||||
RESULT="$(mysql \
|
RESULT="$(mysql \
|
||||||
"-u${ETHERPAD_DB_USERNAME}" \
|
"-u${ETHERPAD_DB_USER}" \
|
||||||
"-p${ETHERPAD_DB_PASSWORD}" \
|
"-p${ETHERPAD_DB_PASS}" \
|
||||||
"-P${ETHERPAD_DB_PORT}" \
|
"-P${ETHERPAD_DB_PORT}" \
|
||||||
"-h${ETHERPAD_DB_HOST}" \
|
"-h${ETHERPAD_DB_HOST}" \
|
||||||
--skip-column-names \
|
--skip-column-names \
|
||||||
|
@ -58,8 +54,8 @@ if [ "$RESULT" != "$ETHERPAD_DB_NAME" ]; then
|
||||||
# mysql database does not exist, create it
|
# mysql database does not exist, create it
|
||||||
echo "Creating database ${ETHERPAD_DB_NAME}"
|
echo "Creating database ${ETHERPAD_DB_NAME}"
|
||||||
|
|
||||||
mysql "-u${ETHERPAD_DB_USERNAME}" \
|
mysql "-u${ETHERPAD_DB_USER}" \
|
||||||
"-p${ETHERPAD_DB_PASSWORD}" \
|
"-p${ETHERPAD_DB_PASS}" \
|
||||||
"-P${ETHERPAD_DB_PORT}" \
|
"-P${ETHERPAD_DB_PORT}" \
|
||||||
"-h${ETHERPAD_DB_HOST}" \
|
"-h${ETHERPAD_DB_HOST}" \
|
||||||
-e "create database ${ETHERPAD_DB_NAME}"
|
-e "create database ${ETHERPAD_DB_NAME}"
|
||||||
|
@ -73,43 +69,49 @@ if ! [ -f settings.json ]; then
|
||||||
"ip": "0.0.0.0",
|
"ip": "0.0.0.0",
|
||||||
"port" :${ETHERPAD_PORT},
|
"port" :${ETHERPAD_PORT},
|
||||||
"skinName": "colibris",
|
"skinName": "colibris",
|
||||||
"sessionKey" : "${ETHERPAD_SESSION_KEY}",
|
"trustProxy" : false,
|
||||||
|
"minify" : true,
|
||||||
|
"defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nIMPORTANT: this pad will be deleted after 30 days. Please don't consider it as document storage.",
|
||||||
"dbType" : "mysql",
|
"dbType" : "mysql",
|
||||||
"dbSettings" : {
|
"dbSettings" : {
|
||||||
"user" : "${ETHERPAD_DB_USERNAME}",
|
"user" : "${ETHERPAD_DB_USER}",
|
||||||
"host" : "${ETHERPAD_DB_HOST}",
|
"host" : "${ETHERPAD_DB_HOST}",
|
||||||
"password": "${ETHERPAD_DB_PASSWORD}",
|
"password": "${ETHERPAD_DB_PASS}",
|
||||||
"database": "${ETHERPAD_DB_NAME}"
|
"database": "${ETHERPAD_DB_NAME}"
|
||||||
},
|
},
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
if [ -n "$ETHERPAD_ADMIN_PASSWORD" ]; then
|
if [ -n "$ETHERPAD_ADMIN_PASSWORD" ]; then
|
||||||
ETHERPAD_ADMIN_USER="${ETHERPAD_ADMIN_USER:-admin}"
|
ETHERPAD_ADMIN_USER="${ETHERPAD_ADMIN_USER:-admin}"
|
||||||
echo "Creating admin user configuration for $ETHERPAD_ADMIN_USER/$ETHERPAD_ADMIN_PASSWORD"
|
echo "Creating admin user configuration for $ETHERPAD_ADMIN_USER/$ETHERPAD_ADMIN_PASSWORD"
|
||||||
|
|
||||||
cat <<- EOF >> settings.json
|
cat <<-EOF >> settings.json
|
||||||
"users": {
|
"users": {
|
||||||
"${ETHERPAD_ADMIN_USER}": {
|
"${ETHERPAD_ADMIN_USER}": {
|
||||||
"password": "${ETHERPAD_ADMIN_PASSWORD}",
|
"password": "${ETHERPAD_ADMIN_PASSWORD}",
|
||||||
"is_admin": true
|
"is_admin": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<- EOF >> settings.json
|
cat <<- EOF >> settings.json
|
||||||
|
"ep_expiration" : {
|
||||||
|
"enabled": true,
|
||||||
|
"max_days": 30
|
||||||
}
|
}
|
||||||
EOF
|
}
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! grep -q '/* GLENUX BEGIN */' src/static/css/pad.css ; then
|
if ! grep -q '/* GLENUX BEGIN */' src/static/css/pad.css ; then
|
||||||
cat >> src/static/css/pad.css <<-MARK
|
cat >> src/static/css/pad.css <<- MARK
|
||||||
/* GLENUX BEGIN */
|
/* GLENUX BEGIN */
|
||||||
body#innerdocbody {
|
body#innerdocbody {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 20px
|
line-height: 20px
|
||||||
}
|
}
|
||||||
MARK
|
MARK
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
63
parseurl.py
63
parseurl.py
|
@ -1,63 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
from urlparse import urlparse
|
|
||||||
|
|
||||||
prefix = sys.argv[1]
|
|
||||||
# print os.environ.keys
|
|
||||||
uri_str = os.environ['DATABASE_URL']
|
|
||||||
uri = urlparse(uri_str)
|
|
||||||
|
|
||||||
db_netloc = uri.netloc
|
|
||||||
|
|
||||||
db_credential = None
|
|
||||||
db_username = None
|
|
||||||
db_password = None
|
|
||||||
db_host = None
|
|
||||||
db_port = None
|
|
||||||
|
|
||||||
if db_netloc.find("@") >= 0 :
|
|
||||||
tmp_arr1 = db_netloc.split('@')
|
|
||||||
db_credential = tmp_arr1[0]
|
|
||||||
db_host = tmp_arr1[1]
|
|
||||||
|
|
||||||
if db_credential and db_credential.find(':') >= 0 :
|
|
||||||
tmp_arr2 = db_credential.split(':')
|
|
||||||
db_username = tmp_arr2[0]
|
|
||||||
db_password = tmp_arr2[1]
|
|
||||||
|
|
||||||
if db_host and db_host.find(':') >= 0 :
|
|
||||||
tmp_arr3 = db_host.split(':')
|
|
||||||
db_host = tmp_arr3[0]
|
|
||||||
db_port = tmp_arr3[1]
|
|
||||||
|
|
||||||
db_path = uri.path
|
|
||||||
db_scheme = uri.scheme
|
|
||||||
db_query = uri.query
|
|
||||||
db_fragment = uri.fragment
|
|
||||||
|
|
||||||
if db_scheme :
|
|
||||||
print(prefix + 'SCHEME=' + db_scheme)
|
|
||||||
|
|
||||||
if db_username :
|
|
||||||
print(prefix + 'USERNAME=' + db_username)
|
|
||||||
|
|
||||||
if db_password :
|
|
||||||
print(prefix + 'PASSWORD=' + db_password)
|
|
||||||
|
|
||||||
if db_host :
|
|
||||||
print(prefix + 'HOST=' + db_host)
|
|
||||||
|
|
||||||
if db_port :
|
|
||||||
print(prefix + 'PORT=' + db_port)
|
|
||||||
|
|
||||||
if db_path :
|
|
||||||
print(prefix + 'NAME=' + db_path[1:])
|
|
||||||
|
|
||||||
if db_query :
|
|
||||||
print(prefix + 'QUERY=' + db_query)
|
|
||||||
|
|
||||||
if db_fragment :
|
|
||||||
print(prefix + 'FRAGMENT=' + db_fragment)
|
|
||||||
|
|
35
parseurl.sh
Executable file
35
parseurl.sh
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447
|
||||||
|
|
||||||
|
url="$1"
|
||||||
|
prefix="$2"
|
||||||
|
proto="$(echo "$url" | grep :// | sed -e 's,^\(.*\)://.*,\1,g')"
|
||||||
|
# remove the protocol
|
||||||
|
workurl="$(echo "$url" |sed -e "s,^$proto://,,")"
|
||||||
|
# extract the user (if any)
|
||||||
|
userpass="$(echo "$workurl" | grep @ | cut -d@ -f1)"
|
||||||
|
pass="$(echo "$userpass"| grep : | cut -d: -f2)"
|
||||||
|
if [ -n "$pass" ]; then
|
||||||
|
user="$(echo "$userpass" | grep : | cut -d: -f1)"
|
||||||
|
else
|
||||||
|
user="$userpass"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# extract the host
|
||||||
|
hostport="$(echo "$workurl" |sed -e "s,$userpass@,," | cut -d/ -f1)"
|
||||||
|
# by request - try to extract the port
|
||||||
|
port="$(echo "$hostport" | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')"
|
||||||
|
host="$(echo "$hostport" | cut -d: -f1)"
|
||||||
|
# extract the path (if any)
|
||||||
|
path="/$(echo "$workurl" | grep / | cut -d/ -f2-)"
|
||||||
|
name="$(echo "$workurl" | grep / | cut -d/ -f2-)"
|
||||||
|
|
||||||
|
echo "${prefix}_URL=\"$url\""
|
||||||
|
echo "${prefix}_PROTO=\"$proto\""
|
||||||
|
echo "${prefix}_USER=\"$user\""
|
||||||
|
echo "${prefix}_PASS=\"$pass\""
|
||||||
|
echo "${prefix}_HOST=\"$host\""
|
||||||
|
echo "${prefix}_PORT=\"$port\""
|
||||||
|
echo "${prefix}_PATH=\"$path\""
|
||||||
|
echo "${prefix}_NAME=\"$name\""
|
||||||
|
|
Loading…
Reference in a new issue