I'm trying to make sure my queue system does not fail when the server gets rebooted. The PHP processed queue system is started up via a command line command. The Laravel documentation suggests installing a process monitor called supervisord, which has not been playing nice on my EC2 so I am wondering if there is another way to make sure a my command gets run in the event of a reboot. AWS AMI linux comes with an old version of Upstart, and chkconfig, however I have not been able to get that working either. Any suggestions? Do I need to create an Init Script and RPM or is that overkill here?
Asked
Active
Viewed 120 times
0
-
2If you're stuck with Amazon Linux, supervisord is probably your best bet. Of course, nobody should be using Amazon Linux... – Michael Hampton Jul 05 '16 at 19:24
-
Which distro do you suggest? I'm more of a programmer than server expert. – zeros-and-ones Jul 05 '16 at 20:04
-
1Ubuntu 16.04 is probably a better choice. You could of course use AWS SQS if it fits your use case. – Tim Jul 05 '16 at 20:55
-
SQS is just a data store, we will still need to make sure our PHP process is running when the server reboots. – zeros-and-ones Jul 05 '16 at 21:00
1 Answers
1
My recommendation would be the same as the Laravel - i.e. to use something like supervisord to effectively "daemonise" your PHP code - I have taken this approach before with a standalone PHP Symfony2 application that consumed messages placed on SQS.
Also from experience, I would consider moving away from Amazon Linux and either using CentOS (if you need something RedHat-like) or Ubuntu, I'll leave the choice up to you. As much as Amazon tries to convince you otherwise, there are actually very few real-world use-cases where using Amazon Linux is preferable.

Craig Watson
- 9,575
- 3
- 32
- 47
-
Hi Craig, thanks for the advice. I am leaning towards Ubuntu 14.04 which is offered by AWS. Not sure when I would need RedHat, any info on that is appreciated. – zeros-and-ones Jul 06 '16 at 17:34
-
@zeros-and-ones there are AMIs for most versions of Ubuntu, and they are offered by Canonical, not Amazon. To be honest, if you're unsure which OS is right for you, I would seriously urge you to consult (or employ) a sysadmin who is capable of making these decisions for you. – Craig Watson Jul 06 '16 at 17:39
-
I am a programmer who has to also take on sysadmin role since the company I work for does not have a need for a full time sysadmin. Does a linux distro really make much difference regarding serving up PHP? So far I have noticed that AMI's yum repo is missing a lot of packages that are offered on Ubuntu but other than that I can't see what the big difference is. – zeros-and-ones Jul 06 '16 at 17:51
-
Ultimately Ubuntu/CentOS is a personal choice - I have used both in production scenarios, and it's true that there's little to choose between them and each have their own evangelical fans. Ubuntu should work for you and (generally) has better support for later versions of PHP (e.g. Ubuntu 16.04 ships with PHP7). CentOS does this via its own mechanisms, so it's really down to you as the professional making the decision. If you're supporting the server, you're going to need to be comfortable with whichever OS you choose. – Craig Watson Jul 06 '16 at 17:52
-
Ok thanks for clarifying, I agree each distro seems to have die hard fans for whatever reason. I'm going to look into getting Ubuntu 16 AMI, currently it is not offered in the Quick Start EC2 Launch menu. Arg! – zeros-and-ones Jul 06 '16 at 18:03
-
You can locate the AMI ID for your version and region using this page: https://cloud-images.ubuntu.com/locator/ec2/ – Craig Watson Jul 06 '16 at 18:04
-
That was exactly what I needed, I'm going to check this off. Not sure if it will help many but I'm sure there is someone out there with same issue. thanks. – zeros-and-ones Jul 06 '16 at 18:36