asciinema / asciinema-server

Platform for hosting and sharing terminal session recordings
https://docs.asciinema.org/manual/server/
Apache License 2.0
2.31k stars 265 forks source link

Increased file size limit is not acknowledged, still shows asciicast too big error #366

Closed ntrsboy closed 1 year ago

ntrsboy commented 4 years ago

Hello, we have an issue uploading larger asciicasts to our self-hosted asciinema-server. Our files are too large for the default setting, so we increased the values as shown at this guide. We made the necessary changes, rebuilt, and restarted, however trying to upload a file still gives us the "Sorry, your asciicast is too big." error.

Here is our lib/asciinema-web/endpoint.ex config file:

  use Phoenix.Endpoint, otp_app: :asciinema
  use Sentry.Phoenix.Endpoint

  # The session will be stored in the cookie and signed,
  # this means its contents can be read but not tampered with.
  # Set :encryption_salt if you would also like to encrypt it.
  @session_options [
    store: :cookie,
    key: "_asciinema_key",
    signing_salt: "[redacted]"
  ]

  socket "/socket", AsciinemaWeb.UserSocket,
    websocket: true

  # Serve at "/" the static files from "priv/static" directory.
  #
  # You should set gzip to true if you are running phx.digest
  # when deploying your static files in production.
  plug Plug.Static,
    at: "/",
    from: :asciinema,
    gzip: true,
    only: ~w(css fonts images js favicon.ico robots.txt)

  # Code reloading can be explicitly enabled under the
  # :code_reloader configuration of your endpoint.
  if code_reloading? do
    socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
    plug Phoenix.LiveReloader
    plug Phoenix.CodeReloader
  end

  plug Plug.RequestId
  plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]

  plug Plug.Parsers,
    parsers: [:urlencoded, :multipart, :json],
    pass: ["*/*"],
    json_decoder: Phoenix.json_library(),
    length: 999_000_000

  plug Plug.MethodOverride
  plug Plug.Head

  plug Plug.Session, @session_options
  plug AsciinemaWeb.Router
end

Our json_decoder (in lib/asciinema-web/endpoint.ex) was set to Phoenix.json_library() by default instead of Poison as shown in the guide. We tried both types of json_decoder with identical results. Is there some limitation on how large the limit can be raised?

This server is being run using the latest version of asciinema-server on Docker on a server running Ubuntu 20.04. Any feedback on how to resolve this issue would be appreciated greatly. Thanks.

ku1ik commented 3 years ago

It seems the guide (which is now on wiki here https://github.com/asciinema/asciinema-server/wiki/Installation-guide) forgets to mention the nginx container needs to be restarted as well. Have you restarted it too by any chance?

bjuergens commented 3 years ago

I followed the guide from the wiki and it works. I can now upload file larger than 10MB

remember to rebuild the container (with docker build, not with docker-compose build) and to restart the server (docker-compose down && docker-compose up -d)

ku1ik commented 10 months ago

FYI I just made configuration of the upload size limit much easier, via the UPLOAD_SIZE_LIMIT env variable.

See here: https://docs.asciinema.org/manual/server/self-hosting/configuration/#upload-size-limit

This assumes you don't use nginx as it was previously suggested, but instead use simpler setup as shows in the current getting started guide: https://docs.asciinema.org/manual/server/self-hosting/quick-start/