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 3f7f15c..e5c18a0 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..c31232f 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,20 @@ # get gitbucket RUN wget https://github.com/gitbucket/gitbucket/releases/download/4.30.1/gitbucket.war -O $GITBUCKET_HOME/latest.war +# create backup plugin +RUN mkdir $GITBUCKET_HOME/plugins + # clean -RUN apk del wget +#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 diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index c82801f..eeaac8c 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -19,4 +19,6 @@ sed -i "s/GITBUCKET_DATABASE_PASSWORD/${GITBUCKET_DATABASE_PASSWORD}/" $dbfile sed -i "s/GITBUCKET_DATABASE_USER/${GITBUCKET_DATABASE_USER}/" $dbfile +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 + exec "$@"