I'm using SQS as the queue backend for my application. The containerized Laravel app is deployed via ECR.
To keep the queue running at all times, I have setup supervisor like so in the Dockerfile.
FROM php:7.4-apache
RUN apt-get update \
&& apt-get install -y \
git \
cron \
libpspell-dev \
aspell-en \
libfreetype6-dev \
libicu-dev \
libjpeg62-turbo-dev \
libpng-dev \
libmcrypt-dev \
libxslt1-dev \
python-pip \
redis-tools \
pkg-config \
gcc \
g++ \
unzip \
jq \
libcurl4-openssl-dev \
libssl-dev \
libonig-dev \
libjpeg-dev \
libzip-dev \
supervisor
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo mbstring
RUN docker-php-ext-install pdo_mysql
#RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
# && docker-php-ext-install -j$(nproc) gd
RUN docker-php-ext-install \
iconv \
mbstring \
pdo \
pspell \
pdo_mysql \
pcntl \
tokenizer \
xml \
zip \
bcmath
RUN docker-php-ext-configure gd --with-jpeg
RUN docker-php-ext-install gd
RUN pecl install mongodb -y
RUN pecl install mcrypt -y
RUN echo "extension=mongodb.so" >> /usr/local/etc/php/conf.d/mongodb.ini
RUN echo "extension=mcrypt.so" >> /usr/local/etc/php/conf.d/mcrypt.ini
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash
RUN apt-get install -y nodejs
RUN mkdir -p /var/www
WORKDIR /var/www
COPY ./ /var/www/
RUN mv .env.giftcenter.staging .env
RUN chmod -R 777 /var/www/storage/profile
COPY .docker/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY .docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN mkdir -p ./bootstrap/cache
RUN chown -R www-data:www-data /var/www \
&& a2enmod rewrite
RUN node --version
RUN npm install
RUN npm run build
RUN composer self-update 1.10.15 --no-interaction
RUN composer install --no-interaction
CMD ["/usr/bin/supervisord"]
RUN php artisan migrate --force
I have encountered a few challenges since this was first deployed right now I'm not sure if newly deployed changes are picked up. The job thrown on the queue uses mandrill to send emails. Whenever I hit the endpoint that sends an email I could wait for close to 30 minutes and still wont get any email. It's not even shown in mandrill dashboard. I know the request gets to SQS but it seems to be lost somewhere along the line and the email is never sent. Right now i dont know if it has something to do with how supervisor is setup to run? Note that there are also cron jobs that sends massive emails using the same mandrill account, could that be another contributing factor? What's the best practice for a situation like this? Its really my first time and I really want to stick with SQS and gradually move all other email sending functionalities unto SQS queues. I'm blocked by this. Note also that when the queues are run locally, i get the email immediately