Skip to content

Instantly share code, notes, and snippets.

@andersao
Created February 4, 2015 09:59
Show Gist options
  • Save andersao/78404fdd7679d428d9da to your computer and use it in GitHub Desktop.
Save andersao/78404fdd7679d428d9da to your computer and use it in GitHub Desktop.
Instalando e Configurando o Beanstalkd no Ubuntu

#Instalando e Configurando o Beanstalkd no Ubuntu

##Instalaçao

###Instalando o Beanstalkd

sudo apt-get install beanstalkd

###Instalando o Supervisor

sudo apt-get install supervisor

##Configuracao

###Configurando o Beanstalkd

Edite o arquivo de configuracoes:

sudo gedit /etc/default/beanstalkd

E adicione ou descomente a linha abaixo:

START=yes

Inicie o servico do Beanstalkd

sudo service beanstalkd start

Voce deve receber um retorno semelhante a

* Starting in-memory queueing server  beanstalkd

###Configurando o Supervisor

Criar um arquivo para configurar a queue no Supervisor

sudo vi /etc/supervisor/queue.conf

E adicionar o seguinte conteudo:

[program:queue]
command=php artisan queue:listen --tries=2
directory=/home/andersonandrade/workspace/jobs/allansales.local
stdout_logfile=/home/andersonandrade/workspace/jobs/allansales.local/storage/logs/supervisor.log
redirect_stderr=true

Agora e necessario registrar o novo programa no supervisor utilizando o controlador do supervisor

sudo supervisorctl

supervisor> reread
supervisor> add queue
supervisor> start queue
supervisor> status

Caso ocorra algum erro na configuracao do programa, e necessario remover o programa e executar os passos acima novamente

supervisor> remove queue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment