avmtrf1-tools 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3520552a41e6f4a32ae9376ff6a7f2eba143537a8a94869111190995ca29cb05
4
- data.tar.gz: fa17a6d077e56cbac8cf56cbc09f1145adf217d1c4a2614472f60a2453121e28
3
+ metadata.gz: b56af4bc622de91fef0d034ec66ea80cf49a44009b8e2f6deb4c282a7f3bf879
4
+ data.tar.gz: 28e07eb935f9bc94e23848af1bbe48c248cb09498cf01737167649276b25d0bb
5
5
  SHA512:
6
- metadata.gz: 8965d2f0114ed1e933f96b5157ff26759cfa75c38fd93b806d88b158036f4f636f3b1a7e3744f1fa9b09a4de30a64b8762b3f7605df8781fbd3e0fc5e3fa1a3d
7
- data.tar.gz: f1c9bf191bd69b5979f1c59a8a3dba10893a442bb47f34ed09b92c81338b5a7700c57d3cef8648e916294a09cec78c632bf37bbc021f29d6a08bbcd2a5824dc5
6
+ metadata.gz: 2c1a24bbe46362303eb12f0bac48d98b15d54b45c6f799f3d9264ef224087359640e466741dcf083adbc01e93958002ec8b3fdf05b9533d3c5ee49792fe765d1
7
+ data.tar.gz: 26c9d981c75c939ad49db436d67380e7c5c8ede65143cec50acb12fb6cdc1ba70a8b854baa95f450f1ee6525a844d0d1ce71b02d47ba13f0e492a109513451f2
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avmtrf1
4
4
  module Tools
5
- VERSION = '0.16.0'
5
+ VERSION = '0.16.1'
6
6
  end
7
7
  end
@@ -0,0 +1,96 @@
1
+ FROM php:%%PHP_VERSION%%-apache
2
+
3
+ RUN a2enmod rewrite
4
+
5
+ # Base ubuntu
6
+ RUN apt-get -y update
7
+ RUN apt-get -y dist-upgrade
8
+
9
+ # Extensão PHP "bcmath"
10
+ RUN docker-php-ext-install bcmath
11
+
12
+ # Extensão PHP "bz2"
13
+ RUN apt-get install -y libbz2-dev
14
+ RUN docker-php-ext-install bz2
15
+
16
+ # Extensão PHP "gd"
17
+ RUN apt-get install -y libpng-dev
18
+ RUN docker-php-ext-install gd
19
+
20
+ # Extensão PHP "intl"
21
+ RUN apt-get install -y libc-client-dev libkrb5-dev
22
+ RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
23
+ RUN docker-php-ext-install imap
24
+
25
+ # Extensão PHP "intl"
26
+ RUN apt-get install -y libicu-dev
27
+ RUN docker-php-ext-install intl
28
+
29
+ # Extensão PHP "ldap"
30
+ RUN apt-get install -y libldap2-dev
31
+ RUN docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/
32
+ RUN docker-php-ext-install ldap
33
+
34
+ # Extensão PHP "mcrypt"
35
+ RUN apt-get install -y libmcrypt-dev
36
+ %%MCRYPT_INSTALL%%
37
+
38
+ # Extensão PHP "snmp"
39
+ RUN apt-get install -y libsnmp-dev snmp
40
+ RUN docker-php-ext-install snmp
41
+
42
+ # Extensão PHP "soap"
43
+ RUN apt-get install -y libxml2-dev
44
+ RUN docker-php-ext-install soap
45
+
46
+ # Extensão PHP "xsl"
47
+ RUN apt-get install -y libxslt1-dev
48
+ RUN docker-php-ext-install xsl
49
+
50
+ # Extensão PHP "zip"
51
+ RUN apt-get install -y libzip-dev
52
+ RUN docker-php-ext-install zip
53
+
54
+ # Extensões MySql
55
+ RUN docker-php-ext-install mysqli pdo_mysql
56
+
57
+ # Extensões PHP PostgreSQL
58
+ RUN apt-get install -y libpq-dev
59
+ RUN docker-php-ext-install pdo_pgsql pgsql
60
+
61
+ # Extensão PHP oci
62
+ RUN apt-get install -y libarchive-tools wget libaio1
63
+ RUN wget -qO- https://raw.githubusercontent.com/caffeinalab/php-fpm-oci8/master/oracle/instantclient-basic-linux.x64-12.2.0.1.0.zip | bsdtar -xvf- -C /usr/local
64
+ RUN wget -qO- https://raw.githubusercontent.com/caffeinalab/php-fpm-oci8/master/oracle/instantclient-sdk-linux.x64-12.2.0.1.0.zip | bsdtar -xvf- -C /usr/local
65
+ RUN wget -qO- https://raw.githubusercontent.com/caffeinalab/php-fpm-oci8/master/oracle/instantclient-sqlplus-linux.x64-12.2.0.1.0.zip | bsdtar -xvf- -C /usr/local
66
+ RUN ln -s /usr/local/instantclient_12_2 /usr/local/instantclient
67
+ RUN ln -s /usr/local/instantclient/libclntsh.so.* /usr/local/instantclient/libclntsh.so
68
+ RUN ln -s /usr/local/instantclient/lib* /usr/lib
69
+ RUN ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus
70
+ RUN docker-php-ext-configure oci8 --with-oci8=instantclient,/usr/local/instantclient
71
+ RUN docker-php-ext-install oci8
72
+
73
+ # Extensão PHP pdo_oci
74
+ RUN mkdir /tmp/php_source
75
+ RUN wget -O - "https://www.php.net/distributions/php-$PHP_VERSION.tar.gz" | \
76
+ tar -zxf - -C /tmp/php_source --strip 1
77
+ WORKDIR /tmp/php_source/ext/pdo_oci
78
+ RUN phpize
79
+ RUN ./configure --with-pdo-oci=instantclient,/usr/local/instantclient,12.1
80
+ RUN make
81
+ RUN make install
82
+ RUN echo extension=pdo_oci.so > "$PHP_INI_DIR/conf.d/pdo_oci.ini"
83
+ RUN echo 'date.timezone = "America/Sao_Paulo"' >> "$PHP_INI_DIR/php.ini"
84
+
85
+ # Composer
86
+ RUN apt-get install -y unzip
87
+ RUN curl -sS https://getcomposer.org/installer | \
88
+ php -- --install-dir=/usr/local/bin --filename=composer
89
+
90
+ # Inicializador
91
+ RUN mkdir '/aux'
92
+ RUN mkdir '/aux/eac-bash-lib'
93
+ RUN wget -qO- https://github.com/esquilo-azul/eac-bash-lib/archive/cb31a3db2e3a6e356bcd0346b7a7b6ebb7d97d36.tar.gz \
94
+ | tar -xzf - --strip-components 1 -C '/aux/eac-bash-lib'
95
+ ADD aux '/aux'
96
+ CMD '/aux/start.sh'
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ set -u
4
+ set -e
5
+
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
8
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
11
+ done
12
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
13
+ source "$DIR/init.sh"
14
+
15
+ infom "Executando \"apache2-foreground\"..."
16
+ apache2-foreground
@@ -0,0 +1,19 @@
1
+ #!/bin/bash
2
+
3
+ set -u
4
+ set -e
5
+
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
8
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
11
+ done
12
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
13
+ source "$DIR/init.sh"
14
+
15
+ infov 'Application root path ($APP_ROOT)' "$APP_ROOT"
16
+ infov "Apache\'s document root (\$DOCUMENT_ROOT)" "$DOCUMENT_ROOT"
17
+ infov 'PHP Composer directories ($COMPOSER_PATH)' "$COMPOSER_PATH"
18
+ infov 'Laravel directories ($LARAVEL_PATH)' "$LARAVEL_PATH"
19
+ infov 'Run Apache? ($RUN_APACHE)' "$RUN_APACHE"
@@ -0,0 +1,44 @@
1
+ set -u
2
+ set -e
3
+
4
+ SOURCE="${BASH_SOURCE[0]}"
5
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
6
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
7
+ SOURCE="$(readlink "$SOURCE")"
8
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
9
+ done
10
+ export AUX_ROOT="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
11
+
12
+ source "$AUX_ROOT/lib.sh"
13
+
14
+ # Diretório de templates
15
+ export TEMPLATES_ROOT="$AUX_ROOT/templates"
16
+
17
+ function text_set() {
18
+ VARIABLE_NAME="$1"
19
+ DEFAULT_VALUE="$2"
20
+
21
+ RESULT="$DEFAULT_VALUE"
22
+ if var_present_r "$VARIABLE_NAME"; then
23
+ RESULT="${!VARIABLE_NAME}"
24
+ fi
25
+ export $VARIABLE_NAME="$RESULT"
26
+ }
27
+
28
+ # Caminho raiz da aplicação
29
+ path_set 'APP_ROOT' '/' '/app'
30
+
31
+ # Document root do Apache
32
+ path_set 'DOCUMENT_ROOT' "$APP_ROOT" "$APP_ROOT"
33
+
34
+ # Composer
35
+ text_set 'COMPOSER_PATH' ''
36
+
37
+ # Laravel
38
+ text_set 'LARAVEL_PATH' ''
39
+
40
+ # Pear
41
+ text_set 'PEAR_PACKAGES' ''
42
+
43
+ # Execução do Apache
44
+ bool_set 'RUN_APACHE' true
@@ -0,0 +1,56 @@
1
+ #!/bin/bash
2
+
3
+ set -u
4
+ set -e
5
+
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
8
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
11
+ done
12
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
13
+ source "$DIR/init.sh"
14
+
15
+ function run_laravel() {
16
+ LARAVEL_DIR="$1"
17
+ infom "Executando migrações para \"$LARAVEL_DIR\"..."
18
+ until artisan_migrate "$LARAVEL_DIR"; do
19
+ if artisan_migrate_connection_error; then
20
+ infom "Banco de dados ainda não conectado. Tentando novamente em 1 segundo..."
21
+ sleep 1
22
+ else
23
+ infom "\"php artisan migrate\" falhou com código de retorno $LAST_ARTISAN_MIGRATE_RESULT"
24
+ cat "$ARTISAN_MIGRATE_LOG"
25
+ return 1
26
+ fi
27
+ done
28
+ echo "Banco de dados conectado"
29
+ echo "Log das migrações:"
30
+ cat "$ARTISAN_MIGRATE_LOG"
31
+ }
32
+
33
+ function artisan_migrate() {
34
+ artisan_migrate_with_result "$1" > "$ARTISAN_MIGRATE_LOG"
35
+ return $LAST_ARTISAN_MIGRATE_RESULT
36
+ }
37
+
38
+ function artisan_migrate_with_result() {
39
+ set +e
40
+ infom "Executando \"php artisan migrate\" em \"$1\"..."
41
+ (cd "$1"; php artisan migrate --no-interaction --force 2>&1)
42
+ LAST_ARTISAN_MIGRATE_RESULT=$?
43
+ set -e
44
+ }
45
+
46
+ function artisan_migrate_connection_error() {
47
+ grep -i 'Connection refused' "$ARTISAN_MIGRATE_LOG" > /dev/null 2> /dev/null
48
+ }
49
+
50
+ infom "Executando \"artisan migrate\" nos diretórios de \"$LARAVEL_PATH\"..."
51
+ IFSBAK="$IFS"
52
+ IFS=:
53
+ for LARAVEL_DIR in $LARAVEL_PATH; do
54
+ run_laravel "$(join_paths "$LARAVEL_DIR" "$APP_ROOT")"
55
+ done
56
+ IFS="$IFSBAK"
@@ -0,0 +1,45 @@
1
+ set -u
2
+ set -e
3
+
4
+ source "$AUX_ROOT/eac-bash-lib/init.sh"
5
+
6
+ function var_present_r() {
7
+ [[ -v "$1" ]] && [[ -n "${!1}" ]]
8
+ }
9
+
10
+ function bool_set() {
11
+ VARIABLE_NAME="$1"
12
+ DEFAULT_VALUE="$2"
13
+
14
+ RESULT="$DEFAULT_VALUE"
15
+ if var_present_r "$VARIABLE_NAME"; then
16
+ RESULT="${!VARIABLE_NAME}"
17
+ fi
18
+ export $VARIABLE_NAME="$(bool_s "$RESULT")"
19
+ }
20
+
21
+ function join_paths() {
22
+ PATH_ARG="$1"
23
+ BASE_ARG="$2"
24
+
25
+ if [[ "$PATH_ARG" == '/'* ]]; then
26
+ printf -- "%s\n" "$PATH_ARG"
27
+ else
28
+ printf -- "%s/%s\n" "$BASE_ARG" "$PATH_ARG"
29
+ fi
30
+ }
31
+
32
+ function path_set() {
33
+ VARIABLE_NAME="$1"
34
+ BASE_PATH="$2"
35
+ DEFAULT_VALUE="$3"
36
+
37
+ RESULT="$DEFAULT_VALUE"
38
+ if var_present_r "$VARIABLE_NAME"; then
39
+ RESULT="$(join_paths "${!VARIABLE_NAME}" "$BASE_PATH")"
40
+ fi
41
+ if [ ! -d "$RESULT" ]; then
42
+ fatal_error "Caminho \"$RESULT\" (\$$VARIABLE_NAME) não existe ou não é um diretório"
43
+ fi
44
+ export $VARIABLE_NAME="$RESULT"
45
+ }
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+
3
+ set -u
4
+ set -e
5
+
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
8
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
11
+ done
12
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
13
+ source "$DIR/init.sh"
14
+
15
+ function pear_install() {
16
+ PEAR_PACKAGE="$1"
17
+ infom "Instalando pacote pear \"$PEAR_PACKAGE\"..."
18
+ pear install "$PEAR_PACKAGE"
19
+ }
20
+
21
+ infom "Instalando pacotes Pear de \"\$PEAR_PACKAGES=$PEAR_PACKAGES\"..."
22
+ IFSBAK="$IFS"
23
+ IFS=:
24
+ for PEAR_PACKAGE in $PEAR_PACKAGES; do
25
+ pear_install "$PEAR_PACKAGE"
26
+ done
27
+ IFS="$IFSBAK"
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ set -u
4
+ set -e
5
+
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
8
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
11
+ done
12
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
13
+ source "$DIR/init.sh"
14
+
15
+ function run_composer() {
16
+ COMPOSER_DIR="$1"
17
+ infom "Executando \"composer install\" para \"$COMPOSER_DIR\"..."
18
+ COMPOSER_FILE="$(join_paths 'composer.json' "$COMPOSER_DIR")"
19
+ if [[ ! -f "$COMPOSER_FILE" ]]; then
20
+ fatal_error "Arquivo \"$COMPOSER_FILE\" (\$COMPOSER_PATH) não encontrado"
21
+ fi
22
+ composer install "--working-dir=$COMPOSER_DIR"
23
+ }
24
+
25
+ infom "Executando \"composer install\" nos diretórios de \"$COMPOSER_PATH\"..."
26
+ IFSBAK="$IFS"
27
+ IFS=:
28
+ for COMPOSER_DIR in $COMPOSER_PATH; do
29
+ run_composer "$(join_paths "$COMPOSER_DIR" "$APP_ROOT")"
30
+ done
31
+ IFS="$IFSBAK"
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ set -u
4
+ set -e
5
+
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
8
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
11
+ done
12
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
13
+ source "$DIR/init.sh"
14
+
15
+ infom "Configuração site Apache..."
16
+ template_apply "$TEMPLATES_ROOT/apache_site.conf" > '/etc/apache2/sites-available/000-default.conf'
@@ -0,0 +1,24 @@
1
+ #!/bin/bash
2
+
3
+ set -u
4
+ set -e
5
+
6
+ SOURCE="${BASH_SOURCE[0]}"
7
+ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
8
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
9
+ SOURCE="$(readlink "$SOURCE")"
10
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
11
+ done
12
+ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
13
+ source "$DIR/init.sh"
14
+
15
+ "$AUX_ROOT/config_banner.sh"
16
+ "$AUX_ROOT/setup_apache_site.sh"
17
+ "$AUX_ROOT/pear.sh"
18
+ "$AUX_ROOT/php_composer.sh"
19
+ "$AUX_ROOT/laravel.sh"
20
+ if bool_r "$RUN_APACHE"; then
21
+ "$AUX_ROOT/apache_foreground.sh"
22
+ else
23
+ infom 'Apache execution disabled'
24
+ fi
@@ -0,0 +1,12 @@
1
+ <VirtualHost *:80>
2
+ DocumentRoot %%DOCUMENT_ROOT%%
3
+
4
+ ErrorLog ${APACHE_LOG_DIR}/error.log
5
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
6
+
7
+ <Directory %%DOCUMENT_ROOT%%>
8
+ Options Indexes FollowSymLinks
9
+ AllowOverride All
10
+ Require all granted
11
+ </Directory>
12
+ </VirtualHost>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avmtrf1-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-09 00:00:00.000000000 Z
11
+ date: 2020-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -339,6 +339,17 @@ files:
339
339
  - lib/avmtrf1/tools/runner/php/docker.rb
340
340
  - lib/avmtrf1/tools/runner/red.rb
341
341
  - lib/avmtrf1/tools/version.rb
342
+ - template/avmtrf1/php/docker_image/Dockerfile.template
343
+ - template/avmtrf1/php/docker_image/aux/apache_foreground.sh
344
+ - template/avmtrf1/php/docker_image/aux/config_banner.sh
345
+ - template/avmtrf1/php/docker_image/aux/init.sh
346
+ - template/avmtrf1/php/docker_image/aux/laravel.sh
347
+ - template/avmtrf1/php/docker_image/aux/lib.sh
348
+ - template/avmtrf1/php/docker_image/aux/pear.sh
349
+ - template/avmtrf1/php/docker_image/aux/php_composer.sh
350
+ - template/avmtrf1/php/docker_image/aux/setup_apache_site.sh
351
+ - template/avmtrf1/php/docker_image/aux/start.sh
352
+ - template/avmtrf1/php/docker_image/aux/templates/apache_site.conf
342
353
  homepage: http://redmine.trf1.gov.br/projects/avm-trf1
343
354
  licenses: []
344
355
  metadata: {}