somkiattha / opendatakit

Automatically exported from code.google.com/p/opendatakit
0 stars 0 forks source link

ODK Aggregate Fully Qualified Hostname #520

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. During ODK Aggregate installation I left fully qualified hostname to what is 
autopopulated as, which was "sohil-iptl5j0pm"
2. With this configuration, I can access ODK Aggregate from my computer on 
tomcat at http://sohil-iptl5j0pm:8080/ODKAggregate
3. However I do not know what to put for "server" when trying to connect to my 
tomcat server from an android ODK Collect app.  

What is the expected output? What do you see instead?
I think I need to change the fully qualified hostname, but this didn't work 
when I changed to a dynamic DNS.  When rerunning the ODK installer to change 
the hostname, do you have to change the username/password as well?

What version of the product are you using? On what operating system?
Aggregate 1.0.4 on XP

Please provide any additional information below.

Original issue reported on code.google.com by sohil.d....@gmail.com on 14 Feb 2012 at 4:05

GoogleCodeExporter commented 9 years ago

Original comment by wbrune...@gmail.com on 18 Feb 2012 at 6:49

GoogleCodeExporter commented 9 years ago
Any ideas?

Original comment by sohil.d....@gmail.com on 20 Feb 2012 at 2:09

GoogleCodeExporter commented 9 years ago
I can only access the server using localhost:8080/ODKAggregate but I can't 
access it if I put in my IP address as localhost.  

Original comment by sohil.d....@gmail.com on 20 Feb 2012 at 8:34

GoogleCodeExporter commented 9 years ago
If you were using the afraid.org dynamic DNS service, it had major problems 
last week.  I found that dynamicdns.com worked more reliably.

Look at the wiki 
http://code.google.com/p/opendatakit/wiki/AggregateTroubleshooting for help 
with this issue, as it could also be a firewall configuration issue (and that 
may also require the involvement of your network administrator).  

I recommend first getting the Tomcat 6 server (itself, alone) visible from a 
separate laptop within your organization, then getting it visible from a wifi 
access point outside your organization (e.g., Starbucks).  Then, install ODK 
Aggregate using the hostname you needed to access Tomcat from outside your 
organization.  Verify that you can log into that from anywhere, and finally, 
advance to getting your phone to connect to ODK Aggregate.

During the installer, the auto-population of your hostname was incomplete. It 
should be something like: 

sohil-iptl5j0pm.yourorganization.org

