Verified Commit 7d770057 authored by Quentin Duchemin's avatar Quentin Duchemin
Browse files

Replace init entrypoint with delete_after_delay process

parent fc12cd67
FROM perl:5-buster
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y install build-essential libssl-dev libio-socket-ssl-perl
RUN cpan Carton
RUN mkdir -p /opt/delete_after_delay
COPY ./ ./delete_after_delay ./cpanfile.snapshot ./cpanfile /opt/delete_after_delay/
COPY ./ ./cpanfile.snapshot ./cpanfile /opt/delete_after_delay/
WORKDIR /opt/delete_after_delay
RUN carton install
COPY ./docker/init /
ENTRYPOINT ["/init"]
CMD ["carton", "exec", "/opt/delete_after_delay/", "--", "--verbose", "--daemon", "--instance", "instanceD"]
* You will still need to install the plugin `ep_delete_after_delay` on your etherpad instance if you want to be sure that pads that expired between two check loops can't be accessed.
## Dependencies
### Carton
Carton is a Perl dependencies manager, it will get what you need, so don't bother for Perl modules dependencies (but you can read the file `cpanfile` if you want).
sudo cpan Carton
Some modules that Carton will install need to be compiled. So you will need some tools:
sudo apt-get install build-essential libssl-dev
## Installation
After installing Carton:
cd /opt
git clone delete_after_delay
cd delete_after_delay
carton install
sudo cp delete_after_delay.yml.template /etc/delete_after_delay.yml
sudo chmod 640 /etc/delete_after_delay.yml
sudo vi /etc/delete_after_delay.yml
The `dir` setting is really important: when a pad is expired, `delete_after_delay` stores a HTML copy of the pad in `$dir/deleted_pads`.
The plugin `ep_delete_after_delay` does the same thing, in the etherpad installation directory.
You can choose to set `dir` to the etherpad installation directory but then you will need to be sure that the `deleted_pads` is writable by the etherpad user AND the user you run `delete_after_delay` with (you can change it in `delete_after_delay@.service` with the `User` setting if you run it as a systemd service).
Warning! Verify that the expiration delays in `/etc/delete_after_delay.yml` and in your etherpad instance's `settings.json` are the same!
Check that `loop` setting is set to `false` in your etherpad instance's `settings.json`.
### delete\_after\_delay
You can see the options of `delete_after_delay` with:
/opt/delete_after_delay/delete_after_delay -h
If you want to start `delete_after_delay` as a systemd service:
sudo cp delete_after_delay@.service /etc/systemd/system/delete_after_delay@.service
# Change User in /etc/systemd/system/delete_after_delay@.service in needed
sudo systemctl daemon-reload
# To start delete_after_delay on instance foo:
sudo systemctl start delete_after_delay@foo.service
# To start at boot:
sudo systemctl enable delete_after_delay@foo.service
Edit `/etc/systemd/system/delete_after_delay@.service` to change the delay between check loops if you want.
![English:]( **Framasoft uses GitLab** for the development of its free softwares. Our Github repositories are only mirrors.
If you want to work with us, **fork us on [](**. (no registration needed, you can sign in with your Github account)
![Français :]( **Framasoft utilise GitLab** pour le développement de ses logiciels libres. Nos dépôts Github ne sont que des miroirs.
Si vous souhaitez travailler avec nous, **forkez-nous sur [](**. (l'inscription n'est pas nécessaire, vous pouvez vous connecter avec votre compte Github)
* * *
Fork du dépôt :
Adapté pour Docker.
......@@ -19,9 +13,9 @@ So we developped an external script to delete the expired pads without loading t
`delete_after_delay` asks an etherpad instance for the list of its pads, then check (and delete if expired) all of them.
# Installation
# Usage
Have a look at the [ file](
Build the image, see [README](./docker/
# License
cd /opt/delete_after_delay/
/usr/local/bin/carton exec ./ -- $@
key: etherpad instance API key
dir: /var/www/foo.etherpad/
del: 31536000
# Change User if you want
ExecStart=/opt/delete_after_delay/delete_after_delay -i %i -s 86400 -d
# picasoft-docker.1.0.1
Replace init entrypoint with delete_after_delay process
# picasoft-docker.1.0
Initial Docker image with init script waiting for instance to be up and API key to be available
# Dockerfile for `delete_pad_after_delay`
This directory only contains an init script. It will grab the `$DIR`, `$URL` and `$DEL` environment variables and pass them to `delete_pad_after_delay`. The API key will be read from a file specified with the `$APIKEY_PATH` variable (it must be mounted or written somehow). You could check picasoft's docker-compose.yml as an example. Only one instance is supported, it is (internally) named `instanceD`.
Use `DELAY_BETWEEN_CHECK` to configure the delay between check/deletion loop.
......@@ -16,4 +16,5 @@ echo " key: $(cat $APIKEY_PATH)" >> $CF
echo " dir: $DIR" >> $CF
echo " url: $URL" >> $CF
echo " del: $DEL" >> $CF
/opt/delete_after_delay/delete_after_delay --verbose --daemon --instance instanceD
exec $@ --sleep $DELAY_BETWEEN_CHECK
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment