From 3c5c45a31d7a70d6fcd4447c8d981434bf2683d8 Mon Sep 17 00:00:00 2001 From: Buzut Date: Thu, 5 Oct 2017 21:28:09 +0200 Subject: [PATCH 1/4] Update to add systemd daemon exemple systemd being the most common init system on Linux distributions, it seems logical to mention it. --- book/04-git-server/sections/git-daemon.asc | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/book/04-git-server/sections/git-daemon.asc b/book/04-git-server/sections/git-daemon.asc index c5332a494..b1227cafe 100644 --- a/book/04-git-server/sections/git-daemon.asc +++ b/book/04-git-server/sections/git-daemon.asc @@ -20,7 +20,43 @@ $ git daemon --reuseaddr --base-path=/srv/git/ /srv/git/ If you're running a firewall, you'll also need to punch a hole in it at port 9418 on the box you're setting this up on. You can daemonize this process a number of ways, depending on the operating system you're running. -On an Ubuntu machine, you can use an Upstart script. + +systemd being the most common init system among modern Linux distributions (Debian, Ubuntu, RHEL, CentOS…), you can use systemd for that purpose. Your systemd file should be places as follows: + +[source,console] +---- +/etc/systemd/system/git-daemon.service +---- + +And contain the following code. + +[source,console] +---- +[Unit] +Description=Start Git Daemon + +[Service] +ExecStart=git daemon --reuseaddr --base-path=/srv/git/ /srv/git/ + +Restart=always +RestartSec=500ms + +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=git-daemon + +User=git +Group=git + +[Install] +WantedBy=multi-user.target +---- + +You might have noticed that Git daemon is started here with `git` as both group and user. Modify it to fit your needs. Make sure provided user exists on the system. + +Finally, you'll run `systemctl enable git-daemon` to automatically start the service on boot, and usual service commands like `service start` and `service stop` are instantly avoilable. + +Until LTS 14.04, Ubuntu used upstart service unit configuration. Therefore, on Ubuntu <= 14.04 you can use an Upstart script. So, in the following file [source,console] From 4b6d7846dafc228848bfef49d405c31f324fc857 Mon Sep 17 00:00:00 2001 From: Buzut Date: Fri, 6 Oct 2017 14:37:07 +0200 Subject: [PATCH 2/4] gramar and typos --- book/04-git-server/sections/git-daemon.asc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/book/04-git-server/sections/git-daemon.asc b/book/04-git-server/sections/git-daemon.asc index b1227cafe..da1057216 100644 --- a/book/04-git-server/sections/git-daemon.asc +++ b/book/04-git-server/sections/git-daemon.asc @@ -21,7 +21,8 @@ If you're running a firewall, you'll also need to punch a hole in it at port 941 You can daemonize this process a number of ways, depending on the operating system you're running. -systemd being the most common init system among modern Linux distributions (Debian, Ubuntu, RHEL, CentOS…), you can use systemd for that purpose. Your systemd file should be places as follows: +Since `systemd` is the most common init system among modern Linux distributions, you can use it for that purpose. +Simply place a file in `/etc/systemd/system/git-daemon.service` with these contents: [source,console] ---- @@ -54,7 +55,7 @@ WantedBy=multi-user.target You might have noticed that Git daemon is started here with `git` as both group and user. Modify it to fit your needs. Make sure provided user exists on the system. -Finally, you'll run `systemctl enable git-daemon` to automatically start the service on boot, and usual service commands like `service start` and `service stop` are instantly avoilable. +Finally, you'll run `systemctl enable git-daemon` to automatically start the service on boot, and the usual service commands like `service start` and `service stop` are instantly available. Until LTS 14.04, Ubuntu used upstart service unit configuration. Therefore, on Ubuntu <= 14.04 you can use an Upstart script. So, in the following file From 0600ca0dc91539cc7b0fcba625b7eedf591088a0 Mon Sep 17 00:00:00 2001 From: Buzut Date: Sat, 7 Oct 2017 13:06:00 +0200 Subject: [PATCH 3/4] remove redundant text --- book/04-git-server/sections/git-daemon.asc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/book/04-git-server/sections/git-daemon.asc b/book/04-git-server/sections/git-daemon.asc index da1057216..ab57d6237 100644 --- a/book/04-git-server/sections/git-daemon.asc +++ b/book/04-git-server/sections/git-daemon.asc @@ -24,13 +24,6 @@ You can daemonize this process a number of ways, depending on the operating syst Since `systemd` is the most common init system among modern Linux distributions, you can use it for that purpose. Simply place a file in `/etc/systemd/system/git-daemon.service` with these contents: -[source,console] ----- -/etc/systemd/system/git-daemon.service ----- - -And contain the following code. - [source,console] ---- [Unit] From 26c829ee955dc8458375b71e65bf13b3cd9fb36a Mon Sep 17 00:00:00 2001 From: Buzut Date: Sat, 7 Oct 2017 21:12:57 +0200 Subject: [PATCH 4/4] one sentence per line --- book/04-git-server/sections/git-daemon.asc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/book/04-git-server/sections/git-daemon.asc b/book/04-git-server/sections/git-daemon.asc index ab57d6237..64f7a0d0d 100644 --- a/book/04-git-server/sections/git-daemon.asc +++ b/book/04-git-server/sections/git-daemon.asc @@ -46,11 +46,14 @@ Group=git WantedBy=multi-user.target ---- -You might have noticed that Git daemon is started here with `git` as both group and user. Modify it to fit your needs. Make sure provided user exists on the system. +You might have noticed that Git daemon is started here with `git` as both group and user. + +Modify it to fit your needs and make sure provided user exists on the system. Finally, you'll run `systemctl enable git-daemon` to automatically start the service on boot, and the usual service commands like `service start` and `service stop` are instantly available. -Until LTS 14.04, Ubuntu used upstart service unit configuration. Therefore, on Ubuntu <= 14.04 you can use an Upstart script. +Until LTS 14.04, Ubuntu used upstart service unit configuration. +Therefore, on Ubuntu <= 14.04 you can use an Upstart script. So, in the following file [source,console]