F1bonacc1 / process-compose

Process Compose is a simple and flexible scheduler and orchestrator to manage non-containerized applications.
https://f1bonacc1.github.io/process-compose/
Apache License 2.0
1.34k stars 52 forks source link

A column to display the `port` a process is listening on #244

Open shivaraj-bh opened 2 months ago

shivaraj-bh commented 2 months ago

Feature Request

Use Case:

It will be inconvenient to scroll up the logs of the process to usually find the port it is listening on, a port column will be nice to have.

Proposed Change:

Who Benefits From The Change(s)?

Alternative Approaches

F1bonacc1 commented 2 months ago

Hi @shivaraj-bh,

Just to make sure, are you aware that this information already exists in the general process info F3? Do you think it deserves a dedicated column?

shivaraj-bh commented 2 months ago

I can’t see that in F3, is there any configuration that needs to be set? in this case, the port used by postgres. image

shivaraj-bh commented 2 months ago

Do you think it deserves a dedicated column?

I don’t mind if its available in F3 for now, regarding whether this deserves a column, you can take call once there are enough thumbs ups on this issue.

F1bonacc1 commented 2 months ago

Are you running postgres in a script? The port should be visible like in the screenshot below: image

shivaraj-bh commented 2 months ago

Ah yes, it is in a script. Is there any workaround for such a case, i.e can we set this TCP port manually?

thenonameguy commented 2 months ago

Ah yes, it is in a script. Is there any workaround for such a case, i.e can we set this TCP port manually?

Use exec postgres instead of just postgres at the end of the script so the postgres process replaces the bash script.

shivaraj-bh commented 2 months ago

Ah yes, it is in a script. Is there any workaround for such a case, i.e can we set this TCP port manually?

Use exec postgres instead of just postgres at the end of the script so the postgres process replaces the bash script.

Thanks for the suggestion. This didn’t work though. Here’s my script:

set -o errexit
set -o nounset
set -o pipefail

export PATH="/nix/store/w11g7nvm4h1ph7kjq6c4cxna3yppsn2v-postgresql-16.4/bin:/nix/store/vb8mdklw65p9wikp97ybmnyay0xzipx3-coreutils-9.5/bin:$PATH"

PGDATA=$(readlink -f "./data/pg1")
export PGDATA
exec postgres

And the corresponding screenshot with F3 on the process: image

thenonameguy commented 2 months ago

Ah yes, it is in a script. Is there any workaround for such a case, i.e can we set this TCP port manually?

Use exec postgres instead of just postgres at the end of the script so the postgres process replaces the bash script.

Thanks for the suggestion. This didn’t work though. Here’s my script:

set -o errexit
set -o nounset
set -o pipefail

export PATH="/nix/store/w11g7nvm4h1ph7kjq6c4cxna3yppsn2v-postgresql-16.4/bin:/nix/store/vb8mdklw65p9wikp97ybmnyay0xzipx3-coreutils-9.5/bin:$PATH"

PGDATA=$(readlink -f "./data/pg1")
export PGDATA
exec postgres

And the corresponding screenshot with F3 on the process: image

Thanks for trying it, sorry it didn't work. Can you please post a screenshot of process-compose htop screenshot with tree mode enabled (F5)? The immediate child process should be postgresql, nothing in between.

shivaraj-bh commented 2 months ago

image

There is a top-level script that starts process-compose and directly under it is the postgres process. This is the top-level script:

#!/nix/store/vpvy79k1qq02p1vyqjk6nb89gwhxqvyb-bash-5.2p32/bin/bash
set -o errexit
set -o nounset
set -o pipefail

export PATH="/nix/store/4sxr0bayv0rv5xpmm7ma8p8ks3ls0lml-process-compose-1.24.2/bin:$PATH"

export PC_CONFIG_FILES=/nix/store/l7dkx7fk9i6i94m32bi800wlakika46z-process-compose-postgres.json

set -x; process-compose --no-server \
 "$@"; set +x
F1bonacc1 commented 1 month ago

Hey @shivaraj-bh,

Will you be able to provide an output of:

ss -tulpn | grep postgres
shivaraj-bh commented 1 month ago
❯ ss -tulpn | grep postgres
tcp   LISTEN 0      200                                    127.0.0.1:5433       0.0.0.0:*    users:(("postgres",pid=2807031,fd=8))
tcp   LISTEN 0      200                                    127.0.0.1:5432       0.0.0.0:*    users:(("postgres",pid=2806984,fd=8))
F1bonacc1 commented 1 month ago
tcp   LISTEN 0      200                                    127.0.0.1:5433       0.0.0.0:*    users:(("postgres",pid=2807031,fd=8))
tcp   LISTEN 0      200                                    127.0.0.1:5432       0.0.0.0:*    users:(("postgres",pid=2806984,fd=8))
                                                                                                                    ^^^^^^^

Is this PID 2806984 equal to the one shown by PC?

shivaraj-bh commented 1 month ago

image

Yes, see pg1 and pg2. Also included pg1’s process info

F1bonacc1 commented 1 month ago

Last question. Can you please:

> cd /proc/net
> grep 1538 *

and share the output (including the file name).

1538 = HEX(5432)

shivaraj-bh commented 1 month ago
tcp:   4: 0100007F:1538 00000000:0000 0A 00000000:00000000 00:00000000 00000000  1000        0 14071023 1 ffff88830e853600 100 0 0 10 0     
tcp:   5: 0100007F:DA7A 0100007F:1538 06 00000000:00000000 03:00000032 00000000     0        0 0 3 ffff888128775ed0                         
tcp:   7: 0100007F:AADC 0100007F:1538 06 00000000:00000000 03:0000041A 00000000     0        0 0 3 ffff8882a8bac660                         
tcp:  10: 0100007F:D18A 0100007F:1538 06 00000000:00000000 03:000013BA 00000000     0        0 0 3 ffff888b28b5eee0                         
tcp:  16: 0100007F:CC56 0100007F:1538 06 00000000:00000000 03:00000802 00000000     0        0 0 3 ffff8881acd96660                         
tcp:  17: 0100007F:87C0 0100007F:1538 06 00000000:00000000 03:00000BEA 00000000     0        0 0 3 ffff88835e03eaa0                         
tcp:  19: 0100007F:ED3A 0100007F:1538 06 00000000:00000000 03:00000FD2 00000000     0        0 0 3 ffff88812108ccc0 
F1bonacc1 commented 2 weeks ago

Hi @shivaraj-bh, Can you please confirm that the issue still exists in v1.40?