Your network administrator would be able to help set this up, if you have one.  
If you don't, then you will need to use a dynamic DNS service or, if you have a 
static IP address issued by your internet service provider (and most people 
don't), you can use the static IP address directly. Note that this is different 
from a static IP address assigned by your router -- those are generally only 
visible within your network, so a cell phone in the field will generally not be 
able to access ODK Aggregate through that IP address.  A static IP address 
issued by your internet service provider will be visible in the field, and that 
is what you would need.  Dynamic DNS services give equivalent visibility and 
are the good free alternative to static IP addresses (you do need to verify 
that your IP address doesn't change -- mine, for example, changes every time I 
boot up, so I have to remember to update my laptop's IP address after every 
boot-up on dynamicdns.com).

You can re-use the same database name, username and password -- if you do, you 
only need to run the create_db_and_user.sql script one time.  Setting up the 
hostname is independent of setting up the database.

Original comment by mitchellsundt@gmail.com on 21 Feb 2012 at 6:31

GoogleCodeExporter commented 9 years ago
Wow this sounds incredibly helpful, thanks so much.  I'll try it out and post 
any more updates/questions I have!

Original comment by sohil.d....@gmail.com on 21 Feb 2012 at 6:43

GoogleCodeExporter commented 9 years ago
I don't really have any experience with Tomcat; could you explain how to get 
the tomcat server itself visible from a separate laptop/wifi access point?  I 
can go to http://localhost:8080/ and see the tomcat admin page, but not sure 
how to get to this page from another computer or network...

Original comment by sohil.d....@gmail.com on 21 Feb 2012 at 7:09

GoogleCodeExporter commented 9 years ago
First, be sure that your firewall allows access (see the wiki link)

If you've set up dynamic DNS, (e.g., if your host is msundt.dynamicdns.com), 
you should be able to open a browser on the other machine to:

http://msundt.dynamicdns.com:8080/

and see the same admin screen.  Once that works, you can advance to installing 
ODK Aggregate.

Here's a brief how-to for dynamic DNS (though somewhat specific to dyndns.com) 
http://howto.wired.com/wiki/Set_Up_Dynamic_DNS

Original comment by mitchellsundt@gmail.com on 21 Feb 2012 at 7:19

GoogleCodeExporter commented 9 years ago
Also, depending upon the way you are connected through your internet service 
provider (ISP), you may need to set up "Port Forwarding" on your modem/router 
devices.  You need to forward the port you're using (e.g., 8080) to the 
computer that is hosting the Tomcat server.

This is a configuration option on your broadband modem (the box the ISP 
provided you -- talk to their technical support) and may also be something you 
need to configure on your router if you have one (i.e., your wifi router or the 
box connected to the ISP's broadband modem that has all your ethernet cables 
connected to it).

Original comment by mitchellsundt@gmail.com on 21 Feb 2012 at 10:18

GoogleCodeExporter commented 9 years ago
Ok so after several tries I finally got dynamic DNS set up.  I can now access 
the Tomcat admin screen from another computer on my network once I disable my 
firewall.  However, I don't seem to be able to access from another external 
network.  Was the port forwarding advice potentially necessary to access from 
an outside network?

Original comment by sohil.d....@gmail.com on 22 Feb 2012 at 8:32

GoogleCodeExporter commented 9 years ago
Yes, it is likely that you'll need to set up port forwarding.

If you have this set-up:

(1) broadband modem from ISP with NAT enabled
   |
   v
(2) wifi/ethernet router with NAT enabled
   |
   V
(3) your computer

Then you'll need to:
Set up port forwarding on (1) to send ports 80 and 443 to (2).
Set up port forwarding on (2) to send ports 80 and 443 to (3).

When you set up port forwarding, you may first need to change (2) and (3) to 
have static IP addresses (to prevent the assigned IP addresses of those from 
changing).  Some port forwarding configurations allow you to forward to a MAC 
address, in which case you can leave everything as dynamic and just specify the 
corresponding MAC addresses.

Original comment by mitchellsundt@gmail.com on 22 Feb 2012 at 9:53

GoogleCodeExporter commented 9 years ago
Thanks again for all this help, but I think I'm a bit confused with some of the 
terminology.  Before I try port forwarding, I want to ensure I've used the 
right IPs, as I may have mixed up internal and external IPs (internal = my 
computer's IP and external = router's IP).  I can access Tomcat on all my 
laptops by going to 192.168.1.121:8080.  But as you said earlier, this is my 
internal IP assigned by my router and this IP would never be visible outside 
the network, yet I've been assigning this internal IP for dynamic DNS so that's 
what I've been trying to enter to access tomcat from a Starbucks.  To gain 
access to my Tomcat from an external network like Starbucks I would  need to 
use the public IP of the router, right?

When I used a dynamic DNS service I initially input my external IP, but I 
couldn't access Tomcat from another laptop doing this.  When I put my internal 
IP for dynDNS I could access Tomcat from another laptop.  But I realized my IP 
isn't really changing so even after deleting the dynDNS accounts I can still 
access Tomcat from my other computers by just typing in 192.168.1.121:8080.

I'm having trouble understanding how I'd access Tomcat from the outside: would 
I have to enter my public IP with 8080 and then port forwarding would specify 
the specific laptop (internal IP) and port on the network to send the 
information to? If this is true, does that mean I access Tomcat from inside my 
network using my internal IP or "localhost:8080" and from outside my network 
using the external IP?

I can port forward easily from my router to computer, but I would probably have 
to call my ISP to set up modem port forwarding if this is necessary.  There 
aren't many discussions online of port forwarding from a modem; itseems very 
uncommon.  First I need to figure out if I've been entering the wrong IP (or 
domain name if I associate a dynamic domain name with that IP) when trying to 
access from the outside, meaning maybe I should've been entering the public IP 
even though that's not what I enter to access Tomcat from within my network.  
Thanks again for all the help, sorry for the inconvenience!

Original comment by sohil.d....@gmail.com on 24 Feb 2012 at 11:59

GoogleCodeExporter commented 9 years ago
Sorry, yes, this is very confusing.

You should go to a site that shows your external IP, e.g., 

http://myip.dnsdynamic.org/

This is the IP address you need to enter into the dynamicDNS service.  It is 
likely the IP address assigned to the ISP modem.  If it isn't assigned to the 
modem, you would need to upgrade to a static IP address.

Your last 2 paragraphs are an accurate description of what then needs to happen.

I think most cable modems require customer support assistance for setting up 
port forwarding; you may need to upgrade to a static IP address in order for 
them to do that for you (unfortunately).

For WiMax modems, you can search on the model number of the modem and find the 
user manual.  To set up port forwarding, you would typically enter a URL like 
these from one of the computers connected underneath the modem:

http://192.168.0.1 (linksys)
http://192.168.15.1 (motorola wiMax) 

ordinary routers usually use:
http://192.168.1.1

(and they assign IP addresses in the range 192.168.1.2 ... 192.168.1.239 to the 
computers underneath them).

---------

Dynamic DNS services just provide a look-up from a name to an IP address; 
nothing more. So it is not surprising that you can establish a mapping to 
192.168.1.121 and have all the computers connected to your router access your 
server. As long as this address is interpreted in the context of your router, 
everything works.  The moment you move to a different network, such as at a 
Starbucks, this IP address likely points to some laptop on that same wifi 
access point (IP addresses of the form 192.168.x.x are used by NAT-enabled 
routers to identify the computers beneath them).

Original comment by mitchellsundt@gmail.com on 25 Feb 2012 at 12:53

GoogleCodeExporter commented 9 years ago
So setting up port forwarding from just the router to my laptop, and then going 
to the external IP:8080 from outside network doesn't work.  You had told me to 
forward ports 80 and 443, but I also forwarded 8080, not sure if that would 
make a difference.  

So hopefully also setting up forwarding from modem to router will make the 
difference.  Though all the message boards online seem to say that there is no 
port forwarding in a cable modem.  I called me ISP who basically said what you 
told me, and that there is likely a port forwarding option if I sign up for 
business account.  Will follow up with the business team to see if they have 
any insight into this.

I've been seeing port checking tools like this as well, not sure if they would 
help me, because it always says that any port I put in is closed after I 
forwarded ports and before.
http://www.yougetsignal.com/tools/open-ports/  

Original comment by sohil.d....@gmail.com on 25 Feb 2012 at 4:51

GoogleCodeExporter commented 9 years ago
Ah, so apparently port forwarding isn't possible from a modem to router, at 
least for my Motorola SB5101 modem.  I called Motorola and they said there is 
no way to configure  it since its a modem, and that all configuration needs to 
be done on the router.  I'm all out of ideas!

Original comment by sohil.d....@gmail.com on 27 Feb 2012 at 4:36

GoogleCodeExporter commented 9 years ago
Wow, I just figured it out.  Apparently the house I'm in has vonage.  So I 
needed to port forward from the vonage router to the linksys router!  Hopefully 
now I can set up ODK!

Original comment by sohil.d....@gmail.com on 27 Feb 2012 at 5:58

GoogleCodeExporter commented 9 years ago
OK. The cable modem won't have an IP address, so the questions are now:
(1) what is the IP address that the cable operator has assigned to your router, 
and
(2) is that a public IP address.

Log onto your router. It should have an information screen e.g., "Router 
Status" or some such. Attached is what this screen looks like on a Netgear N750 
(just as an example).  Note that it shows the "Internet Port" and the "LAN 
Port".  The LAN Port would typically be 192.168.x.1  We're interested in the 
value of the Internet Port. The IP Address of that is the IP address that your 
ISP has given to your router.

(in this example, 10.1.10.150).

Now, go to a site like http://myip.dnsdynamic.org/ and see if that IP address 
matches the one you found above.

