CoderLee
CoderLee

Reputation: 3479

How to open socket for Hypnotoad

Trying to give mojolicious apps a try but having difficulty running them from the server with hypnotoad.

[user@server public_html]$ hypnotoad -t app/script/app 
Everything looks good!
[user@server public_html]$ hypnotoad app/script/app 
Can't create listen socket: Address already in use at /usr/local/share/perl5/Mojo/IOLoop.pm line 126.

It would appear that everything is in place to be able to start app in hypnotoad but this doesn't work. How would one go about closing whatever is stopping mojolicous from listening on the socket? Or is there a better way to solve this?

Upvotes: 3

Views: 1151

Answers (2)

Stuart Cardall
Stuart Cardall

Reputation: 2447

To start hypnotoad on a different port to the default 8080 I use:

#myapp

use Mojolicious::Lite;

# mojo will look for a *.conf with the same name 
# as the application
app->plugin('Config');
app->start;

with a config file:

# myapp.conf
{
  hypnotoad => {
    listen  => ['http://*:3000'],
    workers => 4
  }
};

See the Perldoc for the various config options.

Upvotes: 3

mpapec
mpapec

Reputation: 50637

With netstat you can find PID of process holding 8080 port, and send SIGTERM to stop it,

netstat -lntp | perl -nE '/:8080/ or next; say and kill(15, $_) for m|(\d+)/|'

Upvotes: 4

Related Questions