WebSockets don't work
I suppose my configuration is wrong somehow.
Trying to enable push notifications I see in logs such things:
prod.secret.exs
:
use Mix.Config
websocket_config = [
path: "/websocket",
serializer: [
{Phoenix.Socket.V1.JSONSerializer, "~> 1.0.0"},
{Phoenix.Socket.V2.JSONSerializer, "~> 2.0.0"}
],
timeout: 60_000,
transport_log: false,
compress: false
]
config :pleroma, Pleroma.Web.Endpoint,
instrumenters: [Pleroma.Web.Endpoint.Instrumenter],
secret_key_base: "",
secure_cookie_flag: true,
url: [host: "ministry.moonbutt.science", scheme: "https", port: 443],
http: [
dispatch: [
{:_,
[
{"/api/v1/streaming", Pleroma.Web.MastodonAPI.WebsocketHandler, []},
{"/websocket", Phoenix.Endpoint.CowboyWebSocket,
{Phoenix.Transports.WebSocket,
{Pleroma.Web.Endpoint, Pleroma.Web.UserSocket, websocket_config}}},
{:_, Phoenix.Endpoint.Cowboy2Handler, {Pleroma.Web.Endpoint, []}}
]}
]
],
render_errors: [view: Pleroma.Web.ErrorView, accepts: ~w(json)],
pubsub: [name: Pleroma.PubSub, adapter: Phoenix.PubSub.PG2],
extra_cookie_attrs: [
"SameSite=Lax"
]
config :pleroma, :http_security,
enabled: true,
sts: true,
sts_max_age: 31_536_000,
ct_max_age: 2_592_000,
referrer_policy: "same-origin"
config :pleroma, Pleroma.Emails.Mailer,
adapter: Swoosh.Adapters.SMTP,
relay: "",
username: "",
password: "",
port: 587,
ssl: false,
tls: :always,
auth: :always
config :pleroma, :fetch_initial_posts,
enabled: true,
pages: 5
config :pleroma, :instance,
name: "Ministry of Moonbutt Science",
email: "commagray@sunbutt.faith",
notify_email: "mailmare@derpy.email",
description: "Luna's podcasting studio.",
limit: 5000,
registrations_open: true,
account_activation_required: true,
invites_enabled: false,
max_pinned_statuses: 5,
no_attachment_links: true,
banner_upload_limit: (4*1_048_576),
background_upload_limit: (4*1_048_576),
avatar_upload_limit: (4*1_048_576),
upload_limit: (4*1_048_576),
extended_nickname_format: true,
welcome_user_nickname: "commagray",
welcome_message: "What's new, dickhead? Hehehe.",
healthcheck: true
config :pleroma, :media_proxy,
enabled: true,
proxy_opts: [
redirect_on_failure: true,
proxy_opts: [max_body_length: (4*1_048_576)],
http: [
follow_redirect: true,
pool: :media
]
]
config :pleroma, Pleroma.Repo,
adapter: Ecto.Adapters.Postgres,
username: "",
password: "",
database: "",
hostname: "",
pool_size: 10
config :pleroma, :rich_media, enabled: true
config :pleroma, :chat, enabled: false
config :web_push_encryption, :vapid_details,
subject: "mailto:commagray@sunbutt.faith",
public_key: "",
private_key: ""
config :pleroma, :frontend_configurations,
pleroma_fe: %{
showInstanceSpecificPanel: true,
scopeOptionsEnabled: true,
formattingOptionsEnabled: true,
theme: "pleroma-sharp",
logo: "/static/logo.webp",
logoMask: false,
background: "/static/background.webp"
}
config :pleroma, :emoji,
shortcode_globs: ["/emoji/custom/**/*.png"],
groups: [
Unsorted: ["/emoji/custom/unsorted/*.png"],
Ponymoji: ["/emoji/custom/ponymoji/*.png"],
Roomoji: ["/emoji/custom/roomoji/*.png"],
Margomoji: ["/emoji/custom/margomoji/*.png"]
]
config :pleroma, Pleroma.Captcha,
enabled: true,
seconds_valid: 60,
method: Pleroma.Captcha.Kocaptcha
config :pleroma, :suggestions,
enabled: true,
third_party_engine:
"http://vinayaka.distsn.org/cgi-bin/vinayaka-user-match-suggestions-api.cgi?{{host}}+{{user}}",
timeout: 300_000,
limit: 23,
web: "https://vinayaka.distsn.org/?{{host}}+{{user}}"
config :pleroma, :assets,
mascots: [
luna_afterdark: %{
url: "/static/sidebar.webp",
mime_type: "image/webp"
},
],
default_mascot: :luna_afterdark
Caddyfile
:
ministry.moonbutt.science {
proxy / http://localhost:8080 { <- this is Traefik port
transparent
websocket
}
tls email@example.com {
dns cloudflare
}
gzip
limits 4mb
cache {
match_path /proxy
default_max_age 720m
}
}
traefik.toml
:
debug = false
logLevel = "ERROR"
defaultEntryPoints = ["http", "ws"]
[entryPoints]
[entryPoints.http]
address = ":8080"
[docker]
endpoint = "unix:///var/run/docker.sock"
watch = true
docker-compose.yml
:
version: '3'
services:
db:
image: postgres:11-alpine
restart: always
environment:
- POSTGRES_USER=
- POSTGRES_PASSWORD=
- POSTGRES_DB=
volumes:
- /srv/containers/databases/pleroma/postgres:/var/lib/postgresql/data
networks:
- internal
labels:
- traefik.enable=false
cowboy:
build: .
image: pleroma
restart: always
ports:
- 4000:4000/tcp
networks:
- internal
- proxy
volumes:
- /srv/containers/data/pleroma/uploads:/pleroma/uploads
depends_on:
- db
labels:
- traefik.enable=true
- traefik.backend=cowboy
- traefik.docker.network=proxy
- traefik.port=4000
- traefik.frontend.rule=Host:ministry.moonbutt.science
networks:
proxy:
external: true
internal:
external: false
Any ideas on how to make it work?
UPD.
After some change, it started to generate tokens.
UPD.
Reverse-proxying directly from container to Caddy without Traefik in the middle doesn't change anything.
Edited by Sasha Epona