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.
Step 1: Copy the Public Connection String
Section titled “Step 1: Copy the Public Connection String”Go to your Railway Dashboard.
- Select the Postgres service.
- Go to the Connect tab and copy the Public Connection String.
It should look like: postgresql://postgres:password@ballast.proxy.rlwy.net:47219/railway
Step 2: Open the Console
Section titled “Step 2: Open the Console”Paste the string into the command below and run it in your terminal:
RAILS_ENV=production DATABASE_URL=PASTE_YOUR_PUBLIC_URL_HERE railway run bundle exec rails consoleStep 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.”
🛠️ Common Administrative Tasks
Section titled “🛠️ Common Administrative Tasks”Now that you are connected, here is how to handle your admin user:
Create or Update Admin
Section titled “Create or Update Admin”# This finds the user if they exist, or starts a new one if they don'tadmin = AdminUser.find_or_initialize_by(email: 'adusingi@mobayilo.com')
# Set/Reset the passwordadmin.password = 'Rushido%79q!'admin.password_confirmation = 'Rushido%79q!'
# Save to the live databaseadmin.save!Verify Tables & Data
Section titled “Verify Tables & Data”# Count total adminsAdminUser.count
# List the last 5 users to joinUser.order(created_at: :desc).limit(5)
# Check a specific account balanceAccount.find_by(name: "Some Account").balanceWhy we do it this way
Section titled “Why we do it this way”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.