marklogic-community / roxy

Deployment tool for MarkLogic applications. Also provides optional unit test and XQuery MVC structure
Other
87 stars 66 forks source link

As part of Slush, Roxy bootstrap does not complete, "Port is currently in use" #540

Closed packetsdontlie closed 8 years ago

packetsdontlie commented 8 years ago

After installing Slush and working through the setup, I was instructed to run

./ml local bootstrap

I added the -v for outpu

Bootstrapping your project into MarkLogic 8 on localhost... [GET] http://localhost:8002/manage/LATEST/servers?format=xml [POST] http://localhost:8000/qconsole/endpoints/workspaces.xqy Closing HTTP connection to localhost:8002 [POST] http://localhost:8000/qconsole/endpoints/evaler.xqy?wsid=11931428803065687352&qid=15832873734706753026&action=eval&querytype=xquery&dirty=true&sid=12187438052101973203 [DELETE] http://localhost:8000/qconsole/endpoints/workspaces.xqy?wsid=11931428803065687352 code: 200 ADMIN-PORTINUSE: (err:FOER0000) Port is currently in use See MarkLogic Server error log for more details. ERROR: ADMIN-PORTINUSE: (err:FOER0000) Port is currently in use See MarkLogic Server error log for more details. ERROR: ... Bootstrap FAILED

I have made several changes to deploy/build.properties, but no changes I make there seem to have an effect on this error message.

Here's a link to my ML ErrorLog.txt snippet.

http://pastebin.com/W4esvsQ9

dmcassel commented 8 years ago

"Port is currently in use" means what it sounds like -- some other process is using the port that Roxy has been told to use. Check your app-port, xcc-port, and if you are setting up unit testing, test-port properties. One of them conflicts with something else. You can see what ports MarkLogic is using with the Admin UI (http://localhost:8001) -- note that MarkLogic may also be using ports 7998 and 7999. Some other process might be using your target port as well. For instance, if you have "app-port=80" and you have Apache HTTP Server running, you'll get a conflict.

packetsdontlie commented 8 years ago

Thank you. I have checked that several times. My appreciation for what Roxy is tasked to do is to create an XCC server and an application server given the ports provided in the deploy/build.properties.

My build.properties includes these two directives.

#
# The ports used by your application
#
app-port=8050
xcc-port=8051

Here's what a remote host sees on my machine.

PORT STATE SERVICE
22/tcp open ssh
88/tcp open kerberos-sec
3689/tcp open rendezvous
5900/tcp open vnc
7999/tcp open irdmi2
8000/tcp open http-alt
8001/tcp open vcom-tunnel
8002/tcp open teradataordbms
8333/tcp open unknown

Neither of these ports are currently in use that I understand. I have changed the configuration a few times to other ports that are not known to be in use, but I keep getting the same error.

Is my understanding wrong for the goal of Roxy? Should it not be creating these services or does it expect them to be created? Are there ranges that are not supported?

joemfb commented 8 years ago

Roxy supports environment-specific configuration files (local.properties, prod.properties, etc.). If you have such a file, it could be overriding the properties defined in build.properties.

One of the best things to check is ./ml local info, which will show the exact properties Roxy sees for the local environment. That should help, by either pinpointing or ruling-out a configuration problem.

packetsdontlie commented 8 years ago

Here's what I found by doing that.

plank:girlie b$ ./ml local info | grep port
ml.xcc-port: 8040
ml.qconsole-port: 8000
ml.evaler-port: 7998
ml.bootstrap-port-four: 8000
ml.bootstrap-port-five: 8002
ml.bootstrap-port: 8002
ml.app-port: 8040

I have no prod.properties configuration file that I can find in this directory, but I do have a local.properties.

grep port deploy/local.properties 
# The ports used by your application
app-port=8040
xcc-port=${app-port}
# There have been reported issues with dns resolution when localhost wasn't in the hosts file.

Now that I have surfaced the additional configurations, could you tell me what changes I should make?

Thanks

joemfb commented 8 years ago

As @dmcassel said, you can browse the MarkLogic Admin UI (on http://localhost:8001) to see which ports are currently in use by MarkLogic. Then, you can change app-port in local.properties to a free port.

packetsdontlie commented 8 years ago

Here's what I changed

plank:girlie b$ diff deploy/local.properties deploy/local.properties.bkp 
9c9
< app-port=8050
---
> app-port=8040
11,14c11,12
< # xcc-port=${app-port}
< # install-xcc=false
< xcc-port=8051
< install-xcc=true
---
> xcc-port=${app-port}
> install-xcc=false

Once I set local.properties to be the same as default.properties (8050 and 8051), I was able to run the bootstrap function.

plank:girlie b$ ./ml local bootstrap
Bootstrapping your project into MarkLogic 8 on localhost...
... Bootstrap Complete

I will say that I had co-worker run into this very same problem even though we have different configurations of Mark Logic, is it possible a script isn't updating one of these files during the install?

joemfb commented 8 years ago

The environment-specific properties file (ie, local.properties) overrides build.properties, which overrides default.properties. More info here: https://github.com/marklogic/roxy/wiki/Environment-properties.

BTW, you don't need to change xcc-port when install-xcc=false is set.

dmcassel commented 8 years ago

This

xcc-port=${app-port}

strikes me as never being a good idea. app-port and xcc-port are used in configuring two different MarkLogic application servers, each of which will use a port. With install-xcc=false, that shouldn't matter, assuming a recent enough version of Roxy that install-xcc is respected. Set xcc-port to something else, bootstrap, and see whether it creates an XCC server. If it did, then the version of Roxy being used isn't paying attention to install-xcc (possible, though I think that's on the master branch by now).

If you happen to like video tutorials, see the Roxy configuration video.

joemfb commented 8 years ago

I opened a new issue to discuss xcc-port=${app-port} further, since that ugly hack was my recommendation ... ;)

packetsdontlie commented 8 years ago

For clarity, I created a new slush project and this is the content of my files after going through the console wizard.

plank:deploy b$ grep "app-port\|xcc-port\|test-port" *.properties
build.properties:# Note: to activate Unit Testing, you must have test-content-db and test-port defined
build.properties:# test-port=8042
build.properties:app-port=8040
build.properties:xcc-port=8041
default.properties:# Note: to activate Unit Testing, you must have test-content-db and test-port defined
default.properties:# test-port=8042
default.properties:app-port=8040
default.properties:xcc-port=8041
local.properties:app-port=8040
local.properties:xcc-port=${app-port}
packetsdontlie commented 8 years ago

And when I proceed to the Roxy bootstrap

I get the port in use comment.

plank:haircut b$ ./ml local bootstrap
Bootstrapping your project into MarkLogic 8 on localhost...
Password for caramel user: 
ERROR: ADMIN-PORTINUSE: (err:FOER0000) Port is currently in use
See MarkLogic Server error log for more details.
ERROR: ... Bootstrap FAILED
joemfb commented 8 years ago

The slush-marklogic-node generator uses static configuration; it doesn't choose an open port when you generate a new app. If port 8040 isn't free when you generate a new app, you'll get that error every time.

I'll open an issue on the slush generator project to discuss this further.

packetsdontlie commented 8 years ago

Joe, there was nothing running on the port when I configured the new app. I think it's in the local.properties file.

joemfb commented 8 years ago

ADMIN-PORTINUSE is an error message from the MarkLogic Admin API; it would be a bug in the server for that error to be thrown when creating an app server on an open port. That's not impossible, but it seems highly unlike in this scenario.

Earlier, you listed open ports that could be seen from a remote host; but you could have additional open ports blocked by a firewall, or bound to the local loopback. You can check open ports locally with lsof -n -i4TCP:8040 on OS X, or netstat -pntl | grep 8040 on Linux. You'll need sudo to check processes that you don't own.

grtjn commented 8 years ago

The portinuse error typically occurs when you have xcc-port=${app-port}, but lack the necessary install-xcc=false to go with it. We only generate this for ML 8, and always together. But local.proporties is ignored in git, so you need to recreate manually if you take over code from someone else..