Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jeff-r/265b4e99a86c668dd2ff4ce22bc42dc4 to your computer and use it in GitHub Desktop.
Save jeff-r/265b4e99a86c668dd2ff4ce22bc42dc4 to your computer and use it in GitHub Desktop.
I'm on my laptop. git.curlydogsystems.com is an ubuntu box with lxd containers running.
In one of the containers, currently at 10.59.108.168, I'm running a Rails app.
10.59.108.168 is only visible from git.curlydogsystems.com; I can't see it from my laptop.
The Rails app runs on the default port 3000 in the container. I want it at 3030 on my laptop.
ssh -L 3030:10.59.108.168:3000 -N git.curlydogsystems.com
The other way to do this is to have nginx on git.curlydogsystes.com proxy the http requests to
the container. This works. But I'm getting odd errors. When I go to Ohana's /admin/whatever routes,
the Rails app can't recognize the request routes. Something about the proxying is confusing it.
Running through the ssh proxy fixes the problem.
I can also ssh directly into it from my laptop by adding this to my laptop's .ssh/config:
Host ohanadev
user ubuntu
HostName 10.59.108.168
ProxyCommand ssh git.curlydogsystems.com -W %h:%p
I added my public key from my laptop to the container's ubuntu user's .ssh/authorized_keys
Update: also, make sure that the Rails app is listening on more than localhost. Jeez.
rails s -b 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment