Commit 33655d4f6a2469db01402590f7fdc985753ab8a4

Authored by Guilherme Andrade Del Cantoni
1 parent e4c1a7a0
Exists in master

Configuração do Gearman e Supervisor para suporte ao módulo de integração do PEN

sei/Dockerfile
... ... @@ -16,19 +16,16 @@ MAINTAINER PEN - Processo Eletrônico Nacional
16 16 # Ref: https://processoeletronico.gov.br/projects/sei/wiki
17 17  
18 18 # Instalação do servidor web Apache 2.2, memcache e demais componentes
19   -RUN yum -y update && \
  19 +RUN yum install -y epel-release && \
  20 + yum -y update && \
20 21 yum -y install httpd-2.2.* mysql-5.1.* memcached openssl wget curl unzip gcc java-1.7.0-openjdk libxml2 dos2unix crontabs \
21 22 php-5.3.* php-common php-cli php-pear php-bcmath php-gd php-gmp php-imap php-intl php-ldap php-mbstring php-mysql \
22 23 php-odbc php-pdo php-pecl-apc php-pspell php-zlib php-snmp php-soap php-xml php-xmlrpc php-zts php-devel \
23   - php-pecl-apc-devel php-pecl-memcache php-calendar php-shmop && \
  24 + php-pecl-apc-devel php-pecl-memcache php-calendar php-shmop \
  25 + php-mcrypt php-pecl-xdebug \
  26 + supervisor gearmand libgearman libgearman-devel php-pecl-gearman && \
24 27 yum -y clean all
25 28  
26   -# Procedimentos para instalação das bibliotecas php-mcrypt e xdebuf
27   -RUN wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6 && \
28   - wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \
29   - rpm -ivh epel-release-6-8.noarch.rpm && \
30   - rm -f epel-release-6-8.noarch.rpm RPM-GPG-KEY-EPEL-6 && \
31   - yum -y install php-mcrypt php-pecl-xdebug
32 29  
33 30 # Configuração do charset do Apache
34 31 RUN echo "AddDefaultCharset iso-8859-1" | tee -a /etc/httpd/conf/httpd.conf
... ... @@ -49,14 +46,17 @@ ADD sei.ini /etc/php.d/sei.ini
49 46 ADD xdebug.ini /etc/php.d/xdebug.ini
50 47 ADD sei.conf /etc/httpd/conf.d/sei.conf
51 48  
  49 +# Configuração do Gearman e Supervisor, componentes necessários para a integração do SEI com Processo Eletrônico Nacional
  50 +ADD supervisord.conf /etc/supervisord.conf
  51 +
52 52 RUN mkdir -p /var/sei/arquivos && \
53 53 chmod -R 777 /var/sei/arquivos
54 54  
55 55 # Configuração dos serviços de background do Cron
56 56 RUN mkdir /var/log/sei
57 57 RUN sed -i '/session required pam_loginuid.so/c\#session required pam_loginuid.so' /etc/pam.d/crond
58   -RUN echo "*/5 * * * * root /usr/bin/php -c /etc/php.ini /var/www/html/sei/AgendamentoTarefaSEI.php 2>&1 >> /var/log/sei/agendamento_sei.log" >> /etc/cron.d/sei
59   -RUN echo "*/5 * * * * root /usr/bin/php -c /etc/php.ini /var/www/html/sip/AgendamentoTarefaSip.php 2>&1 >> /var/log/sei/agendamento_sip.log" >> /etc/cron.d/sei
  58 +RUN echo "0 * * * * root /usr/bin/php -c /etc/php.ini /var/www/html/sei/AgendamentoTarefaSEI.php 2>&1 >> /var/log/sei/agendamento_sei.log" >> /etc/cron.d/sei
  59 +RUN echo "0 * * * * root /usr/bin/php -c /etc/php.ini /var/www/html/sip/AgendamentoTarefaSip.php 2>&1 >> /var/log/sei/agendamento_sip.log" >> /etc/cron.d/sei
60 60  
61 61 # Script de inicialização do container entry-point
62 62 ADD entrypoint.sh /entrypoint.sh
... ...
sei/entrypoint.sh
... ... @@ -37,8 +37,11 @@ if [ ! -f /var/www/html/sip/ConfiguracaoSip.php ]; then
37 37 fi
38 38  
39 39 # Criação do diretório padrão de upload de arquivos
40   -mkdir /var/www/html/sei/upload && chmod -R 666 /var/www/html/sei/upload
41   -mkdir /var/www/html/sip/upload && chmod -R 666 /var/www/html/sip/upload
  40 +mkdir /var/www/html/sei/upload && \
  41 +mkdir /var/www/html/sip/upload && \
  42 +chmod -R 777 /var/www/html/sei/upload && \
  43 +chmod -R 777 /var/www/html/sip/upload
  44 +chmod -R 777 /var/sei/arquivos
42 45  
43 46 # Permissão de execução para utilitário de conversão de PDFs
44 47 chmod +x /var/www/html/sei/ferramentas/wkhtmltopdf-amd64
... ... @@ -50,5 +53,9 @@ chmod +x /var/www/html/sei/ferramentas/wkhtmltopdf-amd64
50 53 /etc/init.d/rsyslog start
51 54 /etc/init.d/crond start
52 55  
  56 +# Inicialização do Gearman e Supervisor, componentes para integração com Processo Eletrônico Nacional
  57 +/etc/init.d/gearmand start
  58 +/etc/init.d/supervisord start
  59 +
53 60 # Inicialização do servidor web
54 61 /usr/sbin/httpd -DFOREGROUND
... ...
sei/supervisord.conf 0 → 100644
... ... @@ -0,0 +1,73 @@
  1 +
  2 +[supervisord]
  3 +http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server)
  4 +;http_port=127.0.0.1:9001 ; (alternately, ip_address:port specifies AF_INET)
  5 +;sockchmod=0700 ; AF_UNIX socketmode (AF_INET ignore, default 0700)
  6 +;sockchown=nobody.nogroup ; AF_UNIX socket uid.gid owner (AF_INET ignores)
  7 +;umask=022 ; (process file creation umask;default 022)
  8 +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
  9 +logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
  10 +logfile_backups=10 ; (num of main logfile rotation backups;default 10)
  11 +loglevel=info ; (logging level;default info; others: debug,warn)
  12 +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
  13 +nodaemon=false ; (start in foreground if true;default false)
  14 +minfds=1024 ; (min. avail startup file descriptors;default 1024)
  15 +minprocs=200 ; (min. avail process descriptors;default 200)
  16 +
  17 +;nocleanup=true ; (don't clean up tempfiles at start;default false)
  18 +;http_username=user ; (default is no username (open system))
  19 +;http_password=123 ; (default is no password (open system))
  20 +;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
  21 +;user=chrism ; (default is current user, required if root)
  22 +;directory=/tmp ; (default is not to cd during start)
  23 +;environment=KEY=value ; (key value pairs to add to environment)
  24 +
  25 +[supervisorctl]
  26 +serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket
  27 +;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
  28 +;username=chris ; should be same as http_username if set
  29 +;password=123 ; should be same as http_password if set
  30 +;prompt=mysupervisor ; cmd line prompt (default "supervisor")
  31 +
  32 +; The below sample program section shows all possible program subsection values,
  33 +; create one or more 'real' program: sections to be able to control them under
  34 +; supervisor.
  35 +
  36 +;[program:theprogramname]
  37 +;command=/bin/cat ; the program (relative uses PATH, can take args)
  38 +;priority=999 ; the relative start priority (default 999)
  39 +;autostart=true ; start at supervisord start (default: true)
  40 +;autorestart=true ; retstart at unexpected quit (default: true)
  41 +;startsecs=10 ; number of secs prog must stay running (def. 10)
  42 +;startretries=3 ; max # of serial start failures (default 3)
  43 +;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
  44 +;stopsignal=QUIT ; signal used to kill process (default TERM)
  45 +;stopwaitsecs=10 ; max num secs to wait before SIGKILL (default 10)
  46 +;user=chrism ; setuid to this UNIX account to run the program
  47 +;log_stdout=true ; if true, log program stdout (default true)
  48 +;log_stderr=true ; if true, log program stderr (def false)
  49 +;logfile=/var/log/cat.log ; child log path, use NONE for none; default AUTO
  50 +;logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
  51 +;logfile_backups=10 ; # of logfile backups (default 10)
  52 +
  53 +[program:sei_processar_pendencias]
  54 +command=/usr/bin/php -c /etc/php.ini /var/www/html/sei/modulos/pen/rn/ProcessarPendenciasRN.php
  55 +numprocs=1
  56 +directory=/var/www/html/sei/
  57 +autostart=true
  58 +autorestart=true
  59 +stdout_logfile=/tmp/sei.log
  60 +stdout_logfile_maxbytes=1MB
  61 +stderr_logfile=/tmp/sei_error.log
  62 +stderr_logfile_maxbytes=1MB
  63 +
  64 +[program:sei_monitorar_pendencias]
  65 +command=/usr/bin/php -c /etc/php.ini /var/www/html/sei/modulos/pen/rn/PendenciasTramiteRN.php
  66 +numprocs=1
  67 +directory=/var/www/html/sei/
  68 +autostart=true
  69 +autorestart=true
  70 +stdout_logfile=/tmp/sei.log
  71 +stdout_logfile_maxbytes=1MB
  72 +stderr_logfile=/tmp/sei_error.log
  73 +
... ...