Run asynchronous workers in the dev environment.

This better matches how Pony.fm is deployed in production and avoids issues
with the database being reconnected in the middle of a database transaction.
This commit is contained in:
Peter Deltchev 2016-07-09 17:59:03 -07:00 committed by Kelvin
parent 6b26256233
commit 6c4f7b962b
4 changed files with 27 additions and 11 deletions

View file

@ -11,7 +11,7 @@ DB_PASSWORD=secret
ELASTICSEARCH_HOSTS=localhost ELASTICSEARCH_HOSTS=localhost
SESSION_HTTPS_ONLY=false SESSION_HTTPS_ONLY=false
QUEUE_DRIVER=sync QUEUE_DRIVER=beanstalkd
MAIL_DRIVER=smtp MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io MAIL_HOST=mailtrap.io

View file

@ -8,8 +8,10 @@ DB_DATABASE=homestead
DB_USERNAME=homestead DB_USERNAME=homestead
DB_PASSWORD=secret DB_PASSWORD=secret
ELASTICSEARCH_HOSTS=localhost
SESSION_HTTPS_ONLY=false SESSION_HTTPS_ONLY=false
QUEUE_DRIVER=sync QUEUE_DRIVER=beanstalkd
MAIL_DRIVER=smtp MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io MAIL_HOST=mailtrap.io

View file

@ -1,14 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "Updating config files and restarting services..."
echo
mkdir -p /vagrant/storage/app/datastore mkdir -p /vagrant/storage/app/datastore
sudo cp /vagrant/vagrant/pony.fm.nginx.config /etc/nginx/nginx.conf sudo cp /vagrant/vagrant/pony.fm.nginx.config /etc/nginx/nginx.conf &
sudo cp /vagrant/vagrant/pony.fm.nginx.site.config /etc/nginx/sites-enabled/pony.fm sudo cp /vagrant/vagrant/pony.fm.nginx.site.config /etc/nginx/sites-enabled/pony.fm &
sudo cp /vagrant/vagrant/php-overrides.ini /etc/php/7.0/fpm/99-overrides.ini &
sudo cp /vagrant/vagrant/pony.fm.redis.config /etc/redis/redis.conf &
sudo cp /vagrant/vagrant/pony.fm.supervisor.config /etc/supervisor/conf.d/pony.fm.conf &
wait
sudo cp /vagrant/vagrant/php-overrides.ini /etc/php/7.0/fpm/99-overrides.ini sudo supervisorctl update &
sudo service elasticsearch restart &
sudo cp /vagrant/vagrant/pony.fm.redis.config /etc/redis/redis.conf sudo service nginx restart &
sudo service php7.0-fpm restart &
sudo service elasticsearch restart wait
sudo service nginx restart
sudo service php7.0-fpm restart

View file

@ -0,0 +1,9 @@
[program: ponyfm-worker]
process_name = %(program_name)s_%(process_num)02d
command = php /vagrant/artisan queue:listen --queue=default,notifications,indexing --sleep=3 --tries=3
autostart = true
autorestart = true
user = www-data
numprocs = 4
redirect_stderr = true
stdout_logfile = /vagrant/storage/logs/worker.log