Debugging FIP - tooltwist/documentation GitHub Wiki
FIP can be difficult to debug on remote servers that might be blocking ports, but here are a few tips.
First, take note of the error on the machine you are to deploying from. A 500 error indicates that the remote FIP server was contacted, but had a problem with the request.
Other error are usually connection related.
The FIP log file on the remote machine should explain the problem. Depending upon how fip is being run, it might be logs/fipserver.log
, serverkit/fip/fipserver.log
or serverkit/fip/nohup.out
.
In most cases the problem will involve an incorrect FIP configuration.
-
the
serverHome
directory - the directory you are trying to deploy to is considered invalid if it does not contain a .fip-destination file. -
The .fip-source in the directory you are deploying from, and the .fip-destination file must have corresponding entries. The best way to set these up is using
tooltwist init deploy
. If you aren't using the ToolTwist command line to do the deployment you'll need to set these up by hand. The fip directory on the server or in serverkit explains how to set up these files.
Please note: DO NOT cut and paste the contents of .fip-source or .fip-destination from other machines. These files uniquely identify each machine, and using the same settings on multiple machines makes a hacker's life easy.
-
Check that a process named fipserver is running on the remote server. If the server was recently set up then the
psj
command should show it, along with Tomcat and any other Java processes. If not then useps -ef | grep java | sed G
. (The sed G improves readability by putting a blank line between the entries). -
Check the port that fipserver is running on, from the previous output. Make sure it matches your deployment configuration.
-
Send a status request to fipserver. Use a command similar to this, but with the port number and deployment directory changed if necessary.
curl -v 127.0.0.1:39393/status?root=/home/tooltwist/server
If all is well you will see an HTTP status code of 200 OK:
* About to connect() to 127.0.0.1 port 39393 (#0)
* Trying 127.0.0.1...
...
< HTTP/1.1 200 OK
...
An incorrect deployment directory will return a 404 Not Found error:
$ curl -v 127.0.0.1:39393/status?root=/Users/slot1/WRONG_PATH
* About to connect() to 127.0.0.1 port 39393 (#0)
* Trying 127.0.0.1...
...
>
< HTTP/1.1 404 Not Found
...
If the port is wrong the error should be like this:
$ curl 127.0.0.1:99999/status?root=/Users/slot1/servers
* About to connect() to 127.0.0.1 port 39398 (#0)
* Trying 127.0.0.1...
...
curl: (7) Failed connect to 127.0.0.1:39398; Connection refused
If the curl command from the previous section works when run on the remote server, but the matching command on your deploying machine fails, then something is blocking the port:
$ curl -v myNewServer.com:39398/status?root=/Users/slot1/server
...
curl: (7) Failed connect to 127.0.0.1:39398; Connection refused
There are several places this may occur, and it's not always easy to determine where.
- The remote server may have Firewall setting blocking access to the port from the outside.
- Amazon AWS provides security settings to control access to ports.
- Digital Ocean sometimes blocks ports as a security measure. This can happen at any time and they won't tell you they are doing it.
- Corporate firewalls commonly block ports.
Try to resolve the problem if possible, but if all else fails you can try SSH port forwarding.
This procedure should (untested as of September 2014) tunnel FIP commands from your deploying machine through to the FIP server process on the remote server. Communication between the machines will all be via the port used by the ssh
command.
First make sure that fipserver is not running on the remote server.
On a terminal session on the deploying machine, start the port forwarding:
$ ssh -L 9001:localhost:39393 tooltwist@<hostname> '(cd fip; ./fipserver -v 39393)'
This will open a port 9001 on the local machine that you can communicate with, as if you were connecting to port 39393 on the remote server. In tooltwist.js, set your host to localhost
and fipPort to 9001
, and then try deploying again.
If you still have problems, the -v
, -vv
, and -vvv
options to ssh
provide progressively more debug information.
--