diff options
author | pappy | 2020-05-24 03:42:54 +0200 |
---|---|---|
committer | pappy | 2020-05-24 03:42:54 +0200 |
commit | a4cfa8172265c4b35d52375f849f89516769c649 (patch) | |
tree | 2cdd6af8d568f768dd0b7ad15240e2c97c69d73d | |
parent | 4ea8533981d5c55a8c17b3f9dc5227dba1355376 (diff) | |
download | aur-a4cfa8172265c4b35d52375f849f89516769c649.tar.gz |
better configuration
-rw-r--r-- | .SRCINFO | 32 | ||||
-rw-r--r-- | 10-database.patch | 20 | ||||
-rw-r--r-- | PKGBUILD | 80 | ||||
-rw-r--r-- | database.conf | 16 | ||||
-rw-r--r-- | gitbucket.conf | 5 | ||||
-rw-r--r-- | gitbucket.install | 42 | ||||
-rw-r--r-- | gitbucket.opts | 4 | ||||
-rw-r--r-- | gitbucket.service | 7 | ||||
-rw-r--r-- | gitbucket.sh | 12 | ||||
-rw-r--r-- | gitbucket.tmpfiles | 2 | ||||
-rw-r--r-- | logback.xml | 20 |
11 files changed, 177 insertions, 63 deletions
@@ -1,27 +1,33 @@ pkgbase = gitbucket pkgdesc = A Git platform powered by Scala with easy installation, high extensibility & GitHub API compatibility pkgver = 4.33.0 - pkgrel = 1 + pkgrel = 15 url = https://gitbucket.github.io install = gitbucket.install arch = any license = AGPL3 - depends = jre8-openjdk-headless - provides = gitbucket - noextract = gitbucket-4.33.0.war - backup = etc/gitbucket/gitbucket.opts - source = gitbucket-4.33.0.war::https://github.com/gitbucket/gitbucket/releases/download/4.33.0/gitbucket.war - source = gitbucket.sh - source = gitbucket.opts + makedepends = sbt + makedepends = java-environment-openjdk>=8 + depends = java-runtime-headless>=8 + backup = etc/conf.d/gitbucket + backup = etc/gitbucket/database.conf + backup = etc/gitbucket/logback.xml + source = gitbucket-4.33.0.tar.gz::https://github.com/gitbucket/gitbucket/archive/4.33.0.tar.gz + source = 10-database.patch + source = database.conf + source = logback.xml + source = gitbucket.conf source = gitbucket.sysusers source = gitbucket.tmpfiles source = gitbucket.service - sha256sums = 35e190ddb7a2f9760d43617d2e6325c2a745ba66061daa3fa95cc9d871423506 - sha256sums = 9e676104c506cfcf1c8e7db79fe0331b55726a0530f8ad6ccc33013190535982 - sha256sums = 860d2afa0dae857f8ddd3c8de2911a60032e51aa3981b4282d525ec8cbe73638 + sha256sums = adbc771463debdc8d44d6b72713296093c6bdf5c0db46a98fa2f08df11f75e58 + sha256sums = adf29a3110aadb8268ed7113d7f712a9fb6ff51fa6d64d9e710775aa941fc457 + sha256sums = 1ad37bef23b3992356c4140e3e96fc965275a0d7ced5e4a0e64ae37cfcac5fa5 + sha256sums = c6185de1f0d118310e6e91e865c842b96343e4ebdbe8c1d2a16e1d4c270765b1 + sha256sums = 0e89640cc21ad01c7a4490fdb04c4ef111ff97343f7e8534863d7a6e080eabde sha256sums = 7839b30fafa179d3712ec4246450fbf56a70130de198da2265d872b76ac0ee0e - sha256sums = c940b928564af0062b2d0acdec13f58313435eef8f0fa927d9531f73ed601648 - sha256sums = 7ca63d855fedfe91078844f3a7d518631b17a9916ba1fbc585c3a4d345aed7ea + sha256sums = 54266df0fcce78bf6e19f2f1364d0444a64fbc161d4c673d871fc7c5707e26ce + sha256sums = ce6d4b6d24df71e63296cdb69c2cd0a439d860b4fc3633cb87b5c16fe9ec543b pkgname = gitbucket diff --git a/10-database.patch b/10-database.patch new file mode 100644 index 000000000000..86848a439185 --- /dev/null +++ b/10-database.patch @@ -0,0 +1,20 @@ +diff -rNc gitbucket-4.33.0-orig/src/main/scala/gitbucket/core/util/DatabaseConfig.scala gitbucket-4.33.0/src/main/scala/gitbucket/core/util/DatabaseConfig.scala +*** gitbucket-4.33.0-orig/src/main/scala/gitbucket/core/util/DatabaseConfig.scala 2019-12-31 10:18:13.000000000 +0100 +--- gitbucket-4.33.0/src/main/scala/gitbucket/core/util/DatabaseConfig.scala 2020-05-24 01:32:47.170037501 +0200 +*************** +*** 15,21 **** + object DatabaseConfig { + + private lazy val config = { +! val file = new File(GitBucketHome, "database.conf") + if (!file.exists) { + FileUtils.write( + file, +--- 15,21 ---- + object DatabaseConfig { + + private lazy val config = { +! val file = new File("/etc/gitbucket/database.conf") + if (!file.exists) { + FileUtils.write( + file, @@ -2,37 +2,67 @@ pkgname=gitbucket pkgver=4.33.0 -pkgrel=1 +pkgrel=15 pkgdesc="A Git platform powered by Scala with easy installation, high extensibility & GitHub API compatibility" arch=(any) url=https://gitbucket.github.io license=(AGPL3) -depends=(jre8-openjdk-headless) -provides=($pkgname) -install=$pkgname.install -backup=(etc/$pkgname/$pkgname.opts) -source=($pkgname-$pkgver.war::https://github.com/gitbucket/gitbucket/releases/download/$pkgver/$pkgname.war - - $pkgname.sh - $pkgname.opts - $pkgname.sysusers - $pkgname.tmpfiles - $pkgname.service +depends=('java-runtime-headless>=8') +install=gitbucket.install +backup=(etc/conf.d/gitbucket + etc/gitbucket/database.conf + etc/gitbucket/logback.xml + ) +source=(gitbucket-$pkgver.tar.gz::https://github.com/gitbucket/gitbucket/archive/$pkgver.tar.gz + 10-database.patch + database.conf + logback.xml + gitbucket.conf + gitbucket.sysusers + gitbucket.tmpfiles + gitbucket.service ) -noextract=($pkgname-$pkgver.war) -sha256sums=('35e190ddb7a2f9760d43617d2e6325c2a745ba66061daa3fa95cc9d871423506' - '9e676104c506cfcf1c8e7db79fe0331b55726a0530f8ad6ccc33013190535982' - '860d2afa0dae857f8ddd3c8de2911a60032e51aa3981b4282d525ec8cbe73638' +makedepends=(sbt 'java-environment-openjdk>=8') +sha256sums=('adbc771463debdc8d44d6b72713296093c6bdf5c0db46a98fa2f08df11f75e58' + 'adf29a3110aadb8268ed7113d7f712a9fb6ff51fa6d64d9e710775aa941fc457' + '1ad37bef23b3992356c4140e3e96fc965275a0d7ced5e4a0e64ae37cfcac5fa5' + 'c6185de1f0d118310e6e91e865c842b96343e4ebdbe8c1d2a16e1d4c270765b1' + '0e89640cc21ad01c7a4490fdb04c4ef111ff97343f7e8534863d7a6e080eabde' '7839b30fafa179d3712ec4246450fbf56a70130de198da2265d872b76ac0ee0e' - 'c940b928564af0062b2d0acdec13f58313435eef8f0fa927d9531f73ed601648' - '7ca63d855fedfe91078844f3a7d518631b17a9916ba1fbc585c3a4d345aed7ea') + '54266df0fcce78bf6e19f2f1364d0444a64fbc161d4c673d871fc7c5707e26ce' + 'ce6d4b6d24df71e63296cdb69c2cd0a439d860b4fc3633cb87b5c16fe9ec543b') + +PKGEXT=.pkg.tar + +prepare() +{ + cd $srcdir/gitbucket-$pkgver + + for s in ${source[@]}; do + case $s in + *.patch) + echo -n Applying patch $s... + patch -s -p1 -i ${srcdir}/$s + echo ' done' + ;; + esac + done +} + +build() +{ + cd $srcdir/gitbucket-$pkgver + sbt --batch executable +} -package() { - install -Dm755 $pkgname.sh $pkgdir/usr/lib/$pkgname/$pkgname - install -Dm644 $pkgname-$pkgver.war $pkgdir/usr/lib/$pkgname/$pkgname.war - install -Dm644 $pkgname.opts $pkgdir/etc/$pkgname/$pkgname.opts - install -Dm644 $pkgname.sysusers $pkgdir/usr/lib/sysusers.d/$pkgname.conf - install -Dm644 $pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service - install -Dm644 $pkgname.tmpfiles $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf +package() +{ + install -Dm644 gitbucket-$pkgver/target/executable/gitbucket.war $pkgdir/usr/lib/gitbucket/gitbucket.war + install -Dm644 database.conf $pkgdir/etc/gitbucket/database.conf + install -Dm644 logback.xml $pkgdir/etc/gitbucket/logback.xml + install -Dm644 gitbucket.conf $pkgdir/etc/conf.d/gitbucket + install -Dm644 gitbucket.sysusers $pkgdir/usr/lib/sysusers.d/gitbucket.conf + install -Dm644 gitbucket.service $pkgdir/usr/lib/systemd/system/gitbucket.service + install -Dm644 gitbucket.tmpfiles $pkgdir/usr/lib/tmpfiles.d/gitbucket.conf } diff --git a/database.conf b/database.conf new file mode 100644 index 000000000000..bbc29b2be615 --- /dev/null +++ b/database.conf @@ -0,0 +1,16 @@ +db { + url = "jdbc:h2:${DatabaseHome};MVCC=true" +# url = "jdbc:mysql://localhost/gitbucket?useUnicode=true&characterEncoding=utf8" +# url = "jdbc:postgresql://localhost/gitbucket" + + user = "gitbucket" + password = "gitbucket" + +# connectionTimeout = 30000 +# idleTimeout = 600000 +# maxLifetime = 1800000 +# minimumIdle = 10 +# maximumPoolSize = 10 +} + + diff --git a/gitbucket.conf b/gitbucket.conf new file mode 100644 index 000000000000..f52539a9007b --- /dev/null +++ b/gitbucket.conf @@ -0,0 +1,5 @@ +GITBUCKET_HOST=127.0.0.1 +GITBUCKET_PORT=8080 +GITBUCKET_PREFIX=/ +GITBUCKET_MAXFILESIZE=10000000 +GITBUCKET_UPLOADTIMEOUT=30 diff --git a/gitbucket.install b/gitbucket.install index 79be6eb6dbdf..932346a48c57 100644 --- a/gitbucket.install +++ b/gitbucket.install @@ -1,25 +1,51 @@ +status=/tmp/gitbucket.status + post_install() { + systemd-sysusers gitbucket.conf + systemd-tmpfiles --create gitbucket.conf + echo "" echo "To start gitbucket, run: systemctl start gitbucket" echo "To enable gitbucket at boot, run: systemctl enable gitbucket" echo "" } -post_upgrade() +pre_upgrade() { - systemctl daemon-reload + systemctl is-active gitbucket >$status && + systemctl stop gitbucket || + true + + if [[ -f /etc/gitbucket/gitbucket.opts && ! -f /etc/conf.d/gitbucket ]]; then + echo Converting /etc/gitbucket/gitbucket.opts to /etc/conf.d/gitbucket + cat /etc/gitbucket/gitbucket.opts | + sed 's/#.*//' | + sed '/^\s*$/d' | + tr '[:lower:]' '[:upper:]' | + sed 's/^/GITBUCKET_/' >/etc/conf.d/gitbucket + mv /etc/gitbucket/gitbucket.opts /etc/gitbucket/gitbucket.opts.unused + fi + if [[ -f /var/lib/gitbucket/database.conf && ! -f /etc/gitbucket/database.conf ]]; then + echo Moving /var/lib/gitbucket/database.conf to /etc/gitbucket/database.conf + mkdir -p /etc/gitbucket + mv /var/lib/gitbucket/database.conf /etc/gitbucket/database.conf + fi } -pre_remove() +post_upgrade() { - systemctl stop gitbucket - systemctl disable gitbucket + systemctl daemon-reload + + [[ $(cat $status) = active ]] && + systemctl start gitbucket || + true + + rm -f /tmp/gitbucket.status } -post_remove() +pre_remove() { - # cleanup - rm -rf /usr/lib/gitbucket + systemctl disable --now gitbucket } diff --git a/gitbucket.opts b/gitbucket.opts deleted file mode 100644 index 718f2e54b173..000000000000 --- a/gitbucket.opts +++ /dev/null @@ -1,4 +0,0 @@ -host=127.0.0.1 -port=8080 -prefix=/ -#max_file_size=10000000 diff --git a/gitbucket.service b/gitbucket.service index c648cc053e6d..ca58a3b49a0d 100644 --- a/gitbucket.service +++ b/gitbucket.service @@ -5,7 +5,12 @@ After=network.target [Service] User=gitbucket Group=gitbucket -ExecStart=/usr/lib/gitbucket/gitbucket +EnvironmentFile=/etc/conf.d/gitbucket +Environment=GITBUCKET_HOME=/var/lib/gitbucket +Environment=GITBUCKET_TEMPDIR=/var/lib/gitbucket/.tmp +Environment=GITBUCKET_PLUGINDIR=/var/lib/gitbucket/plugins +ExecStartPre=/bin/mkdir -p /var/lib/gitbucket/.tmp /var/lib/gitbucket/plugins +ExecStart=/usr/bin/java -Dlogback.configurationFile=/etc/gitbucket/logback.xml -jar /usr/lib/gitbucket/gitbucket.war StandardOutput=file:/var/log/gitbucket/console.log StandardError=inherit Restart=on-abort diff --git a/gitbucket.sh b/gitbucket.sh deleted file mode 100644 index 8622426a3e71..000000000000 --- a/gitbucket.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -OPTSFILE=/etc/gitbucket/gitbucket.opts -OPTIONS="$(cat $OPTSFILE | sed '/^#/d; /temp_dir/d; /gitbucket.home/d; /^$/d; s:^:--:' )" - -home_dir=$HOME -temp_dir=$HOME/.tmp - -mkdir -p $temp_dir - -exec /usr/bin/java -jar /usr/lib/gitbucket/gitbucket.war $OPTIONS --gitbucket.home=$home_dir --temp_dir=$temp_dir - diff --git a/gitbucket.tmpfiles b/gitbucket.tmpfiles index 01aaeac57847..e4f6a82d4e87 100644 --- a/gitbucket.tmpfiles +++ b/gitbucket.tmpfiles @@ -1,3 +1,5 @@ d /var/lib/gitbucket 0750 gitbucket gitbucket - d /var/log/gitbucket 0755 gitbucket gitbucket - d /run/gitbucket 0700 gitbucket gitbucket - +z /etc/gitbucket 0750 root gitbucket - +z /etc/gitbucket/* 0640 root gitbucket - diff --git a/logback.xml b/logback.xml new file mode 100644 index 000000000000..150c7e8dd04a --- /dev/null +++ b/logback.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>/var/log/gitbucket/gitbucket.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> + <fileNamePattern>/var/log/gitbucket/gitbucket-%d{yyyy-MM-dd}-%i.log.gz</fileNamePattern> + <maxFileSize>100MB</maxFileSize> + <maxHistory>60</maxHistory> + <totalSizeCap>2GB</totalSizeCap> + </rollingPolicy> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> + </encoder> + </appender> + + <root level="INFO"> + <appender-ref ref="FILE" /> + </root> + +</configuration> |