How to identify Thin server processes? - ruby-on-rails-3

When starting multiple thin servers running Rails 3, is there any way to tell them
apart in the code?
For example, if I have a configuration like this:
port: 4000
pid: tmp/pids/thin.pid
servers: 2
Is there a way to tell whether the code is runnin on the process on port 4000 or 4001?

you can start 2 servers separately
thin start -p 4000
thin start -p 4001
:D

Supposing, that code, taht you posted is source of config/thin-config.yml
To start server with that parameters just do that:
thin start -C config/thin-config.yml
Yml files is the best way to configure server, but if you do not want to use them you can do that:
thin start -P tmp/pids/thin.pid -p 4000 -s 2

Related

Can autossh be used to monitor "ssh -D" local dynamic port forwarding (SOCKS proxy)? If so, how? If not, alternatives?

When I'm teleworking, I need to access some internal web servers. I use ssh -f -N -D 4000 someserver.mywork.com on my home computer to setup local dynamic port forwarding. Then, I configure my web browser to use localhost port 4000 as a SOCKS host, and everything works great, even with HTTPS.
The problem is that the proxy stops working every couple of days. When this happens, the ssh process prints messages like the following:
accept: Too many open files
In this scenario, I have to kill the ssh process and restart it in order to get it working again. Based on my research into this error message, I could increase the limit on the number of open files, but that doesn't seem like a permanent or an ideal solution.
I was hoping autossh might be able to monitor the connection and restart it automatically. Is that possible?
I have tried the following command:
autossh -f -M 0 -N -D 4000 someserver.mywork.com
But it didn't work. The proxy stopped working, and autossh did not restart it. Any suggestions or alternative solutions to automatically restarting my ssh proxy?

Why SSH is not working in kubernetes pods/container?

We have an application which uses SSH to copy artifact from one node to other. While creating the Docker image (Linux Centos 8 based), I have installed the Openssh server and client, when I run the image from Docker command and exec into it, I am successfully able to run the SSH command and I also see the port 22 enabled and listening ( $ lsof -i -P -n | grep LISTEN).
But if I start a POD/Container using the same image in the Kubernetes cluster, I do not see port 22 enabled and listening inside the container. Even if I try to start the sshd from inside the k8s container then it gives me below error:
Redirecting to /bin/systemctl start sshd.service Failed to get D-Bus connection: Operation not permitted.
Is there any way to start the K8s container with SSH enabled?
There are three things to consider:
Like David said in his comment:
I'd redesign your system to use a communication system that's easier
to set up, like with HTTP calls between pods.
If you put a service in front of your deployment, it is not going to relay any SSH connections. So you have to point to the pods directly, which might be pretty inconvenient.
In case you have missed that: you need to declare port 22 in your deployment template.
Please let me know if that helped.

How to use 2 localhost for single project

I have a project and I need to use 2 port numbers.
Currently, I am working on localhost:3000 and now I need to use another port number.
Does anyone know how to do this?
Use the following using the port number that you want to use.
rails s -p 3001 -b 0.0.0.1

How does one run Google refine on a different port than 3333?

By default, google refine listens on port 3333. How does one start it on a different port?
[There some other process that has taken up 3333 and I cannot change that]
Update: Running this on a Mac (10.8.x)
$ ./refine -p 9999
From the documentation: https://github.com/OpenRefine/OpenRefine/wiki/FAQ
You can specify a different port on the command line.
./refine -p <port>
If you edit /Applications/Google Refine.app/Contents/Info.plist
and replace
<string>-Xms256M -Xmx4096M -Drefine.version=r2407</string>
with
<string>-Xms256M -Xmx4096M -Drefine.version=r2407 -Drefine.port=5555</string>
(or whatever port number you need instead of 5555) this should work.
Adapted from the bottom of the OpenRefine instructions page: https://github.com/OpenRefine/OpenRefine/wiki/Installation-Instructions

Glassfish asadmin to list running applications' ports

I'm using Glassfish 3+ and deploying the applications to application server. My glassfish instance's port not "8080". when i enter the Glassfish Admin Console and going to Running Applications , i can see the port number which works. For example : 43888. How i can see the port numbers running applications on command prompt? Which asadmin command with?
The quick and dirty way is to use the following command (on UNIX/Linux):
asadmin get '*' | egrep -i '[._]port[=.][1-9v]' | sort
This gets you most all the port values that are being used in a domain.