Skip to content

Connect to Production Console

🚀 How to Connect to Mobayilo Production Console

Section titled “🚀 How to Connect to Mobayilo Production Console”

Follow these steps in order to bypass the Railway internal networking restrictions on your Mac.

Go to your Railway Dashboard.

  1. Select the Postgres service.
  2. Go to the Connect tab and copy the Public Connection String.

It should look like: postgresql://postgres:password@ballast.proxy.rlwy.net:47219/railway

Paste the string into the command below and run it in your terminal:

Terminal window
RAILS_ENV=production DATABASE_URL=PASTE_YOUR_PUBLIC_URL_HERE railway run bundle exec rails console

Step 3: Force the Connection (The “Magic” Line)

Section titled “Step 3: Force the Connection (The “Magic” Line)”

Once the prompt mobayilo(prod):001> appears, do not run any model commands yet. First, force the connection to use the public gateway:

ActiveRecord::Base.establish_connection("PASTE_YOUR_PUBLIC_URL_HERE")

Note: You should see a return value like #<ActiveRecord::ConnectionAdapters::ConnectionPool...> which means you are officially “in.”


Now that you are connected, here is how to handle your admin user:

# This finds the user if they exist, or starts a new one if they don't
admin = AdminUser.find_or_initialize_by(email: 'adusingi@mobayilo.com')
# Set/Reset the password
admin.password = 'Rushido%79q!'
admin.password_confirmation = 'Rushido%79q!'
# Save to the live database
admin.save!
# Count total admins
AdminUser.count
# List the last 5 users to join
User.order(created_at: :desc).limit(5)
# Check a specific account balance
Account.find_by(name: "Some Account").balance

Because you are outside of Railway’s physical data center, your computer is like a guest trying to use a private office intercom. By using the Public URL and establish_connection, you are essentially “calling into” the office via a public phone line instead, which Railway allows through their TCP Proxy.