If it does match, you should be able to set up dynamic DNS with that "Internet 
Port" IP address and use port forwarding on your router to your system, and be 
able to access your system from, e.g., Starbucks.  Once set up, you would need 
to check periodically to ensure that the ISP has not changed this IP address, 
and update the Dynamic DNS provider's settings accordingly.

If the two IP addresses do not match, you need to upgrade your plan with the 
ISP to give your router a "Static IP Address" and follow the directions on the 
router to make that IP address the value for "Internet Port". You can then set 
up port forwarding from the router to your system, and will be able to access 
your system from e.g., Starbucks.

Otherwise, you would only be able to submit data from your home network, as 
your system will not be visible from the internet (it can reach the internet, 
but nothing on the internet can reach it).

Original comment by mitchellsundt@gmail.com on 27 Feb 2012 at 6:05

Attachments:

GoogleCodeExporter commented 9 years ago
Yes you're exactly right, that's what tipped me off.  I went to router status 
and noticed my router's IP wasn't matching the "public IP" and figured out it 
was because it was assigned the Vonage router.  The vonage router's IP matches 
the public IP.

Original comment by sohil.d....@gmail.com on 27 Feb 2012 at 6:26

GoogleCodeExporter commented 9 years ago
Thanks again for all the help.  A couple of question regarding the ODK 
Aggregate setup.  I had already installed ODK Aggregate and need to go through 
the installer again I assume in order to change the fully qualified hostname: 
should I change it to the dynamicDNS address I can now use to access tomcat 
(e.g. test.dynamic.com) or do I also need to include my local hostname which 
ODK autogenerates for the hostname before the address (e.g. 
sohil-iptl5j0pm.test.dynamic.com).  I just want to make sure I enter the 
correct hostname this time before potentially changing ODK settings again!

I have to go through all the steps once again, including coming up with a 
database username/pword, database name, ODK Aggregate instance name etc.  My 
other question is : can I use the same usernames/pwords for all these steps 
that I used when first setting up ODK Aggregate?  

I think you had said I don't need to redo the create_db_user script again.

Original comment by sohil.d....@gmail.com on 29 Feb 2012 at 1:53

GoogleCodeExporter commented 9 years ago
Just use the dynamicDNS address alone, without the generated hostname.

Yes, you can answer all the other questions the same; if you do, you won't need 
to run the database script (create_db_and_user.sql) again.

Original comment by mitchellsundt@gmail.com on 29 Feb 2012 at 5:24

GoogleCodeExporter commented 9 years ago
So that didn't seem to work, I think I may be missing a step!  I specified the 
dynamicDNS as the hostname in ODK Aggregate setup, yet after rerunning the 
installer when I go to xxxx.chickenkiller.com:8080/ODKAggregate it looks like 
it is loading the ODK login page but then the address bar changes to 
sohil-iptl5j0pm-8080/ODKAggregate/Aggregate.html and browser cannot find the 
server now.  So for some reason it is changing back to that old local hostname 
and trying to connect to the local host rather than the dynamicDNS address.

When I re-ran the ODK Installer it first asks to select the parent directory 
where ODK Agg directory will be created.  I already had the initial ODK Agg 
directory in program files so I just chose a different parent directory for 
this reinstall(would this cause a problem?).  Maybe I need to delete the old 
ODK folder?

Once finishing the configuration I ignored the "remaining configuration steps" 
that involve creating db and user as you had said.  In addition to rerunning 
the installer do I need to "redeploy" and if so does that mean copying that 
.war file somewhere, or was this just for creating db and user.  

Original comment by sohil.d....@gmail.com on 2 Mar 2012 at 3:37

GoogleCodeExporter commented 9 years ago
So I tried copying the WAR file from the new ODK Aggregate folder in the new 
directory to the Apache webapps folder and now it seems to be working!

Original comment by sohil.d....@gmail.com on 2 Mar 2012 at 3:54

GoogleCodeExporter commented 9 years ago
Glad you got this working. I created a help page here 

http://opendatakit.org/use/aggregate/tomcat-install/

that details much of what you needed to do, so hopefully others can gain from 
your pain.

Closing this issue.

Original comment by mitchellsundt@gmail.com on 6 Mar 2012 at 9:27