Gitbucket on Asustor
Installation
Installing gitbucket to Asustor NAS is quite simple. For many folks, just jump to AppCentral on your Asustor and install it from the repository. My NAS is not connected to the internet, so I had to download package (apk) from the Asustor website and install it manually.
Adjustements
Start-Stop script
Start-Stop script comming with package release 4.30.1 is not working properly regarding stopping the application. I rewrote it a bit.
The file is located at /usr/local/AppCentral/gitbucket/CONTROL/start-stop.sh
#!/bin/sh
# set locale
export LC_CTYPE=C
export GITBUCKET_HOME=/volume2/gitbucket
# set Gitbucket Server installation path
export GITBUCKET_SERVER_ROOT="/usr/local/AppCentral/gitbucket"
# ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE
export GITBUCKET_SERVER_MAX_STACK_SIZE=10000
# set Gitbucket Server lib path
export LD_LIBRARY_PATH="$GITBUCKET_SERVER_ROOT/lib"
# set Gitbucket Server pid file path
export GITBUCKET_PID_PATH="/var/run/gitbucket/gitbucket.pid"
export GITBUCKET_RUN_PATH="/var/run/gitbucket"
# set Gitbucket Server temp directory path for transcodes
export GITBUCKET_SERVER_TMPDIR=/tmp
export TMPDIR=$GITBUCKET_SERVER_TMPDIR
# set identification variables
export GITBUCKET_SERVER_INFO_VENDOR=ASUSTOR
export GITBUCKET_SERVER_INFO_DEVICE="$(cat /etc/nas.conf|awk '/Model\s/{print $3}')"
export GITBUCKET_SERVER_INFO_MODEL="$(uname -m)"
export GITBUCKET_SERVER_INFO_PLATFORM_VERSION="ADM $(cat /etc/nas.conf|awk '/Version/{print $3}')"
do_start() {
if [ ! -d "$GITBUCKET_RUN_PATH" ]; then
mkdir -p "$GITBUCKET_RUN_PATH"
fi
if [ -f "$GITBUCKET_PID_PATH" ]; then
echo "gitbucket already running. Exit."
return 1
fi
ulimit -s $GITBUCKET_SERVER_MAX_STACK_SIZE
cd $GITBUCKET_SERVER_ROOT
java -jar ./bin/gitbucket.war &
echo $! > $GITBUCKET_PID_PATH
return 0
}
do_stop() {
# Kill Gitbucket.
if [ -f "$GITBUCKET_PID_PATH" ]; then
kill $(cat "$GITBUCKET_PID_PATH")
fi
if [ -f "$GITBUCKET_PID_PATH" ]; then
rm $GITBUCKET_PID_PATH
fi
return 0
}
do_restart() {
do_stop
do_start
}
do_status() {
if [ ! -f "$GITBUCKET_PID_PATH" ]; then
echo "Status: STOPPED"
return 0
fi
PID=`cat $GITBUCKET_PID_PATH`
running=`ps | grep $PID | grep java | cut -f 2 -d " "`
if [ "$running" != "" ]; then
echo "Status: RUNNING, PID: $PID"
else
echo "Status: UNKNOWN"
fi
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart)
do_restart
;;
status)
do_status
;;
esac
exit 0
Data home
By default the data are placed to /root/.gitbucket which is not convenient for my. You just need to create new folder (Shared folder) on your NAS on convenient volume, move existing data home there, add BITBUCKET_HOME variable to the start-stop.sh script (see line 6 in my script) and restart the application.
Way of working
Create new repository
- Create new repository on gitbucket - for example project.git
- Clone it as you know:-)
Move existing repository to Gitbucket
- Create new repository on gitbucket - for example project.git
- Adjust your git config on your project
git config credential.helper store
git config credential.helper 'cache --timeout=7200'
git remote add master http://nas_ip_address/git/username/project.git
- Push changes to the master
git push -u origin master
and rest is same:-)
Issues
Asustor has buildin MariaDB server. Unfortunatelly it's version 10.0.28 which is not supported by gitbucket. I tried a lot of things but no way. Just need to wait for Asustor developers to release firmware with newer wersion of MariaDB.
There is also option to have MariaDB installed on different computer/server but this is not option right now for me. So, I have to live with standard H2 database.
Another option is to use entware repository on the nas and install MariaDB 10.2.24 version. I have to test it first...