Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a Ruby project on localhost and web simultaneously?

I am presently developing a web service using Ruby on Rails. I wish to run it on LAN as well as web simultaneously? How can it be done?

like image 668
Ameya Joshi Avatar asked Jun 21 '26 01:06

Ameya Joshi


2 Answers

I am assuming

  • You want you want to demonstrate a product running on a local machine to a person on the internet.

OR

  • You are trying to test Paypal IPN notification.

1) Install the proxylocal gem

gem install proxylocal

2) Run your rails server in development mode.

3) Run proxy local

$ proxylocal 3000 --host joshi_server
Local server on port 3000 is now publicly available via:
http://joshi_server.t.proxylocal.com/

Now, you can access your local server using http://joshi_server.t.proxylocal.com/ anywhere from the web.

Note

Similar services

Free : ngrok, localtunnel, pagekite, yaler,

Paid : showoff.io

I found proxylocal, localtunnel, and showoff to be similar w.r.t ease of use and reliability. I prefer proxylocal as it allows me to name and reuse the subdomain for my local server.

Do not use this approach for a production setup

like image 79
Harish Shetty Avatar answered Jun 23 '26 04:06

Harish Shetty


Either allow the access to the server via LAN and Internet OR setup two servers that point to the same database. Rails starts multiple instances anyway, so you will not have corrupt data.

like image 21
ayckoster Avatar answered Jun 23 '26 03:06

ayckoster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!