¿Cómo encuentro en qué puerto se está ejecutando mi servidor Rails y cómo lo cambio?

Soy nuevo en la codificación y trabajo en un proyecto de equipo en el que acabo de configurar rspec desde un repositorio de Github y parece que no puedo configurar mi servidor. Ejecuté db migrate y db drop para ver si había algún error allí, como se ve a continuación. El comando de Rails está iniciando el servidor pero no puede conectarse en localhost: 3000

rails db:drop
/Users/matthewkennedy/Documents/coderacademy/jfj/jfjapprepository/config/environments/development.rb:4:in `block in <main>': uninitialized constant Rails::Server
Did you mean?  TCPServer (NameError)
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `instance_eval'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/railtie.rb:234:in `configure'
    from /Users/matthewkennedy/Documents/coderacademy/jfj/jfjapprepository/config/environments/development.rb:3:in `<main>'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/zeitwerk-2.5.3/lib/zeitwerk/kernel.rb:35:in `require'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:571:in `block (2 levels) in <class:Engine>'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `each'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/engine.rb:570:in `block in <class:Engine>'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `instance_exec'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in `run'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:228:in `block in tsort_each'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `each'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in `tsort_each_child'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `call'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `call'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:347:in `each_strongly_connected_component'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:226:in `tsort_each'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/tsort.rb:205:in `tsort_each'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in `run_initializers'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/railties-6.1.4.1/lib/rails/application.rb:391:in `initialize!'
    from /Users/matthewkennedy/Documents/coderacademy/jfj/jfjapprepository/config/environment.rb:5:in `<main>'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/gems/3.0.0/gems/zeitwerk-2.5.3/lib/zeitwerk/kernel.rb:35:in `require'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:108:in `preload'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:162:in `serve'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:144:in `block in run'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:138:in `loop'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:138:in `run'
    from /Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
    from <internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from <internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
    from -e:1:in `<main>'

Rails db migre a continuación

rails db:migrate
Running via Spring preloader in process 70800
rake aborted!
ActiveRecord::ConnectionNotEstablished: connection to server at "localhost" (::1), port 5433 failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5433 failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:83:in `rescue in new_client'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:283:in `connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `each'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `block in load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:27:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:27:in `fork'
<internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
-e:1:in `<main>'

Caused by:
PG::ConnectionBad: connection to server at "localhost" (::1), port 5433 failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (127.0.0.1), port 5433 failed: Connection refused
    Is the server running on that host and accepting TCP/IP connections?
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `initialize'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `new'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/pg-1.2.3/lib/pg.rb:58:in `connect'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:78:in `new_client'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `public_send'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:882:in `new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:926:in `checkout_new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:905:in `try_to_checkout_new_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:866:in `acquire_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:588:in `checkout'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:428:in `connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:1128:in `retrieve_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:327:in `retrieve_connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/connection_handling.rb:283:in `connection'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `each'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `block in load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/dependencies.rb:326:in `load'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/command_wrapper.rb:40:in `call'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:217:in `block in serve'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:10:in `block in fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:27:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:8:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/activesupport-6.1.4.1/lib/active_support/fork_tracker.rb:27:in `fork'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:181:in `serve'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:144:in `block in run'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:138:in `loop'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application.rb:138:in `run'
/Users/matthewkennedy/.rvm/gems/ruby-3.0.0/gems/spring-3.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
<internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
<internal:/Users/matthewkennedy/.rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
-e:1:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Si alguien pudiera ayudarme o darme algunos consejos, lo agradecería mucho. Estoy aprendiendo, así que realmente agradecería la ayuda en términos sencillos si es posible. Significará el mundo.

Answer

Puede encontrar el ID de proceso con este

#=> ps aux | grep rails
#=> username 27436   0.0  0.0 408497296   1424 s002  R+    6:01pm   0:00.00 grep .... rails

Luego use para procesar ID (ID al lado del nombre de usuario) para encontrar el puerto en el que se está ejecutando

#=> ps -p 25785 -o comm=
#=> puma 5.5.2 (tcp://localhost:3000) [MyRailsApp]