How to use 2 localhost for single project - ruby-on-rails-5

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

Related

Is it possible to create a proxy in Remote-SSH Visual Studio Code?

I need to connect via REMOTE-SSH in Visual Studio Code to a machine with ssh but from a specific machine in which I have previously connected through ssh to.
I can connect to the first machine with no problem, the problem is when I am logged in the first machine and I try to connect to the second it doesn't let me. I have been looking but what I can only find is examples showing how to connect only to one machine without passing through an other one.
Thanks to a partner, I have found a solution and it consists in changing a little bit the config file from ssh
As I am using VS Code in Windows and I wanted not to use netcat I've implemented the next command to create a proxy:
Host <target-machine-name>
HostName <target-machine-ip>
User <user>
ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe -q -x <proxy-machine-name> -W %h:22
Hope it can help someone else with the same issue.
If you are using macOS and want to ssh to machine 1.1.1.1:2222 under socks proxy(127.0.0.1:1080), then you can use the below configuration:
Host 1.1.1.1
HostName 1.1.1.1
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
Port 2222
User YourName
If you are using http proxy or using Windows(Linux), go to check Connect with SSH through a proxy . Then replace the corresponding ProxyCommand.
Hope this could help you.

How to configure Ansible to use my local SSH configuration?

I'm testing out Ansible and am already stuck on a fairly simple thing. I configured my /etc/ansible/hosts to contain the IP of my server:
[web]
1.2.3.4
Now, connecting to it with ansible all -vvvv -m ping fails since my ~/.ssh/config for the specified server uses a custom port, a key file not in the default location, etc. How do I tell Ansible to reuse my SSH configuration for the connection?
It's a little esoteric, so it's understandable you missed it. This is from the Ansible Inventory page:
If you have hosts that run on non-standard SSH ports you can put the port number after the hostname with a colon. Ports listed in your SSH config file won’t be used with the paramiko connection but will be used with the openssh connection.
To make things explicit, it is suggested that you set them if things are not running on the default port
So, in your case:
[web]
1.2.3.4:9000
(Using 9000 as your alt port, of course)
Ansible uses paramiko on systems with a dated version of ssh, such as CentOS/RHEL.
What tedder42 said plus there are other slightly more advanced ways of defining your ssh config on a per host basis.
[web]
1.2.3.4 ansible_ssh_port=9000
This only makes sense if you're also using the other ansible_ssh special variables like ansible_ssh_user and ansible_ssh_host.
ansible_ssh_host is helpful if you want to be able to refer to a server by a name of your choosing instead of its IP.
[web]
apache ansible_ssh_host=1.2.3.4 ansible_ssh_port=9000
If you end up with multiple hosts with the same alternative ssh port you can makes use of Ansible's group variable function.
[web]
1.2.3.4
5.6.7.8
9.10.11.12
[web:vars]
ansible_ssh_port=9000
Now Ansible will use port 9000 on all three of the hosts In the web group.
Understanding how to organize your inventory data goes a long way to your success with Ansible.

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

How to identify Thin server processes?

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

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.