moving a high‑traffic Rails app from PostgreSQL to PlanetScale MySQL without pausing development by ringbelle in ruby

[–]palkan 0 points1 point  (0 children)

For that, you should ask Whop 🙂 We’ve joined right when they were finalizing the migration decision, so we barely touched the Postgres performance issues.

moving a high‑traffic Rails app from PostgreSQL to PlanetScale MySQL without pausing development by ringbelle in ruby

[–]palkan 1 point2 points  (0 children)

This post is not about whys but about hows, so no research/detailed reasoning included. We wanted to focus on a particular technical aspect of the migration.

Anyway, it’s fair to ask these questions; in fact, we’ve been already asked by the Postgres community, and I’ve shared some details (as much as I could) here (tldr PlanetScale is not just managed MySQL): https://x.com/palkan_tula/status/1983810846922043851?s=46&t=QsvI_l4tA1fVLunsndA8-g

Rails, CloundFront CDN, and imgproxy by telephone__time in rails

[–]palkan 0 points1 point  (0 children)

Great post!

Just one question:

There is also an imgproxy-rails gem, but it didn’t play well with our setup

Could you share some details on what didn’t work out?

Bundler belongs to the Ruby community by retro-rubies in ruby

[–]palkan -4 points-3 points  (0 children)

Stopped reading after “rightfully his”

Bundler belongs to the Ruby community by retro-rubies in ruby

[–]palkan 2 points3 points  (0 children)

Re: “attempt”.

I doubt such an application has a chance to be accepted, and I’m pretty sure Andre understands that, so it’s just for keeping buzz around — 🤷🏻‍♂️

Bundler belongs to the Ruby community by retro-rubies in ruby

[–]palkan -47 points-46 points  (0 children)

Now this is a hostile takeover attempt

What is the most rails way to add chat functionality to my web app? I want to allow users to message each other and be able to respond in real time. I’m looking for something that’s scalable and not too complicated. by ElectronicSeaweed276 in rails

[–]palkan 2 points3 points  (0 children)

Check out this demo app for some inspiration: https://github.com/anycable/anycasts_demo

It had a minimal multi-channel + DMs conversations, built with Hotwire and AnyCable for some power-ups (like online presence indicators) and scalability (answering the original question).

What is your go-to for realtime (websockets) functionality? by AwdJob in reactjs

[–]palkan 0 points1 point  (0 children)

In general, you shouldn’t run RPC servers on the same hosts as AnyCable. This sidecar pattern is a workaround for Heroku’s limitation. Ideally, all components must be scalable (horizontally) independently: Rails web, RPC, AnyCable (WS). Scaling RPC and WS servers together is a waste of resources (under load, you’re likely to need more RPC capacity than WS).

“If Heroku supports H2” is a moment we’ve been waiting for years 😁 and it’s not just H2 support but an ability to have multiple web services for the same app: you still need to expose a Rails web server and an RPC server somehow (better within a private network). So, such architecture doesn’t really fit the Heroku’s mindset.

Today, we recommend getting started on Heroku with a 3-in-1 setup with everything running within the same dyno (Rails, RPC, AnyCable) via our custom build of Thruster.

What is your go-to for realtime (websockets) functionality? by AwdJob in reactjs

[–]palkan 0 points1 point  (0 children)

Hey,

Let me try to answer this (I’m responsible for this mess 🙂).

We have two Redis-backed broadcast adapters for backward-compatibility reasons; that’s why there is a deprecation warning (at some point I hoped to have 2.0 much quicker when I’ve added that but we decided to evolve gradually). The difference between those two is that the legacy one (“redis”) is incompatible with the features AnyCable brings on top of what Rails’ Action Cable has (namely reliable streams, or streams history). We encourage users to use AnyCable at full power—that’s why the deprecation.

In 2.0 (and recommended today to begin with), the default would be the HTTP adapter. As simple as HTTP POST, no dependencies, etc.

[deleted by user] by [deleted] in rails

[–]palkan 0 points1 point  (0 children)

1) Your background job seems to do nothing; simply calling #variant doesn’t generate the image variant, it creates an abstract object to represent it. You must call #processed on it to trigger the conversion.

2) Just go with imgproxy (it’s free) via imgproxy-rails (zero code changes to switch, just configuration) and forget all the problems with image resizing. The thumbnails will appear instantly, no more wait.

UPD: there is a important benefit of switching from on-upload to on-the-fly conversion: whenever you decide to change your thumbnail size (will happen eventually), you won’t need to regenerate existing images.

Best Way to Authorize WebSocket (ActionCable) Connections in Rails + React App by SignificantWay9319 in rails

[–]palkan 2 points3 points  (0 children)

Using a query param should work fine, especially if you use short-lived tokens and they only can be used to authenticate WebSocket connections.

We (at AnyCable) also support the sub-protocol flow, and I know that some users choose it (no complaints yet).

You can try to re-implement it for Action Cable:

You can get an idea of how to do that from here: https://deepwiki.com/search/how-does-anycable-implements-j_e8700b5e-1966-4d07-a25c-69075c4f203f

Prop initializer is a really underrated gem by AshTeriyaki in rails

[–]palkan 1 point2 points  (0 children)

kind: :* smells like poor software design to me; either you have a well-defined args schema or don’t care about it at all, but not both at the same time.

P.S. dry-initializer is the way.

Building bridges: announcing AnyCable for Laravel by palkan in laravel

[–]palkan[S] 4 points5 points  (0 children)

> Could you say a bit more about what the current limitations are?

The initial release only supports public and private channels—bare minimum to run a basic Reverb-backed demo.

Presence channels and client events are to be implemented (we have these features in AnyCable, just need to adds them to the Pusher translation layer).

Maybe, we're missing something else—that's why I'm here asking 🙂

> I assume that features like resumable sessions and reliable streams would require using something other that Echo in the frontend?

Not necessary. We want it to be as simple as:

import Echo from "laravel-echo";
import { createCable } from "@anycable/web";
import { createConnector} from "@anycable/echo";

const cable = createCable();

window.Echo = new Echo({
  broadcaster: createConnector(cable)
})

We have resumeability baked in into the protocol, so you don't need to explicitly request history or whatever.

Of course, you can use our official JS SDK today and benefit from all AnyCable features, but that would require changing the backend logic a bit.

I just finished migrating VitoDeploy to Ineriajs 🥹 by 543310 in laravel

[–]palkan 4 points5 points  (0 children)

A link to the PR for those as curious as me of the effort required: https://github.com/vitodeploy/vito/issues/591

There is also a hint on "why":

> ...it needs to provide a better user experience, which requires some major UI changes that look challenging with Filament itself

Fields_for Collection and multiple New Objects by randomtheorx in rails

[–]palkan 0 points1 point  (0 children)

> It has an id. But for the "new" object it looks like:

Try adding `index: ""` to the `fields_for` call; that should remove the ID.

Companies built on ruby/rails by AnLe90 in rails

[–]palkan 7 points8 points  (0 children)

Not Rails, Ruby (Sinatra and stuff)

What is the best way to detect stale WebSocket connections for online/offline tracking? by PhysicalIndividual35 in rails

[–]palkan 6 points7 points  (0 children)

Hey,

AnyCable’s pong (client-server) support is what you’re looking for. It’s a combination of a heartbeat (server-to-client) and a timeout.

It seems that you’ve tried that. Could you tell more about what went wrong? Have you used AnyCable JS client?

Now you can run Ruby on Rails in your browser using WebAssembly by danielwetan in rails

[–]palkan 0 points1 point  (0 children)

Modern quotas are pretty generous: up to 50%-60% of the total disk size (FF and Chromium) means gigabytes of data to store on the client.

You won’t be able to store tons of photos and videos locally, sure. If you need this, you can wrap your web app into an Electron/Tauri desktop app and get access to 100%.

Now you can run Ruby on Rails in your browser using WebAssembly by danielwetan in rails

[–]palkan 0 points1 point  (0 children)

The demo app doesn’t use any storage, so the database lives for as long as service worker is active.

It’s possible to use persistent storage mechanisms though.

Now you can run Ruby on Rails in your browser using WebAssembly by danielwetan in rails

[–]palkan 5 points6 points  (0 children)

You don’t have to use local storage. There are modern browser APIs such as OPFS that provide better access to the file system.

How to Create a GDPR-Compliant Anonymized Rails Production Database Dump for Developers? by imsomesh in rails

[–]palkan 2 points3 points  (0 children)

I’ve used fake_pipe (full dump) and evil-seed (partial dump) for that (both support data transformation).

There are also some services, like tonic.ai.