From 33655d4f6a2469db01402590f7fdc985753ab8a4 Mon Sep 17 00:00:00 2001 From: Guilherme Andrade Del Cantoni Date: Fri, 8 Jul 2016 01:10:49 -0300 Subject: [PATCH] Configuração do Gearman e Supervisor para suporte ao módulo de integração do PEN --- sei/Dockerfile | 20 ++++++++++---------- sei/entrypoint.sh | 11 +++++++++-- sei/supervisord.conf | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 12 deletions(-) create mode 100644 sei/supervisord.conf diff --git a/sei/Dockerfile b/sei/Dockerfile index f4a256f..ddb58f2 100644 --- a/sei/Dockerfile +++ b/sei/Dockerfile @@ -16,19 +16,16 @@ MAINTAINER PEN - Processo Eletrônico Nacional # Ref: https://processoeletronico.gov.br/projects/sei/wiki # Instalação do servidor web Apache 2.2, memcache e demais componentes -RUN yum -y update && \ +RUN yum install -y epel-release && \ + yum -y update && \ yum -y install httpd-2.2.* mysql-5.1.* memcached openssl wget curl unzip gcc java-1.7.0-openjdk libxml2 dos2unix crontabs \ 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 \ php-odbc php-pdo php-pecl-apc php-pspell php-zlib php-snmp php-soap php-xml php-xmlrpc php-zts php-devel \ - php-pecl-apc-devel php-pecl-memcache php-calendar php-shmop && \ + php-pecl-apc-devel php-pecl-memcache php-calendar php-shmop \ + php-mcrypt php-pecl-xdebug \ + supervisor gearmand libgearman libgearman-devel php-pecl-gearman && \ yum -y clean all -# Procedimentos para instalação das bibliotecas php-mcrypt e xdebuf -RUN wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6 && \ - wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm && \ - rpm -ivh epel-release-6-8.noarch.rpm && \ - rm -f epel-release-6-8.noarch.rpm RPM-GPG-KEY-EPEL-6 && \ - yum -y install php-mcrypt php-pecl-xdebug # Configuração do charset do Apache 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 ADD xdebug.ini /etc/php.d/xdebug.ini ADD sei.conf /etc/httpd/conf.d/sei.conf +# Configuração do Gearman e Supervisor, componentes necessários para a integração do SEI com Processo Eletrônico Nacional +ADD supervisord.conf /etc/supervisord.conf + RUN mkdir -p /var/sei/arquivos && \ chmod -R 777 /var/sei/arquivos # Configuração dos serviços de background do Cron RUN mkdir /var/log/sei RUN sed -i '/session required pam_loginuid.so/c\#session required pam_loginuid.so' /etc/pam.d/crond -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 -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 +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 +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 # Script de inicialização do container entry-point ADD entrypoint.sh /entrypoint.sh diff --git a/sei/entrypoint.sh b/sei/entrypoint.sh index 066535c..23b7c00 100644 --- a/sei/entrypoint.sh +++ b/sei/entrypoint.sh @@ -37,8 +37,11 @@ if [ ! -f /var/www/html/sip/ConfiguracaoSip.php ]; then fi # Criação do diretório padrão de upload de arquivos -mkdir /var/www/html/sei/upload && chmod -R 666 /var/www/html/sei/upload -mkdir /var/www/html/sip/upload && chmod -R 666 /var/www/html/sip/upload +mkdir /var/www/html/sei/upload && \ +mkdir /var/www/html/sip/upload && \ +chmod -R 777 /var/www/html/sei/upload && \ +chmod -R 777 /var/www/html/sip/upload +chmod -R 777 /var/sei/arquivos # Permissão de execução para utilitário de conversão de PDFs chmod +x /var/www/html/sei/ferramentas/wkhtmltopdf-amd64 @@ -50,5 +53,9 @@ chmod +x /var/www/html/sei/ferramentas/wkhtmltopdf-amd64 /etc/init.d/rsyslog start /etc/init.d/crond start +# Inicialização do Gearman e Supervisor, componentes para integração com Processo Eletrônico Nacional +/etc/init.d/gearmand start +/etc/init.d/supervisord start + # Inicialização do servidor web /usr/sbin/httpd -DFOREGROUND diff --git a/sei/supervisord.conf b/sei/supervisord.conf new file mode 100644 index 0000000..a062430 --- /dev/null +++ b/sei/supervisord.conf @@ -0,0 +1,73 @@ + +[supervisord] +http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server) +;http_port=127.0.0.1:9001 ; (alternately, ip_address:port specifies AF_INET) +;sockchmod=0700 ; AF_UNIX socketmode (AF_INET ignore, default 0700) +;sockchown=nobody.nogroup ; AF_UNIX socket uid.gid owner (AF_INET ignores) +;umask=022 ; (process file creation umask;default 022) +logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) +logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) +logfile_backups=10 ; (num of main logfile rotation backups;default 10) +loglevel=info ; (logging level;default info; others: debug,warn) +pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) +nodaemon=false ; (start in foreground if true;default false) +minfds=1024 ; (min. avail startup file descriptors;default 1024) +minprocs=200 ; (min. avail process descriptors;default 200) + +;nocleanup=true ; (don't clean up tempfiles at start;default false) +;http_username=user ; (default is no username (open system)) +;http_password=123 ; (default is no password (open system)) +;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) +;user=chrism ; (default is current user, required if root) +;directory=/tmp ; (default is not to cd during start) +;environment=KEY=value ; (key value pairs to add to environment) + +[supervisorctl] +serverurl=unix:///var/tmp/supervisor.sock ; use a unix:// URL for a unix socket +;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket +;username=chris ; should be same as http_username if set +;password=123 ; should be same as http_password if set +;prompt=mysupervisor ; cmd line prompt (default "supervisor") + +; The below sample program section shows all possible program subsection values, +; create one or more 'real' program: sections to be able to control them under +; supervisor. + +;[program:theprogramname] +;command=/bin/cat ; the program (relative uses PATH, can take args) +;priority=999 ; the relative start priority (default 999) +;autostart=true ; start at supervisord start (default: true) +;autorestart=true ; retstart at unexpected quit (default: true) +;startsecs=10 ; number of secs prog must stay running (def. 10) +;startretries=3 ; max # of serial start failures (default 3) +;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) +;stopsignal=QUIT ; signal used to kill process (default TERM) +;stopwaitsecs=10 ; max num secs to wait before SIGKILL (default 10) +;user=chrism ; setuid to this UNIX account to run the program +;log_stdout=true ; if true, log program stdout (default true) +;log_stderr=true ; if true, log program stderr (def false) +;logfile=/var/log/cat.log ; child log path, use NONE for none; default AUTO +;logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) +;logfile_backups=10 ; # of logfile backups (default 10) + +[program:sei_processar_pendencias] +command=/usr/bin/php -c /etc/php.ini /var/www/html/sei/modulos/pen/rn/ProcessarPendenciasRN.php +numprocs=1 +directory=/var/www/html/sei/ +autostart=true +autorestart=true +stdout_logfile=/tmp/sei.log +stdout_logfile_maxbytes=1MB +stderr_logfile=/tmp/sei_error.log +stderr_logfile_maxbytes=1MB + +[program:sei_monitorar_pendencias] +command=/usr/bin/php -c /etc/php.ini /var/www/html/sei/modulos/pen/rn/PendenciasTramiteRN.php +numprocs=1 +directory=/var/www/html/sei/ +autostart=true +autorestart=true +stdout_logfile=/tmp/sei.log +stdout_logfile_maxbytes=1MB +stderr_logfile=/tmp/sei_error.log + -- libgit2 0.21.2