diff --git a/data/conf/backup.conf b/data/conf/backup.conf new file mode 100644 index 0000000..b2fcfb4 --- /dev/null +++ b/data/conf/backup.conf @@ -0,0 +1,20 @@ +# Backup timing (Required) +# For details, see http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html +# This example, backup 12am every day +akka { + quartz { + schedules { + Backup { + expression = "0 0 0 * * ?" + } + } + } +} + +backup { + archive-destination = """/srv/gitbucket/backup""" + + # Maximum number of backup archives to keep (if 0 or negative value, keep unlimited) (Optional) + # If not specified, keep unlimited + archive-limit = 10 +} diff --git a/docker-compose.yml b/docker-compose.yml index 1e76d77..240523e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,8 +20,9 @@ - ./data/data/:/srv/gitbucket/data/ - ./data/gist/:/srv/gitbucket/gist/ - ./data/plugins/:/srv/gitbucket/plugins/ - #- ./data/tmp/:/srv/gitbucket/tmp/ + - ./data/backup/:/srv/gitbucket/backup/ - ./data/conf/gitbucket/gitbucket.conf:/srv/gitbucket/gitbucket.conf + - ./data/conf/backup.conf:/srv/gitbucket/backup.conf tmpfs: - /tmp ports: diff --git a/docker/Dockerfile b/docker/Dockerfile index 753de94..5f58ac4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,20 +2,16 @@ LABEL maintainer "Pascal Gollor " # ports -EXPOSE 29418 -EXPOSE 8080 +EXPOSE 29418/tcp +EXPOSE 8080/tcp # environment variables ENV GITBUCKET_HOST 0.0.0.0 ENV GITBUCKET_PORT 8080 ENV GITBUCKET_HOME /srv/gitbucket -# mark volumes -VOLUME $GITBUCKET_HOME/repositories -VOLUME $GITBUCKET_HOME/data -VOLUME $GITBUCKET_HOME/gist -VOLUME $GITBUCKET_HOME/plugins -#VOLUME $GITBUCKET_HOME/tmp +# create home +RUN mkdir -p $GITBUCKET_HOME # update mirror RUN echo http://ftp.halifax.rwth-aachen.de/alpine/latest-stable/main > /etc/apk/repositories; \ @@ -28,10 +24,21 @@ # get gitbucket RUN wget https://github.com/gitbucket/gitbucket/releases/download/4.30.1/gitbucket.war -O $GITBUCKET_HOME/latest.war +# get backup plugin +RUN mkdir $GITBUCKET_HOME/plugins +RUN wget https://github.com/jyuch/gitbucket-backup-plugin/releases/download/1.2.1/gitbucket-backup-plugin-gitbucket_4.29.0-1.2.1.jar -O $GITBUCKET_HOME/plugins/gitbucket-backup-plugin-gitbucket_4.29.0-1.2.1.jar + # clean RUN apk del wget RUN rm -rf /var/cache/apk/* +# mark volumes +VOLUME $GITBUCKET_HOME/repositories +VOLUME $GITBUCKET_HOME/data +VOLUME $GITBUCKET_HOME/gist +VOLUME $GITBUCKET_HOME/plugins +VOLUME $GITBUCKET_HOME/backup + # set environment WORKDIR $GITBUCKET_HOME