16

I'd like to use juju on my server at home to get to know juju and play with it. I have multiple computers and would like to access what's on the server from any of them. When I went through the tutorial it setup juju okay, but only exposed the services to the local machine. I want to expose them to the whole network. How can I do this?

Note: my server already exists and is running 12.04, I don't want to reinstall it using maas just to get juju working. I also don't want to run this "in the cloud" on ec2 or any other provider because I want to try this out on my own machine under my control on my network.

Edit:-

  • No firewall
  • No blocking, all ports open
  • Yes. All computers on the LAN (192.168.1.0/24) can see the server (homeserver.local) on 192.168.1.2
  • Pretty standard wired and wifi with one DHCP server dishing out IP addresses in the above range
  • Setup correctly (just started again from scratch) and followed tutorial Luis directed me to, here's the results:- http://paste.ubuntu.com/5714640/
  • juju status showed above.

So, all running okay, but the main issue is that the containers have IP addresses locally assigned on the server, which are only accessible on the server itself. While I could go around setting up ssh port forwarding all over the place to access the 10.x IP addresses from the 192.168.1.0/24 range, this seems overcomplicated and unnecessary. I'd like the containers exposed over my LAN.

2
  • the pastebin link points to a C++ program...
    – rigved
    Jun 25, 2013 at 14:08
  • 1
    Well that's odd!
    – popey
    Jun 26, 2013 at 7:40

2 Answers 2

11

Ok, solved!

Setup bridged network br0 in /etc/network/interfaces.

auto eth1
iface eth1 inet manual

auto br0
iface br0 inet static
bridge_ports eth1
address 192.168.1.2
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
bridge_stp off
bridge_fd 0
bridge_maxwait 0

Edit /etc/lxc/lxc.conf and set lxc.network.link=br0

lxc.network.type=veth
lxc.network.link=br0
lxc.network.flags=up

Edit /etc/default/lxc and set LXC_BRIDGE, LXC_ADDR, LXC_NETMASK, LXC_NETWORK, LXC_DHCP_RANGE & LXC_DHCP_MAX appropriately for my LAN (192.168.1.0/24 type settings) now juju status shows 192.168.1.0/24 addresses for my units and I can access them over the LAN from another machine

LXC_BRIDGE="br0"
LXC_ADDR="192.168.1.2"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="192.168.1.0/24"
LXC_DHCP_RANGE="192.168.1.50,192.168.1.99"
LXC_DHCP_MAX="49"
1
  • You'll also need to change the "network-bridge" setting of the local provider in your environments.yaml, otherwise juju will keep trying to use the default "lxcbr0".
    – dimitern
    Jan 30, 2014 at 17:42
5

For what I am able to understand, you have Juju installed and working but you want to expose a service to other computers on your network. I will assume all the computers on your network can see each other and have their IP addresses correct.

I am also guessing the tutorial you are talking about is one of this:

then I would imagine that if you want to make the service available for other computers you would do this:

juju expose SERVICE

Using How to install Hadoop? as the example I would:

juju expose hadoop-master

Juju Expose - https://jujucharms.com/docs/stable/charms-exposing

juju status SERVICE also helps in figuring out how the service is working.

Of course there are a couple of things I would need to know about the network and the server, for instance:

  • Does the server have a firewall setup (iptables, ufw...)
  • Does the network have a router configured to do something related to blocking, forwarding and such that would create a problem trying to access the server?
  • Do the computers on the LAN see the server?
  • Is there any special connection that is not common (Wireless or Wired) or security in used that could create a problem with the clients and server?
  • Are all the steps to setup Juju correctly done (As provided by the tutorials mentioned, specially the part about environments.yaml which I tend to forget or get wrong).
  • Does juju status give you some insight of what the problem could be?
  • Do you have multiple environments set up in the environments.yaml file?

In case the service is not shown to the outside because of LXC, do the following (Provided by the answer popey gave and a lot of research):

  • Setup bridged network br0 in /etc/network/interfaces

  • Edit /etc/lxc/lxc.conf and set lxc.network.link=br0

  • Edit /etc/default/lxc and set LXC_BRIDGE, LXC_ADDR, LXC_NETMASK, LXC_NETWORK, LXC_DHCP_RANGE & LXC_DHCP_MAX appropriately to the LAN (192.168.1.0/24 type settings)

    Now juju status should show 192.168.1.0/24 addresses for my units and can be access over the LAN from another machine.

1
  • 1
    However, if I ssh to the server and run "lynx 10.0.3.234" I get the wordpress page. So the lxc container is up and running, and wordpress is all successfully installed and available on port 80 on 10.0.3.234, but that's only visible internally on the server. My thinking is that juju local deployment is tailored to developers carrying round this stuff on their laptop, not to a separate machine.
    – popey
    Apr 17, 2013 at 0:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .