diff --git a/README.md b/README.md index d05521e..e80110b 100644 --- a/README.md +++ b/README.md @@ -48,12 +48,12 @@ mix setup mix run --no-halt ``` -Server listens on `http://localhost:4000` by default. +Server listens on `http://localhost:4413` by default. WebSocket clients should connect to: ```text -ws://localhost:4000/relay +ws://localhost:4413/relay ``` ### Useful endpoints @@ -76,7 +76,7 @@ Before a Nostr client can publish its first event successfully, make sure these Set `DATABASE_URL` and create/migrate the database with `Parrhesia.Release.migrate()` or `mix ecto.migrate`. 2. Parrhesia is reachable behind your reverse proxy. - Parrhesia itself listens on plain HTTP on port `4000`, and the reverse proxy is expected to terminate TLS and forward WebSocket traffic to `/relay`. + Parrhesia itself listens on plain HTTP on port `4413`, and the reverse proxy is expected to terminate TLS and forward WebSocket traffic to `/relay`. 3. `:relay_url` matches the public relay URL clients should use. Set `PARRHESIA_RELAY_URL` to the public relay URL exposed by the reverse proxy. @@ -91,7 +91,7 @@ In `prod`, these environment variables are used: - `DATABASE_URL` (**required**), e.g. `ecto://USER:PASS@HOST/parrhesia_prod` - `POOL_SIZE` (optional, default `32`) -- `PORT` (optional, default `4000`) +- `PORT` (optional, default `4413`) - `PARRHESIA_*` runtime overrides for relay config, limits, policies, metrics, and features - `PARRHESIA_EXTRA_CONFIG` (optional path to an extra runtime config file) @@ -129,7 +129,7 @@ CSV env vars use comma-separated values. Boolean env vars accept `1/0`, `true/fa | Atom key | ENV | Default | Notes | | --- | --- | --- | --- | -| `:relay_url` | `PARRHESIA_RELAY_URL` | `ws://localhost:4000/relay` | Advertised relay URL and auth relay tag target | +| `:relay_url` | `PARRHESIA_RELAY_URL` | `ws://localhost:4413/relay` | Advertised relay URL and auth relay tag target | | `:moderation_cache_enabled` | `PARRHESIA_MODERATION_CACHE_ENABLED` | `true` | Toggle moderation cache | | `:enable_expiration_worker` | `PARRHESIA_ENABLE_EXPIRATION_WORKER` | `true` | Toggle background expiration worker | | `:limits` | `PARRHESIA_LIMITS_*` | see table below | Runtime override group | @@ -155,7 +155,7 @@ CSV env vars use comma-separated values. Boolean env vars accept `1/0`, `true/fa | Atom key | ENV | Default | Notes | | --- | --- | --- | --- | -| `:port` | `PORT` | `4000` | Main HTTP/WebSocket listener | +| `:port` | `PORT` | `4413` | Main HTTP/WebSocket listener | #### `Parrhesia.Web.MetricsEndpoint` @@ -299,7 +299,7 @@ Start the relay: ```bash docker run --rm \ - -p 4000:4000 \ + -p 4413:4413 \ -e DATABASE_URL="ecto://USER:PASS@HOST/parrhesia_prod" \ -e POOL_SIZE=20 \ parrhesia:latest @@ -333,13 +333,13 @@ docker compose up -d parrhesia The relay will be available on: ```text -ws://localhost:4000/relay +ws://localhost:4413/relay ``` Notes: - `compose.yaml` keeps PostgreSQL in a separate container; the Parrhesia image only runs the app release. -- The container listens on port `4000`; use `PARRHESIA_HOST_PORT` if you want a different published host port. +- The container listens on port `4413`; use `PARRHESIA_HOST_PORT` if you want a different published host port. - Migrations are run explicitly through the one-shot `migrate` service instead of on every app boot. - Common runtime overrides can go straight into `.env`; see [`.env.example`](./.env.example) for examples. - For more specialized overrides, mount a file and set `PARRHESIA_EXTRA_CONFIG=/path/in/container/runtime.exs`. diff --git a/compose.yaml b/compose.yaml index 165513f..8acad9b 100644 --- a/compose.yaml +++ b/compose.yaml @@ -36,7 +36,7 @@ services: DATABASE_URL: ${DATABASE_URL:-ecto://parrhesia:parrhesia@db:5432/parrhesia} POOL_SIZE: ${POOL_SIZE:-20} ports: - - "${PARRHESIA_HOST_PORT:-4000}:4000" + - "${PARRHESIA_HOST_PORT:-4413}:4413" volumes: postgres-data: diff --git a/config/config.exs b/config/config.exs index b377652..6cd278b 100644 --- a/config/config.exs +++ b/config/config.exs @@ -4,7 +4,7 @@ config :postgrex, :json_library, JSON config :parrhesia, moderation_cache_enabled: true, - relay_url: "ws://localhost:4000/relay", + relay_url: "ws://localhost:4413/relay", limits: [ max_frame_bytes: 1_048_576, max_event_bytes: 262_144, @@ -68,7 +68,7 @@ config :parrhesia, admin: Parrhesia.Storage.Adapters.Postgres.Admin ] -config :parrhesia, Parrhesia.Web.Endpoint, port: 4000 +config :parrhesia, Parrhesia.Web.Endpoint, port: 4413 config :parrhesia, Parrhesia.Web.MetricsEndpoint, enabled: false, diff --git a/config/runtime.exs b/config/runtime.exs index d4eee1b..2d36789 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -375,7 +375,7 @@ if config_env() == :prod do queue_target: queue_target, queue_interval: queue_interval - config :parrhesia, Parrhesia.Web.Endpoint, port: int_env.("PORT", 4000) + config :parrhesia, Parrhesia.Web.Endpoint, port: int_env.("PORT", 4413) config :parrhesia, Parrhesia.Web.MetricsEndpoint, enabled: diff --git a/flake.nix b/flake.nix index ad4b28b..56733ae 100644 --- a/flake.nix +++ b/flake.nix @@ -47,7 +47,7 @@ Entrypoint = ["${parrhesia}/bin/parrhesia"]; Cmd = ["foreground"]; ExposedPorts = { - "4000/tcp" = {}; + "4413/tcp" = {}; }; WorkingDir = "/"; User = "65534:65534"; @@ -56,7 +56,7 @@ "LANG=C.UTF-8" "LC_ALL=C.UTF-8" "MIX_ENV=prod" - "PORT=4000" + "PORT=4413" "RELEASE_DISTRIBUTION=none" "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ]; diff --git a/test/parrhesia/config_test.exs b/test/parrhesia/config_test.exs index 3fb5ef5..5de8a7a 100644 --- a/test/parrhesia/config_test.exs +++ b/test/parrhesia/config_test.exs @@ -10,7 +10,7 @@ defmodule Parrhesia.ConfigTest do assert Parrhesia.Config.get([:limits, :auth_max_age_seconds]) == 600 assert Parrhesia.Config.get([:limits, :max_outbound_queue]) == 256 assert Parrhesia.Config.get([:limits, :max_filter_limit]) == 500 - assert Parrhesia.Config.get([:relay_url]) == "ws://localhost:4000/relay" + assert Parrhesia.Config.get([:relay_url]) == "ws://localhost:4413/relay" assert Parrhesia.Config.get([:policies, :auth_required_for_writes]) == false assert Parrhesia.Config.get([:policies, :marmot_media_max_imeta_tags_per_event]) == 8 assert Parrhesia.Config.get([:policies, :marmot_media_reject_mip04_v1]) == true diff --git a/test/parrhesia/web/connection_test.exs b/test/parrhesia/web/connection_test.exs index d29c687..65024a9 100644 --- a/test/parrhesia/web/connection_test.exs +++ b/test/parrhesia/web/connection_test.exs @@ -74,7 +74,7 @@ defmodule Parrhesia.Web.ConnectionTest do end test "AUTH rejects relay tag mismatch" do - state = connection_state(relay_url: "ws://localhost:4000/relay") + state = connection_state(relay_url: "ws://localhost:4413/relay") auth_event = valid_auth_event(state.auth_challenge, relay_url: "ws://attacker.example/relay") payload = JSON.encode!(["AUTH", auth_event])