Commit 7dfd1ad5f8886ae3f65a520074b45dd98d826613
1 parent
00ffd5aa
Exists in
master
Implementação do container sei com docker php:5.6-apache
Showing
6 changed files
with
73 additions
and
131 deletions
Show diff stats
sei/ConfiguracaoSEI.php
| ... | ... | @@ -43,7 +43,7 @@ class ConfiguracaoSEI extends InfraConfiguracao { |
| 43 | 43 | 'Servidor' => getenv("MEMCACHED_PORT_11211_TCP_ADDR"), |
| 44 | 44 | 'Porta' => getenv("MEMCACHED_PORT_11211_TCP_PORT")), |
| 45 | 45 | |
| 46 | - 'JODConverter' => array('Servidor' => 'http://'.getenv("JOD_PORT_8080_TCP_ADDR").':'.getenv("JOD_PORT_8080_TCP_PORT").'/converter/service') | |
| 46 | + 'JODConverter' => array('Servidor' => 'http://'.getenv("JOD_PORT_8080_TCP_ADDR").':'.getenv("JOD_PORT_8080_TCP_PORT").'/converter/service'), | |
| 47 | 47 | |
| 48 | 48 | 'Edoc' => array('Servidor' => 'http://[Servidor .NET]'), |
| 49 | 49 | ... | ... |
sei/Dockerfile
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | ############################################################################## |
| 4 | 4 | |
| 5 | 5 | # Definição da imagem de base para o CentOS 6.X |
| 6 | -FROM centos:centos6 | |
| 6 | +FROM php:5.6-apache | |
| 7 | 7 | |
| 8 | 8 | # Autor e mantenedor do container |
| 9 | 9 | MAINTAINER PEN - Processo Eletrônico Nacional |
| ... | ... | @@ -14,51 +14,48 @@ ENV TERM xterm |
| 14 | 14 | # Instalação do SEI seguindo as recomendações descritas na documentação do SEI |
| 15 | 15 | |
| 16 | 16 | # Instalação do servidor web Apache 2.2, memcache e demais componentes |
| 17 | - RUN yum install -y epel-release && \ | |
| 18 | - yum -y update && \ | |
| 19 | - yum -y install httpd-2.2.* mysql-5.1.* memcached openssl wget curl unzip gcc java-1.7.0-openjdk libxml2 dos2unix crontabs \ | |
| 20 | - 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 \ | |
| 21 | - php-odbc php-pdo php-pecl-apc php-pspell php-zlib php-snmp php-soap php-xml php-xmlrpc php-zts php-devel \ | |
| 22 | - php-pecl-apc-devel php-pecl-memcache php-calendar php-shmop php-intl php-mcrypt php-pecl-xdebug \ | |
| 23 | - supervisor gearmand libgearman libgearman-devel php-pecl-gearman && \ | |
| 24 | - yum -y clean all | |
| 17 | +# RUN yum install -y epel-release && \ | |
| 18 | +# yum -y update && \ | |
| 19 | +# yum -y install httpd-2.4.6 mysql-5.6 openssl wget curl unzip gcc java-1.7.0-openjdk libxml2 dos2unix crontabs \ | |
| 20 | +# php-5.6.5 php-common php-cli php-pear php-bcmath php-gd php-gmp php-imap php-intl php-ldap php-mbstring php-mysqli \ | |
| 21 | +# php-odbc php-pdo php-pecl-apc php-pspell php-zlib php-snmp php-soap php-xml php-xmlrpc php-zts php-devel \ | |
| 22 | +# php-pecl-apc-devel php-pecl-memcache php-calendar php-shmop php-intl php-mcrypt php-pecl-xdebug \ | |
| 23 | +# supervisor gearmand libgearman libgearman-devel php-pecl-gearman && \ | |
| 24 | +# yum -y clean all | |
| 25 | 25 | |
| 26 | -# Configuração do charset do Apache | |
| 27 | -#RUN echo "AddDefaultCharset iso-8859-1" >> /etc/httpd/conf/httpd.conf | |
| 26 | +# Obtenção do pacote de instalação do Solr 4.0 | |
| 27 | +COPY install.sh /install.sh | |
| 28 | 28 | |
| 29 | -# Correção do bug do VirtualBox relacionado ao Sendfile. http://docs.vagrantup.com/v2/synced-folders/virtualbox.html | |
| 30 | -#RUN echo "EnableSendfile Off" >> /etc/httpd/conf/httpd.conf | |
| 31 | - | |
| 32 | -# Instalação do componentes UploadProgress | |
| 33 | -RUN pecl install uploadprogress && \ | |
| 34 | - echo "extension=uploadprogress.so" >> /etc/php.d/uploadprogress.ini | |
| 29 | +RUN bash /install.sh | |
| 35 | 30 | |
| 36 | 31 | # Configuração dos parâmetros do SEI e SIP |
| 37 | -ADD ConfiguracaoSEI.php /opt/ConfiguracaoSEI.php | |
| 38 | -ADD ConfiguracaoSip.php /opt/ConfiguracaoSip.php | |
| 32 | +ADD ConfiguracaoSEI.php /ConfiguracaoSEI.php | |
| 33 | +ADD ConfiguracaoSip.php /ConfiguracaoSip.php | |
| 39 | 34 | |
| 40 | 35 | # Copia arquivos necessários para a instalação |
| 41 | -ADD sei.ini /etc/php.d/sei.ini | |
| 42 | -ADD xdebug.ini /etc/php.d/xdebug.ini | |
| 43 | -ADD sei.conf /etc/httpd/conf.d/sei.conf | |
| 36 | +ADD sei.ini /usr/local/etc/php/conf.d | |
| 37 | +ADD xdebug.ini /usr/local/etc/php/conf.d | |
| 38 | +ADD sei.conf /etc/apache2/sites-available/sei.conf | |
| 39 | + | |
| 40 | +RUN a2ensite sei | |
| 44 | 41 | |
| 45 | 42 | # Configuração do Gearman e Supervisor, componentes necessários para a integração do SEI com Processo Eletrônico Nacional |
| 46 | -ADD supervisord.conf /etc/supervisord.conf | |
| 43 | +ADD supervisord.conf /etc/supervisor/conf.d/processo-eletronico.conf | |
| 47 | 44 | |
| 48 | -RUN mkdir -p /var/sei/arquivos && \ | |
| 49 | - chmod -R 777 /var/sei/arquivos | |
| 45 | +#RUN mkdir -p /var/sei/arquivos && \ | |
| 46 | +# chmod -R 777 /var/sei/arquivos | |
| 50 | 47 | |
| 51 | 48 | # Configuração dos serviços de background do Cron |
| 52 | -RUN mkdir /var/log/sei | |
| 53 | -RUN sed -i '/session required pam_loginuid.so/c\#session required pam_loginuid.so' /etc/pam.d/crond | |
| 54 | -RUN echo "0 * * * * root /usr/bin/php -c /etc/php.ini /opt/sei/scripts/AgendamentoTarefaSEI.php 2>&1 >> /var/log/sei/agendamento_sei.log" >> /etc/cron.d/sei | |
| 55 | -RUN echo "0 * * * * root /usr/bin/php -c /etc/php.ini /opt/sip/scripts/AgendamentoTarefaSip.php 2>&1 >> /var/log/sip/agendamento_sip.log" >> /etc/cron.d/sip | |
| 56 | -RUN echo "00 01 * * * root rm -rf /opt/sei/temp/*" >> /etc/cron.d/sei | |
| 57 | -RUN echo "00 01 * * * root rm -rf /opt/sip/temp/*" >> /etc/cron.d/sip | |
| 49 | +#RUN mkdir /var/log/sei | |
| 50 | +#RUN sed -i '/session required pam_loginuid.so/c\#session required pam_loginuid.so' /etc/pam.d/crond | |
| 51 | +#RUN echo "0 * * * * root /usr/bin/php -c /etc/php.ini /opt/sei/scripts/AgendamentoTarefaSEI.php 2>&1 >> /var/log/sei/agendamento_sei.log" >> /etc/cron.d/sei | |
| 52 | +#RUN echo "0 * * * * root /usr/bin/php -c /etc/php.ini /opt/sip/scripts/AgendamentoTarefaSip.php 2>&1 >> /var/log/sip/agendamento_sip.log" >> /etc/cron.d/sip | |
| 53 | +#RUN echo "00 01 * * * root rm -rf /opt/sei/temp/*" >> /etc/cron.d/sei | |
| 54 | +#RUN echo "00 01 * * * root rm -rf /opt/sip/temp/*" >> /etc/cron.d/sip | |
| 58 | 55 | |
| 59 | 56 | # Script de inicialização do container entry-point |
| 60 | 57 | ADD entrypoint.sh /entrypoint.sh |
| 61 | -RUN dos2unix /entrypoint.sh && chmod +x /entrypoint.sh | |
| 58 | +RUN chmod +x /entrypoint.sh | |
| 62 | 59 | |
| 63 | 60 | ##################### FIM DA INSTALACAO ##################### |
| 64 | 61 | ... | ... |
sei/entrypoint.sh
| ... | ... | @@ -2,10 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | echo "127.0.0.1 sip_www" >> /etc/hosts |
| 4 | 4 | |
| 5 | -# Configura localização das aplicações SEI e SIP | |
| 6 | -ln -s /mnt/sei/src/sei /opt/ | |
| 7 | -ln -s /mnt/sei/src/sip /opt/ | |
| 8 | - | |
| 9 | 5 | # Configura localização correta da infra_php |
| 10 | 6 | #if [ -d /mnt/sei/src/infra/infra_php ]; then dir_infra_php="/mnt/sei/src/infra/infra_php"; else dir_infra_php="/mnt/sei/src/infra_php"; fi |
| 11 | 7 | #ln -sf $dir_infra_php /var/www/html/ |
| ... | ... | @@ -24,7 +20,7 @@ if [ -f /opt/sei/config/ConfiguracaoSEI.php ] && [ ! -f /opt/sei/config/Configur |
| 24 | 20 | fi |
| 25 | 21 | |
| 26 | 22 | if [ ! -f /opt/sei/config/ConfiguracaoSEI.php ]; then |
| 27 | - cp /opt/ConfiguracaoSEI.php /opt/sei/config/ConfiguracaoSEI.php | |
| 23 | + cp /ConfiguracaoSEI.php /opt/sei/config/ConfiguracaoSEI.php | |
| 28 | 24 | fi |
| 29 | 25 | |
| 30 | 26 | # Atribuição dos parâmetros de configuração do SIP |
| ... | ... | @@ -33,40 +29,28 @@ if [ -f /opt/sip/config/ConfiguracaoSip.php ] && [ ! -f /opt/sip/config/Configur |
| 33 | 29 | fi |
| 34 | 30 | |
| 35 | 31 | if [ ! -f /opt/sip/config/ConfiguracaoSip.php ]; then |
| 36 | - cp /opt/sip/config/ConfiguracaoSip.php /opt/sip/config/ConfiguracaoSip.php | |
| 32 | + cp /ConfiguracaoSip.php /opt/sip/config/ConfiguracaoSip.php | |
| 37 | 33 | fi |
| 38 | 34 | |
| 39 | 35 | # Criação do diretório padrão de upload de arquivos |
| 40 | 36 | #SEI |
| 41 | -chown -R root.apache /opt/sei | |
| 42 | -find /opt/sei -type d -exec chmod 2750 {} \; | |
| 43 | -find /opt/sei -type f -exec chmod 0640 {} \; | |
| 44 | -find /opt/sei/temp -type d -exec chmod 2570 {} \; | |
| 45 | -chmod 0750 /opt/sei/bin/wkhtmltopdf-amd64 | |
| 46 | - | |
| 47 | -#SIP | |
| 48 | -chown -R root.apache /opt/sip | |
| 49 | -find /opt/sip -type d -exec chmod 2750 {} \; | |
| 50 | -find /opt/sip -type f -exec chmod 0640 {} \; | |
| 51 | -find /opt/sip/temp -type d -exec chmod 2570 {} \; | |
| 52 | - | |
| 53 | -#Infra PHP | |
| 54 | -chown -R root.apache /opt/infra | |
| 55 | -find /opt/infra -type d -exec chmod 2750 {} \; | |
| 56 | -find /opt/infra -type f -exec chmod 0640 {} \; | |
| 57 | - | |
| 37 | +chown -R www-data.www-data /opt/sei | |
| 38 | +chown -R www-data.www-data /opt/infra | |
| 39 | +chown -R www-data.www-data /opt/sip | |
| 40 | +chmod +x /opt/sei/bin/wkhtmltopdf-amd64 | |
| 41 | +chmod -R 777 /opt/sei/temp | |
| 42 | +chmod -R 777 /opt/sip/temp | |
| 58 | 43 | chmod -R 777 /var/sei/arquivos |
| 59 | 44 | |
| 60 | 45 | # Inicialização do serviço de cache |
| 61 | 46 | #/etc/init.d/memcached start |
| 62 | 47 | |
| 63 | 48 | # Inicialização das rotinas de agendamento |
| 64 | -/etc/init.d/rsyslog start | |
| 65 | -/etc/init.d/crond start | |
| 49 | +service cron start | |
| 66 | 50 | |
| 67 | 51 | # Inicialização do Gearman e Supervisor, componentes para integração com Processo Eletrônico Nacional |
| 68 | -/etc/init.d/gearmand start | |
| 69 | -/etc/init.d/supervisord start | |
| 52 | +gearmand & | |
| 53 | +service supervisor start | |
| 70 | 54 | |
| 71 | 55 | # Inicialização do servidor web |
| 72 | -/usr/sbin/httpd -DFOREGROUND | |
| 56 | +apache2-foreground | ... | ... |
| ... | ... | @@ -0,0 +1,31 @@ |
| 1 | +#!/usr/bin/env bash | |
| 2 | + | |
| 3 | +set -e | |
| 4 | + | |
| 5 | +apt-get -y update | |
| 6 | + | |
| 7 | +apt-get -y install mysql-client wget unzip openjdk-7-jre bzip2 cron \ | |
| 8 | + php5-common php-pear php5-gd php5-intl php5-ldap php5-mysql php5-memcached php5-curl php5-json php5-dev php5-xdebug php5-mcrypt \ | |
| 9 | + php-calendar php-soap php-gettext php-pclzip php-file \ | |
| 10 | + libapache2-mod-php5filter | |
| 11 | + | |
| 12 | +# Instalação do componentes UploadProgress | |
| 13 | +pecl install uploadprogress | |
| 14 | +echo "extension=uploadprogress.so" > /etc/php5/mods-available/uploadprogress.ini | |
| 15 | + | |
| 16 | +# Instalação do Supervisor e Gearman para suporte à integração com o PEN | |
| 17 | +apt-get -y install supervisor | |
| 18 | +apt-get -y install gearman libgearman7 php5-gearman | |
| 19 | + | |
| 20 | +# Configuração de permissão do diretório de arquivos | |
| 21 | +mkdir -p /var/sei/arquivos && \ | |
| 22 | +chmod -R 777 /var/sei/arquivos | |
| 23 | + | |
| 24 | +# Configuração dos serviços de background do Cron | |
| 25 | +mkdir /var/log/sei | |
| 26 | +echo "0 * * * * root /usr/bin/php -c /etc/php.ini /opt/sei/scripts/AgendamentoTarefaSEI.php 2>&1 >> /var/log/sei/agendamento_sei.log" >> /etc/cron.d/sei | |
| 27 | +echo "0 * * * * root /usr/bin/php -c /etc/php.ini /opt/sip/scripts/AgendamentoTarefaSip.php 2>&1 >> /var/log/sip/agendamento_sip.log" >> /etc/cron.d/sip | |
| 28 | +echo "00 01 * * * root rm -rf /opt/sei/temp/*" >> /etc/cron.d/sei | |
| 29 | +echo "00 01 * * * root rm -rf /opt/sip/temp/*" >> /etc/cron.d/sip | |
| 30 | + | |
| 31 | +exit 0 | ... | ... |
sei/sei.conf
| 1 | 1 | KeepAlive On |
| 2 | 2 | MaxKeepAliveRequests 100 |
| 3 | 3 | KeepAliveTimeout 15 |
| 4 | -AddDefaultCharset iso-8859-1 | |
| 5 | -EnableSendfile Off | |
| 6 | 4 | |
| 7 | 5 | Alias "/sei" "/opt/sei/web" |
| 8 | 6 | Alias "/sip" "/opt/sip/web" |
| 9 | 7 | Alias "/infra_css" "/opt/infra/infra_css" |
| 10 | 8 | Alias "/infra_js" "/opt/infra/infra_js" |
| 11 | 9 | |
| 12 | -<Directory ~ "(/opt/sei/web|/opt/sip/web|/opt/infra/infra_css|/opt/infra/infra_js)" > | |
| 13 | - AllowOverride None | |
| 14 | - Options None | |
| 15 | - Require all granted | |
| 16 | -</Directory> | |
| 17 | - | |
| 18 | 10 | <VirtualHost *:80> |
| 19 | 11 | |
| 20 | 12 | DocumentRoot /var/www/html |
| ... | ... | @@ -62,14 +54,3 @@ Alias "/infra_js" "/opt/infra/infra_js" |
| 62 | 54 | MaxRequestsPerChild 10000 |
| 63 | 55 | </IfModule> |
| 64 | 56 | |
| 65 | -# Para evitar erros nos log do SIP (menu Infra/Log) identificados por | |
| 66 | -# “Microsoft Data Access Internet Publishing Provider Protocol Discovery” | |
| 67 | -SetEnvIfNoCase user-agent "Microsoft Data Access Internet | |
| 68 | -Publishing Provider Protocol Discovery" bad_bot=1 | |
| 69 | - | |
| 70 | -<FilesMatch "(.*)"> | |
| 71 | - Order Allow,Deny | |
| 72 | - Allow from all | |
| 73 | - Deny from env=bad_bot | |
| 74 | -</FilesMatch> | |
| 75 | - | ... | ... |
sei/supervisord.conf
| 1 | 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 | 2 | [program:sei_processar_pendencias] |
| 54 | 3 | command=/usr/bin/php -c /etc/php.ini /var/www/html/sei/modulos/pen/rn/ProcessarPendenciasRN.php |
| 55 | 4 | numprocs=1 | ... | ... |