From: Joey Hess Date: Tue, 23 Jul 2024 00:44:48 +0000 (-0400) Subject: change default port to 9417 X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~21^2~228^2~85 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=06de2ad9722d7120a1f1a05ce983da248eeb39e0;p=git-annex.git change default port to 9417 Port 80 would need root, not a good idea, so pick something that might work by default. 9418 is git protocol's port. 9419 is used by something, but nothing known uses 9417, so it's as good a default as any. --- diff --git a/Command/P2PHttp.hs b/Command/P2PHttp.hs index 5e0e8a172c..ce2470baa7 100644 --- a/Command/P2PHttp.hs +++ b/Command/P2PHttp.hs @@ -79,7 +79,7 @@ seek o = getAnnexWorkerPool $ \workerpool -> do mkGetServerMode authenv o Warp.run (fromIntegral port) (p2pHttpApp st) where - port = fromMaybe 80 (portOption o) + port = fromMaybe defaultHttpProtocolPort (portOption o) mkGetServerMode :: M.Map Auth P2P.ServerMode -> Options -> GetServerMode mkGetServerMode _ o _ Nothing diff --git a/P2P/Http.hs b/P2P/Http.hs index 9919822f0a..ce1e1a44b2 100644 --- a/P2P/Http.hs +++ b/P2P/Http.hs @@ -43,6 +43,9 @@ import Control.Concurrent.Async import Control.Concurrent import System.IO.Unsafe +defaultHttpProtocolPort :: Int +defaultHttpProtocolPort = 9417 -- Git protocol is 9418 + type P2PHttpAPI = "git-annex" :> SU :> PV3 :> "key" :> GetAPI :<|> "git-annex" :> SU :> PV2 :> "key" :> GetAPI diff --git a/doc/git-annex-p2phttp.mdwn b/doc/git-annex-p2phttp.mdwn index 323ec7006a..3c45c35d24 100644 --- a/doc/git-annex-p2phttp.mdwn +++ b/doc/git-annex-p2phttp.mdwn @@ -16,22 +16,27 @@ As well as serving the git-annex HTTP API, this server provides a convenient way to download the content of any key, by using the path "/git-annex/$uuid/$key". For example: - $ curl http://localhost:8080/git-annex/f11773f0-11e1-45b2-9805-06db16768efe/key/SHA256E-s6--5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 + $ curl http://localhost:9417/git-annex/f11773f0-11e1-45b2-9805-06db16768efe/key/SHA256E-s6--5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03 hello # OPTIONS -* `--jobs=N` +* `--jobs=N` `-JN` - Use this or annex.jobs must be set to configure the number of worker + This or annex.jobs must be set to configure the number of worker threads. Since the webserver itself uses one thread, this needs to be set to 2 or more. + A good choice is one worker per CPU core: `--jobs=cpus` + * `--port=N` - Port to listen on. Default is port 80. + Port to listen on. Default is port 9417. + + It is not recommended to run this command as root in order to + use a low port like port 80. * `--authenv` @@ -46,7 +51,7 @@ convenient way to download the content of any key, by using the path environment variables like `GIT_ANNEX_P2PHTTP_PERMISSIONS_alice=readonly`. The value can be either "readonly" or "appendonly". When this is not set, - the default is to give the user full write access. + the default is to give the user full read+write+remove access. * `--authenv-http` @@ -66,7 +71,8 @@ convenient way to download the content of any key, by using the path * `--wideopen` - Gives unauthenticated users full read+write access to the repository. + Gives unauthenticated users full read+write+remove access to the + repository. Please think carefully before enabling this option.