0

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?

4
  • 2
    If you're stuck with Amazon Linux, supervisord is probably your best bet. Of course, nobody should be using Amazon Linux... Jul 5, 2016 at 19:24
  • Which distro do you suggest? I'm more of a programmer than server expert. Jul 5, 2016 at 20:04
  • 1
    Ubuntu 16.04 is probably a better choice. You could of course use AWS SQS if it fits your use case.
    – Tim
    Jul 5, 2016 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. Jul 5, 2016 at 21:00

1 Answer 1

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.

7
  • 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. Jul 6, 2016 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. Jul 6, 2016 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. Jul 6, 2016 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. Jul 6, 2016 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! Jul 6, 2016 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .