Skip to content

Multiple instances running on same server interfere with each other #127

Description

@lbdroid

Situation is this;

I have two instances of Nextcloud running on the same physical server on different domain names.
These two instances use a different redis database/index/prefix (or whatever you would like to call it, the dbindex parameter).
I have also set up two instances of notify_push listening on different ports on the same server.

Startup trace on the first instance;

[2021-09-09 10:37:54.083333 -04:00] TRACE [notify_push] src/main.rs:46: Running with config: Config { database: AnyConnectOptions(MySql(MySqlConnectOptions { host: "localhost", port: 3306, socket: None, username: "----", password: Some("----"), database: Some("nc1"), ssl_mode: Preferred, ssl_ca: None, statement_cache_capacity: 100, charset: "utf8mb4", collation: None, log_settings: LogSettings { statements_level: Info, slow_statements_level: Warn, slow_statements_duration: 1s } })), database_prefix: "oc_", redis: [ConnectionInfo { addr: Tcp("127.0.0.1", 6379), redis: RedisConnectionInfo { db: 0, username: None, password: None } }], nextcloud_url: "https://nc1.my.tld/", metrics_bind: None, log_level: "notify_push=trace", bind: Tcp(0.0.0.0:7867), allow_self_signed: false, no_ansi: false }
[2021-09-09 10:37:54.086174 -04:00] DEBUG [notify_push::storage_mapping] src/storage_mapping.rs:96: querying storage mapping for 1
[2021-09-09 10:37:54.154635 -04:00] TRACE [notify_push] src/main.rs:63: Listening on 0.0.0.0:7867

Startup trace on the second instance;

[2021-09-09 10:35:48.107783 -04:00] TRACE [notify_push] src/main.rs:46: Running with config: Config { database: AnyConnectOptions(MySql(MySqlConnectOptions { host: "localhost", port: 3306, socket: None, username: "----", password: Some("----"), database: Some("nc2"), ssl_mode: Preferred, ssl_ca: None, statement_cache_capacity: 100, charset: "utf8mb4", collation: None, log_settings: LogSettings { statements_level: Info, slow_statements_level: Warn, slow_statements_duration: 1s } })), database_prefix: "oc_", redis: [ConnectionInfo { addr: Tcp("127.0.0.1", 6379), redis: RedisConnectionInfo { db: 2, username: None, password: None } }], nextcloud_url: "https://nc2.different.tld/", metrics_bind: None, log_level: "notify_push=trace", bind: Tcp(0.0.0.0:7869), allow_self_signed: false, no_ansi: false }
[2021-09-09 10:35:48.111389 -04:00] DEBUG [notify_push::storage_mapping] src/storage_mapping.rs:96: querying storage mapping for 1
[2021-09-09 10:35:48.386990 -04:00] TRACE [notify_push] src/main.rs:63: Listening on 0.0.0.0:7869

As you can see, instances are listening on different ports, connecting to different nextcloud instances, and using different redis db's.

Apache config, INST 1:

        ProxyPass /push/ws ws://localhost:7867/ws
        ProxyPass /push/ http://localhost:7867/
        ProxyPassReverse /push/ http://localhost:7867/

Apache config, INST 2:

        ProxyPass /push/ws ws://localhost:7869/ws
        ProxyPass /push/ http://localhost:7869/
        ProxyPassReverse /push/ http://localhost:7869/

When a client connects, it connects to the correct instance of notify_push, and it proceeds to regularly ping the users connected to that instance.

The PROBLEM, however, is that when a message is generated by EITHER instance of Nextcloud, it ends up being received by BOTH instances of notify_push. This is especially a problem when there is username overlap between the two Nextcloud instances, because when a notification is meant for {username}/nc1, it is delivered to both {username}/nc1 and {username}/nc2.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions