Skip to content
Snippets Groups Projects
Verified Commit 75c24cf3 authored by Quentin Duchemin's avatar Quentin Duchemin
Browse files

[Lufi] Add cron tasks

parent 3d605277
No related branches found
No related tags found
No related merge requests found
FROM debian:buster
ARG LUFI_BUILD_VERSION=0.05.2
ARG APP_HOME=/lufi
ENV APP_HOME=/lufi
# Install dependencies
RUN apt-get update \
&& apt-get -yq install build-essential libssl-dev libio-socket-ssl-perl liblwp-protocol-https-perl libpq-dev wget unzip \
&& apt-get -yq install build-essential libssl-dev libio-socket-ssl-perl liblwp-protocol-https-perl libpq-dev zlib1g-dev wget unzip \
&& apt-get clean && cpan Carton
# Install Supercronic to run cron jobs
# (delete IP, delete old files...)
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-linux-amd64 \
SUPERCRONIC=supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85
RUN curl -fsSLO "$SUPERCRONIC_URL" \
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
&& chmod +x "$SUPERCRONIC" \
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
# Get Lufi release
RUN wget https://github.com/ldidry/lufi/archive/${LUFI_BUILD_VERSION}.zip && unzip ${LUFI_BUILD_VERSION}.zip \
&& rm ${LUFI_BUILD_VERSION}.zip && mv lufi-${LUFI_BUILD_VERSION} lufi
WORKDIR ${APP_HOME}
# Install Lufi's dependencies
RUN carton install --deployment --without=test --without=sqlite --without=mysql
CMD ["carton", "exec", "hypnotoad", "-f", "/lufi/script/lufi"]
# Add custom theme
COPY picadrop ${APP_HOME}/themes/picadrop
# Add custom entrypoint
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["carton", "exec", "hypnotoad", "-f", "/lufi/script/lufi"]
......@@ -15,7 +15,6 @@ services:
image: registry.picasoft.net/lufi:0.05.2
build: .
container_name: lufi
init: true
depends_on:
- lufidb
volumes:
......
echo "Create crontab for cleaning tasks..."
# See https://framagit.org/fiat-tux/hat-softwares/lufi/-/wikis/cron-jobs
# Delete the IP addresses of file's senders after a configurable delay
echo "0 0 * * * carton exec $APP_HOME/script/lufi cron cleanbdd --mode production" > /crontab.conf
# Delete files which availability delay is over
echo "0 0 * * * carton exec $APP_HOME/script/lufi cron cleanfiles --mode production" > /crontab.conf
echo "Start Lufi..."
exec $@
echo "Start supercronic..."
supercronic crontab.conf
......@@ -319,7 +319,7 @@
# Max size of the files directory, in octets
# Used by script/lufi cron watch to trigger an action
# optional, no default
max_total_size => 10*1024*1024*1024,
# max_total_size => 10*1024*1024*1024,
# Default action when files directory is over max_total_size (used with script/lufi cron watch)
# Valid values are 'warn', 'stop-upload' and 'delete'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment