We control the Decidim instance through our Strapi backend. To establish a connection between the backend and Decidim, we incorporate functionality (a Ruby gem) into the Decidim codebase, exposing a private API within a private network. This technique enables us to expose an internal API for Decidim, accessible exclusively by our Strapi backend.

Internal API for decidim: gRPC

From voca, we need to execute remote procedures, which are sometimes system calls like bundle exec rails assets:precompile. To securely run these procedures, we have decided to expose another internal API through a private channel.

This channel is always between the voca backend and the specific decidim instance.

Why did we choose gRPC?

gRPC technology has some advantages that are significant for us:

Prototypes

We use several prototypes for decidim, which will be managed by our voca gem.

    // region/Settings
    rpc GetSettings(google.protobuf.Empty) returns (GetSettingsResponse) { }
    rpc SetSettings(SetSettingsRequest) returns (google.protobuf.Empty) { }

    // region/Seed
    rpc CompileAssets(google.protobuf.Empty) returns (google.protobuf.Empty) {}
    rpc SetupDb(google.protobuf.Empty) returns (google.protobuf.Empty) {}
    rpc SeedAdmin(SeedAdminRequest) returns (SeedAdminResponse) {}

Infrastructure

On every Decidim environment we create on Jelastic, we add a Docker container that will run a gRPC server. This gRPC server (powered by gruf) has the Rails and Decidim context and will be able to look directly at the data models and Decidim code actions. Being on a separate container allows us to have a private gRPC server (mounted on a private network).