Last active
July 13, 2016 15:13
-
-
Save gilbertoca/285095002a9325fbe3e3 to your computer and use it in GitHub Desktop.
Manual install of the GitBlit project on openSUSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#folder structure | |
#GITBLIT_PATH=/opt/gitblit/app/[VERSION] | |
#GITBLIT_BASE_FOLDER=/opt/gitblit/data | |
#GITBLIT_HTTP_PORT=0 | |
#GITBLIT_HTTPS_PORT=8443 | |
#GITBLIT_LOG=/opt/gitblit/app/[VERSION]/gitblit.log | |
#run as gitblit user | |
groupadd gitblit | |
useradd -g gitblit -d /opt/gitblit gitblit | |
# Install Gitblit | |
wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz | |
#[VERSION]- 1.6.2 | |
mkdir -p /opt/gitblit/app/[VERSION] | |
tar -xvzf gitblit-1.6.2.tar.gz -C /opt/gitblit/app/[VERSION] | |
# Move the data files to a separate directory | |
mkdir -p /opt/gitblit/data | |
#mv /opt/gitblit/app/[VERSION]/data/* /opt/gitblit/data | |
mv /opt/gitblit/app/1.6.2/data/* /opt/gitblit/data | |
chown -R gitblit.gitblit /opt/gitblit | |
#I think it is not needed do this: chmod -r 750 /opt/gitblit | |
#Running with default setup | |
su - gitblit | |
cd /opt/gitblit/app/1.6.2 | |
nohup java -server -Xmx1024M -Djava.awt.headless=true -jar /opt/gitblit/app/1.6.2/gitblit.jar --baseFolder /opt/gitblit/data >> /opt/gitblit/app/1.6.2/gitblit.log 2>&1 & | |
#monitor | |
su - gitblit | |
cd app/1.6.2 | |
tail -n 50 -f gitblit.log | |
#Run it as OS service | |
mv /opt/gitblit/data/gitblit.properties /opt/gitblit/data/default.properties | |
# Adjust the default Gitblit settings to bind to 80, 443, 9418, 29418, and allow RPC administration. | |
# YOU NEED TO KNOW THE INPLICATIONS OF USING PORTS < 1024 | |
# Note: we are writing to a different file here because sed doesn't like to the same file it | |
# is streaming. This is why the original properties file was renamed earlier. | |
sed -e "s/server\.httpsPort\s=\s8443/server\.httpsPort=443/" \ | |
-e "s/server\.httpPort\s=\s0/server\.httpPort=80/" \ | |
-e "s/server\.redirectToHttpsPort\s=\sfalse/server\.redirectToHttpsPort=true/" \ | |
-e "s/web\.enableRpcManagement\s=\sfalse/web\.enableRpcManagement=true/" \ | |
-e "s/web\.enableRpcAdministration\s=\sfalse/web.enableRpcAdministration=true/" \ | |
/opt/gitblit/data/default.properties > /opt/gitblit/data/gitblit.properties | |
#Create systemd config file | |
vi /etc/systemd/system/gitblit.service | |
... | |
[Unit] | |
Description= Gitblit server | |
After=network.target remote-fs.target | |
[Service] | |
User=gitblit | |
EnvironmentFile=/etc/default/gitblit | |
WorkingDirectory=/opt/gitblit/app/1.8.0 | |
ExecStart=/usr/bin/java $JAVA_OPTS -jar gitblit.jar --baseFolder /opt/gitblit/data --shutdownPort=-1 | |
ExecStop=/usr/bin/java $JAVA_OPTS -jar gitblit.jar --baseFolder /opt/gitblit/data --stop | |
[Install] | |
WantedBy=multi-user.target | |
... | |
#Create Environment file | |
vi /etc/default/gitblit | |
... | |
# file /etc/default/gitblit | |
MODE=service | |
#-Dlog4j.configuration=file:/opt/gitblit/data/log4j.properties | |
JAVA_OPTS="-Xmx128M -Dcom.unboundid.ldap.sdk.debug.enabled=true -Dcom.unboundid.ldap.sdk.debug.level=DEBUG" | |
... | |
#Enable systemd gitblit service | |
systemctl daemon-reload && systemctl enable gitblit.service && systemctl start gitblit.service | |
#monitor | |
systemctl status gitblit.service | |
#check logging | |
journalctl -u gitblit.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment