From 285b2f5a065e970f5e118f4160486757d7493db2 Mon Sep 17 00:00:00 2001 From: Marius Kleidl Date: Thu, 21 Sep 2023 08:58:06 +0200 Subject: [PATCH] cli: Change default port to 8080 It is a more common HTTP port and is not confused with the SOCKS protocol, which commonly uses 1080. Closes https://github.com/tus/tusd/issues/503 --- Dockerfile | 2 +- cmd/tusd/cli/flags.go | 2 +- docs/hooks.md | 6 +++--- docs/usage-binary.md | 24 ++++++++++++------------ examples/apache2.conf | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb2fc6504..a2d4391fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ RUN apk add --no-cache ca-certificates jq bash \ COPY --from=builder /go/bin/tusd /usr/local/bin/tusd -EXPOSE 1080 +EXPOSE 8080 USER tusd ENTRYPOINT ["/usr/local/share/docker-entrypoint.sh"] diff --git a/cmd/tusd/cli/flags.go b/cmd/tusd/cli/flags.go index ed99454c1..1ffcfbf98 100644 --- a/cmd/tusd/cli/flags.go +++ b/cmd/tusd/cli/flags.go @@ -82,7 +82,7 @@ func ParseFlags() { fs.AddGroup("Listening options", func(f *flag.FlagSet) { f.StringVar(&Flags.HttpHost, "host", "0.0.0.0", "Host to bind HTTP server to") - f.StringVar(&Flags.HttpPort, "port", "1080", "Port to bind HTTP server to") + f.StringVar(&Flags.HttpPort, "port", "8080", "Port to bind HTTP server to") f.StringVar(&Flags.HttpSock, "unix-sock", "", "If set, will listen to a UNIX socket at this location instead of a TCP socket") f.StringVar(&Flags.Basepath, "base-path", "/files/", "Basepath of the HTTP server") f.BoolVar(&Flags.BehindProxy, "behind-proxy", false, "Respect X-Forwarded-* and similar headers which may be set by proxies") diff --git a/docs/hooks.md b/docs/hooks.md index 7bc0a62b4..432c54c25 100644 --- a/docs/hooks.md +++ b/docs/hooks.md @@ -93,7 +93,7 @@ Below you can find an annotated, JSON-ish encoded example of a hook request: // headers can be included multiple times, e.g. Cookies. "Header": { "Host": [ - "localhost:1080" + "localhost:8080" ], "Tus-Resumable": [ "1.0.0" @@ -246,9 +246,9 @@ $ tusd --hooks-http http://localhost:8081/write --hooks-http-retry 5 --hooks-htt gRPC Hooks are the third type of hooks supported by tusd. It is disabled by default. To enable it, pass the `--hooks-grpc` option to the tusd binary. The flag's value will be a gRPC endpoint, whose service will be used: ```bash -$ tusd --hooks-grpc localhost:8080 +$ tusd --hooks-grpc localhost:8081 -[tusd] Using 'localhost:8080' as the endpoint for gRPC hooks +[tusd] Using 'localhost:8081' as the endpoint for gRPC hooks [tusd] Using './data' as directory storage. ... ``` diff --git a/docs/usage-binary.md b/docs/usage-binary.md index 8baa58177..12594ac95 100644 --- a/docs/usage-binary.md +++ b/docs/usage-binary.md @@ -2,17 +2,17 @@ Starting the tusd upload server is as simple as invoking a single command. For example, following snippet demonstrates how to start a tusd process which accepts tus uploads at -`http://localhost:1080/files/` (notice the trailing slash) and stores them locally in the `./data` directory: +`http://localhost:8080/files/` (notice the trailing slash) and stores them locally in the `./data` directory: ``` $ tusd -upload-dir=./data [tusd] 2019/09/29 21:10:50 Using './data' as directory storage. [tusd] 2019/09/29 21:10:50 Using 0.00MB as maximum size. -[tusd] 2019/09/29 21:10:50 Using 0.0.0.0:1080 as address to listen. +[tusd] 2019/09/29 21:10:50 Using 0.0.0.0:8080 as address to listen. [tusd] 2019/09/29 21:10:50 Using /files/ as the base path. [tusd] 2019/09/29 21:10:50 Using /metrics as the metrics path. [tusd] 2019/09/29 21:10:50 Supported tus extensions: creation,creation-with-upload,termination,concatenation,creation-defer-length -[tusd] 2019/09/29 21:10:50 You can now upload files to: http://0.0.0.0:1080/files/ +[tusd] 2019/09/29 21:10:50 You can now upload files to: http://0.0.0.0:8080/files/ ``` Alternatively, if you want to store the uploads on an AWS S3 bucket, you only have to specify @@ -27,11 +27,11 @@ $ export AWS_REGION=eu-west-1 $ tusd -s3-bucket=my-test-bucket.com [tusd] 2019/09/29 21:11:23 Using 's3://my-test-bucket.com' as S3 bucket for storage. [tusd] 2019/09/29 21:11:23 Using 0.00MB as maximum size. -[tusd] 2019/09/29 21:11:23 Using 0.0.0.0:1080 as address to listen. +[tusd] 2019/09/29 21:11:23 Using 0.0.0.0:8080 as address to listen. [tusd] 2019/09/29 21:11:23 Using /files/ as the base path. [tusd] 2019/09/29 21:11:23 Using /metrics as the metrics path. [tusd] 2019/09/29 21:11:23 Supported tus extensions: creation,creation-with-upload,termination,concatenation,creation-defer-length -[tusd] 2019/09/29 21:11:23 You can now upload files to: http://0.0.0.0:1080/files/ +[tusd] 2019/09/29 21:11:23 You can now upload files to: http://0.0.0.0:8080/files/ ``` If your S3 bucket has been configured for AWS S3 Transfer Acceleration and you want to make use of that advanced service, @@ -45,11 +45,11 @@ $ export AWS_REGION=eu-west-1 $ tusd -s3-bucket=my-test-bucket.com -s3-transfer-acceleration [tusd] 2019/09/29 21:11:23 Using 's3://my-test-bucket.com' as S3 bucket for storage with AWS S3 Transfer Acceleration enabled. [tusd] 2019/09/29 21:11:23 Using 0.00MB as maximum size. -[tusd] 2019/09/29 21:11:23 Using 0.0.0.0:1080 as address to listen. +[tusd] 2019/09/29 21:11:23 Using 0.0.0.0:8080 as address to listen. [tusd] 2019/09/29 21:11:23 Using /files/ as the base path. [tusd] 2019/09/29 21:11:23 Using /metrics as the metrics path. [tusd] 2019/09/29 21:11:23 Supported tus extensions: creation,creation-with-upload,termination,concatenation,creation-defer-length -[tusd] 2019/09/29 21:11:23 You can now upload files to: http://0.0.0.0:1080/files/ +[tusd] 2019/09/29 21:11:23 You can now upload files to: http://0.0.0.0:8080/files/ ``` tusd is also able to read the credentials automatically from a shared credentials file (~/.aws/credentials) as described in https://github.com/aws/aws-sdk-go#configuring-credentials. @@ -62,7 +62,7 @@ $ export GCS_SERVICE_ACCOUNT_FILE=./account.json $ tusd -gcs-bucket=my-test-bucket.com [tusd] Using 'gcs://my-test-bucket.com' as GCS bucket for storage. [tusd] Using 0.00MB as maximum size. -[tusd] Using 0.0.0.0:1080 as address to listen. +[tusd] Using 0.0.0.0:8080 as address to listen. [tusd] Using /files/ as the base path. [tusd] Using /metrics as the metrics path. ``` @@ -77,7 +77,7 @@ $ tusd -azure-storage my-test-container [tusd] 2023/02/13 16:13:20.937373 Custom Azure Endpoint not specified in flag variable azure-endpoint. Using endpoint https://xxxxx.blob.core.windows.net [tusd] Using 0.00MB as maximum size. -[tusd] Using 0.0.0.0:1080 as address to listen. +[tusd] Using 0.0.0.0:8080 as address to listen. [tusd] Using /files/ as the base path. [tusd] Using /metrics as the metrics path. ``` @@ -91,7 +91,7 @@ $ export AZURE_STORAGE_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UV $ tusd -azure-storage my-test-container -azure-endpoint https://my-custom-endpoint.com [tusd] 2023/02/13 16:15:18.641937 Using Azure endpoint http://127.0.0.1:10000/devstoreaccount1 [tusd] Using 0.00MB as maximum size. -[tusd] Using 0.0.0.0:1080 as address to listen. +[tusd] Using 0.0.0.0:8080 as address to listen. [tusd] Using /files/ as the base path. [tusd] Using /metrics as the metrics path. ``` @@ -106,7 +106,7 @@ $ tusd -azure-storage my-test-container -azure-blob-access-tier cool [tusd] 2023/02/13 16:13:20.937373 Custom Azure Endpoint not specified in flag variable azure-endpoint. Using endpoint https://xxxxx.blob.core.windows.net [tusd] Using 0.00MB as maximum size. -[tusd] Using 0.0.0.0:1080 as address to listen. +[tusd] Using 0.0.0.0:8080 as address to listen. [tusd] Using /files/ as the base path. [tusd] Using /metrics as the metrics path. ``` @@ -186,7 +186,7 @@ $ tusd -help -metrics-path string Path under which the metrics endpoint will be accessible (default "/metrics") -port string - Port to bind HTTP server to (default "1080") + Port to bind HTTP server to (default "8080") -s3-bucket string Use AWS S3 with this bucket as storage backend (requires the AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION environment variables to be set) -s3-disable-content-hashes diff --git a/examples/apache2.conf b/examples/apache2.conf index f43a565e3..9602f238e 100644 --- a/examples/apache2.conf +++ b/examples/apache2.conf @@ -19,8 +19,8 @@ ProxyPreserveHost on # Pass requests to tusd server - ProxyPass /files http://localhost:1080/files - ProxyPassReverse /files http://localhost:1080/files + ProxyPass /files http://localhost:8080/files + ProxyPassReverse /files http://localhost:8080/files # This SSL configuration has been taken from Mozilla SSL Generator: