Using git instaweb command

1. The problem I’m having:

Trying to run the git instaweb command does not seem to recognize an httpd daemon.

2. Error messages and/or full log output:

git instaweb --start --httpd caddy
caddy not found. Install caddy or use --httpd to specify another httpd daemon.

3. Caddy version:

2.7.6

systemctl status caddy
● caddy.service - Caddy
     Loaded: loaded (/etc/systemd/system/caddy.service; enabled; preset: enabled)
    Drop-In: /nix/store/4haw5096s0f4snq490yv4nsw2d56b1vi-system-units/caddy.service.d
             └─overrides.conf
     Active: active (running) since Mon 2024-08-05 08:29:18 PDT; 2h 19min ago
       Docs: https://caddyserver.com/docs/
   Main PID: 1774 (caddy)
         IP: 4.5K in, 5.3K out
         IO: 40.2M read, 76.0K written
      Tasks: 18 (limit: 37544)
     Memory: 51.4M (peak: 56.9M)
        CPU: 233ms
     CGroup: /system.slice/caddy.service
             └─1774 /nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy run --config /etc/caddy/caddy_config --adapter caddyfile

4. How I installed and ran Caddy:

a. System environment:

NixOS 24.05, x86, systemd

b. Command:

Systemd service is used to run Caddy. The command to run Caddy is:

/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy run --config /etc/caddy/caddy_config --adapter caddyfile

c. Service/unit/compose file:

systemctl cat caddy.service
# /etc/systemd/system/caddy.service
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

# /nix/store/4haw5096s0f4snq490yv4nsw2d56b1vi-system-units/caddy.service.d/overrides.conf
[Unit]
StartLimitBurst=10
StartLimitIntervalSec=14400
X-Reload-Triggers=/nix/store/caf22kfmxl10mr8wwxv2sh2sjpn35517-X-Reload-Triggers-caddy

[Service]
Environment="LOCALE_ARCHIVE=/nix/store/naa6s54b4hc55740lblbs9phv7xk317h-glibc-locales-2.39-52/lib/locale/locale-archive"
Environment="PATH=/nix/store/php4qidg2bxzmm79vpri025bqi0fa889-coreutils-9.5/bin:/nix/store/jjcsr5gs4qanf7ln5c6wgcq4sn75a978-findutils-4.9.0/bin:/nix/store/28gpmx3z6ss3znd7fhmrzmvk3x5lnfbk-gnugrep-3.11/bin:/nix/store/5zjms21vpxlkbc0qyl>
Environment="TZDIR=/nix/store/y6hmqbmbwq0rmx1fzix5c5jszla2pzmp-tzdata-2024a/share/zoneinfo"
ExecReload=
ExecReload=/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy reload --config /etc/caddy/caddy_config --adapter caddyfile --force
ExecStart=
ExecStart=/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy run --config /etc/caddy/caddy_config --adapter caddyfile 
Group=caddy
LogsDirectory=caddy
NoNewPrivileges=true
PrivateDevices=true
ProtectHome=true
ReadWritePaths=/var/lib/caddy
Restart=on-failure
RestartPreventExitStatus=1
RestartSec=5s
StateDirectory=caddy
User=caddy

[Install]
WantedBy=multi-user.target
...skipping...
# /etc/systemd/system/caddy.service
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

# /nix/store/4haw5096s0f4snq490yv4nsw2d56b1vi-system-units/caddy.service.d/overrides.conf
[Unit]
StartLimitBurst=10
StartLimitIntervalSec=14400
X-Reload-Triggers=/nix/store/caf22kfmxl10mr8wwxv2sh2sjpn35517-X-Reload-Triggers-caddy

[Service]
Environment="LOCALE_ARCHIVE=/nix/store/naa6s54b4hc55740lblbs9phv7xk317h-glibc-locales-2.39-52/lib/locale/locale-archive"
Environment="PATH=/nix/store/php4qidg2bxzmm79vpri025bqi0fa889-coreutils-9.5/bin:/nix/store/jjcsr5gs4qanf7ln5c6wgcq4sn75a978-findutils-4.9.0/bin:/nix/store/28gpmx3z6ss3znd7fhmrzmvk3x5lnfbk-gnugrep-3.11/bin:/nix/store/5zjms21vpxlkbc0qyl>
Environment="TZDIR=/nix/store/y6hmqbmbwq0rmx1fzix5c5jszla2pzmp-tzdata-2024a/share/zoneinfo"
ExecReload=
ExecReload=/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy reload --config /etc/caddy/caddy_config --adapter caddyfile --force
ExecStart=
ExecStart=/nix/store/c496kw0yni8wjg8636dwvnjb4hcn21c7-caddy-2.7.6/bin/caddy run --config /etc/caddy/caddy_config --adapter caddyfile 
Group=caddy
LogsDirectory=caddy
NoNewPrivileges=true
PrivateDevices=true
ProtectHome=true
ReadWritePaths=/var/lib/caddy
Restart=on-failure
RestartPreventExitStatus=1
RestartSec=5s
StateDirectory=caddy
User=caddy

[Install]
WantedBy=multi-user.target

d. My complete Caddy config:

cat /etc/caddy/caddy_config
{
        log {
                level ERROR
        }
}

https://devpress.localhost:443 {
        log {
                output file /var/log/caddy/access-https://devpress.localhost:443.log
        }

        root * /mnt/www/devpress
        php_fastcgi unix//run/phpfpm/devpress.localhost.sock
        file_server
}

https://nerdpress.localhost:443 {
        log {
                output file /var/log/caddy/access-https://nerdpress.localhost:443.log
        }

        root * /mnt/www/nerdpress
        php_fastcgi unix//run/phpfpm/nerdpress.localhost.sock
        file_server
}

5. Links to relevant resources:

https://git-scm.com/docs/git-instaweb

From your link:

-d
--httpd
The HTTP daemon command-line that will be executed. Command-line options may be specified here, and the configuration file will be added at the end of the command-line. Currently apache2, lighttpd, mongoose, plackup, python and webrick are supported. (Default: lighttpd)

It doesn’t appear that Caddy is actually in the list of supported servers.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.