commit | author | age
|
ddb15d
|
1 |
#!/bin/bash -x |
27f068
|
2 |
# This script installs Gitblit on a system running under systemd. |
ddb15d
|
3 |
# The script assumes the server is running as user giblit |
SG |
4 |
|
|
5 |
# First create a file with the default settings |
|
6 |
cat > /tmp/gitblit.defaults << EOF |
|
7 |
GITBLIT_PATH=/opt/gitblit |
|
8 |
GITBLIT_BASE_FOLDER=/opt/gitblit/data |
|
9 |
GITBLIT_HTTP_PORT=0 |
|
10 |
GITBLIT_HTTPS_PORT=8443 |
|
11 |
EOF |
|
12 |
# Create a systemd service file |
|
13 |
cat > /tmp/gitblit.service << EOF |
|
14 |
[Unit] |
|
15 |
Description=Gitblit managing, viewing, and serving Git repositories. |
|
16 |
After=network.target |
|
17 |
|
|
18 |
[Service] |
|
19 |
User=gitblit |
|
20 |
Group=gitblit |
|
21 |
Environment="ARGS=-server -Xmx1024M -Djava.awt.headless=true -jar" |
|
22 |
EnvironmentFile=-/etc/sysconfig/gitblit |
|
23 |
WorkingDirectory=/opt/gitblit |
|
24 |
ExecStart=/usr/bin/java \$ARGS gitblit.jar --httpsPort \$GITBLIT_HTTPS_PORT --httpPort \$GITBLIT_HTTP_PORT --baseFolder \$GITBLIT_BASE_FOLDER --dailyLogFile |
|
25 |
ExecStop=/usr/bin/java \$ARGS gitblit.jar --baseFolder \$GITBLIT_BASE_FOLDER --stop |
|
26 |
|
|
27 |
[Install] |
|
28 |
WantedBy=multi-user.target |
|
29 |
EOF |
|
30 |
|
|
31 |
# Finally copy the files to the destination and register the systemd unit. |
27f068
|
32 |
sudo su -c "cp /tmp/gitblit.defaults /etc/sysconfig/gitblit && cp /tmp/gitblit.service /etc/systemd/system/" |
ddb15d
|
33 |
sudo su -c "systemctl daemon-reload && systemctl enable gitblit.service && systemctl start gitblit.service" |