mercredi 31 décembre 2014

Starting Latchet server with artisan cmd - works on vagrant, not on EC2

I'm using Latchet with Laravel (4.2). I've set up Latchet on my vagrant box and start it using an artisan command on deployment:



public function fire()
{
Log::info("Latchet server starting");
$command = "php artisan latchet:listen --env " . App::environment();
$process = new Process($command);
$process->start();
sleep(1);
if ($process->isRunning()) {
Log::info("Latchet Server is running.");
Log::info("Latchet pid: " . $process->getPid());
} else {
Log::info("Latchet Server is not running.");
Log::info($process->getOutput());
}
}


This works perfectly fine on my vagrant box, but not when I run it on the Amazon EC2 (Linux) instance by SSH-ing in. On EC2 it says the server is running and using port 1111 as it should, but when I check open ports 1111 is not there (and when I navigate to the site I can see that the websocket connection can't be made). When I actually run php artisan latchet:listen --env development while SSH-ed into the instance it works fine (but then I can't close the terminal of course). So it seems it's just the artisan command that is not working.


At first I thought maybe the environment name isn't getting set properly with App::environment(), so I hard coded the environment name into the above after also checking that it was being set correctly via php artisan env - same result.


Because it works on my local vagrant box I don't think this is a Latchet problem. Something must be different between the EC2 and vagrant setups - maybe a security issue? I'm out of ideas - does anyone know what might be going wrong/if there is any special property in EC2 that prevents this from continuing to run?


Thanks!





Aucun commentaire:

Enregistrer un commentaire