# How to prevent Pydio Cells to gobble up whatever ports it wants... \[partial workaround included\]

**URL:** <https://forum.pydio.com/t/how-to-prevent-pydio-cells-to-gobble-up-whatever-ports-it-wants-partial-workaround-included/4601>\
**Category:** Pydio Cells\
**Tags:** install\
**Created:** [July 16, 2022, 4:13pm UTC](https://forum.pydio.com/t/how-to-prevent-pydio-cells-to-gobble-up-whatever-ports-it-wants-partial-workaround-included/4601 "2022-07-16T16:13:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GwynethLlewelyn](https://yyz2.discourse-cdn.com/flex032/user_avatar/forum.pydio.com/gwynethllewelyn/32/2419_2.png) [@GwynethLlewelyn](https://forum.pydio.com/u/GwynethLlewelyn)\
**Post date:** [July 16, 2022, 4:13pm UTC](https://forum.pydio.com/t/how-to-prevent-pydio-cells-to-gobble-up-whatever-ports-it-wants-partial-workaround-included/4601/1 "2022-07-16T16:13:35Z")

</div>

Hi all,

This is supposed to be a simple question — the kind that eventually ought to find its way into the Knowledge Base!

I need to know what ports Pydio Cells opens, and how to configure each and every one individually — because otherwise there _will_ be conflicts with other running applications (even if such ports are just internal).

Many of those ports can be set on `~/.config/pydio/cells/pydio.json`, e.g.

```json
  "frontend": {
    "plugin": {
      "editor.libreoffice": {
        "LIBREOFFICE_HOST": "localhost",
        "LIBREOFFICE_PORT": "9980",
        "LIBREOFFICE_SSL": true
      }
    },
[...]
  "ports": {
    "nats": 4222,
    "pydio.gateway.rest": 34761
  },
[...]

```

There are a few more, for `cells-client` and `cells-sync`, for instance.

Other configurations, for some obscure reason, prefer to use `~/pydio.json` instead:

```json
"defaults": {
[...]
  "sites": [
      {
        "Binds": [
          "10.169.169.1:8443"
        ],
[...]
  "services": {
[...]
    "pydio.grpc.data.objects.local1": {
      "ApiKey": "<REDACTED>",
      "ApiSecret": "<REDACTED>",
      "LocalFolder": "<REDACTED>",
      "Name": "local1",
      "RunningPort": 43841
    },

```

But others get sadly completely ignored (these were added by me):

```json
  "services": {
[...]
    "pydio.grpc.broker": {
      "port": "33160"
    },
    "pydio.grpc.discovery": {
      "port": "33162"
    },
    "pydio.grpc.registry": {
      "port": "33161"
    },

```

Most notably, Pydio Cells will bind to port `8001` and `8002` no matter what is configured. And that’s a bummer, since I _need_ the port range 8000-9200 to be _free_ — these _have_ to be used for an entirely different service running on the same server, and I cannot change _them_.

The error on the logs, as expected, is:

```auto
************************************************************
✗ Error while starting discovery server:
✗ server.Start grpc: listen tcp 0.0.0.0:8002: bind: address already in use
✗ FATAL : shutting down now!
************************************************************

```

Note that I was _expecting_ to see `listen tcp 10.169.169.1:XXXX` on my particular configuration (and hopefully _never_ port `8002`!)

… but unfortunately, there was nothing that I managed to do that would _change_ that port to something that was safe (i.e. not already bound). Also, starting the _other_ application first (it’s actually a series of them, also working as a whole, and exposing that well-known port range to the exterior world…) would just get Pydio Cells eternally waiting for ports 8001-2 to be released…

* * *

My current workaround is to ‘force’ the ports via the command line:

`./cells start --grpc_port 33161 --grpc_discovery_port 33162 --config "file:///<a very long absolute path>/pydio.json"`

Granted, this will just work for a subset of the ports — currently shown with `./cells start --help` (as I’ve discovered by pure chance!):

```
  --grpc_discovery_port string Default discovery gRPC server port (registry, broker, config, and log services). (default "8002")
  --grpc_port string Default gRPC server port (all gRPC services, except discovery ones) (default "8001")
  --healthcheck int Healthcheck port number

```

In my case, since I just wished to handle ports `8001` and `8002`, this solution worked well for _me_; however, I can imagine that changing other ports would be useful as well.

Also, I wonder if any of those three can be placed inside a configuration file? If so, where? And how? Using the ‘obvious’ places, as described above, did not work.

(I know, I could try to search on the source code for an answer; and, in fact, I did a bit of searching and digging into the code in search of the bits that handle the ports, but the code for Pydio Cells is not exactly _small_ — there are tens of thousands of lines, and while I found some scattered references to some ports (such as those read from the command line), I’m not familiar enough with the overall codebase in order to figure out where to look for…)

Thanks in advance for any insights! As said, speaking strictly for _myself_, I can live with this workaround, but others might require a bit more control over _all_ ports, not just a selected few…

---

<div class="post-metadata">

**Author:** ![charles](https://yyz2.discourse-cdn.com/flex032/user_avatar/forum.pydio.com/charles/32/3_2.png) [@charles](https://forum.pydio.com/u/charles)\
**Post date:** [July 18, 2022, 7:59am UTC](https://forum.pydio.com/t/how-to-prevent-pydio-cells-to-gobble-up-whatever-ports-it-wants-partial-workaround-included/4601/2 "2022-07-18T07:59:46Z")

</div>

You’re on the right track.  
Every flag can be passed as an ENVIRONMENT variable as a CELLS\_[UPPER\_CASE] variable. So if you are using systemd, you can set up these with Environment lines and CELLS\_GRPC\_DISCOVERY\_PORT, CELLS\_GRPC\_PORT, etc…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex032/uploads/pydio/original/2X/6/61f19fa52ec15fd4250db51aea351adba0e831fd.png) [@system](https://forum.pydio.com/u/system)\
**Post date:** [September 16, 2022, 7:59am UTC](https://forum.pydio.com/t/how-to-prevent-pydio-cells-to-gobble-up-whatever-ports-it-wants-partial-workaround-included/4601/3 "2022-09-16T07:59:53Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
