Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SACI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bruno Fernandes
SACI
Commits
2adb316e
Commit
2adb316e
authored
Dec 04, 2024
by
Márcio Adriano Siqueira Simão
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Corrige ambiente Docker dev
parent
d52247e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
181 additions
and
174 deletions
+181
-174
index.php
backend/web/index.php
+34
-30
main.php
common/config/main.php
+130
-129
docker-compose.yml
docker-compose.yml
+9
-13
Dockerfile
docker/Dockerfile
+8
-2
No files found.
backend/web/index.php
View file @
2adb316e
<?php
$GLOBALS
[
'arrIpDev'
]
=
[
'172.17.8.10'
=>
[
'victor.oliveira@basis.gov.br'
=>
'Victor Basis'
],
'172.17.8.13'
=>
[
'bernhar.coimbra@basis.gov.br'
=>
'Bernhar Basis'
],
'172.17.8.21'
=>
[
'andre.andrade@basis.gov.br'
=>
'Andre Basis'
],
'172.17.8.168'
=>
[
'matheus.aguiar@basis.gov.br'
=>
'Matheus Basis'
],
'172.17.8.170'
=>
[
'edvan.targino@basis.gov.br'
=>
'Edvan Basis'
],
];
// Servidor Local
$strEnv
=
(
(
strpos
(
$_SERVER
[
'PHP_SELF'
],
'saci-hmg'
)
!==
false
)
||
(
in_array
(
$_SERVER
[
'SERVER_ADDR'
],
array_keys
(
$GLOBALS
[
'arrIpDev'
])))
)
?
'dev'
:
'prod'
;
$isDebug
=
((
$strEnv
==
'dev'
)
||
(
in_array
(
$_SERVER
[
'REMOTE_ADDR'
],
array_keys
(
$GLOBALS
[
'arrIpDev'
]))));
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
$strEnv
);
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
$isDebug
);
require
(
__DIR__
.
'/../../vendor/autoload.php'
);
require
(
__DIR__
.
'/../../vendor/yiisoft/yii2/Yii.php'
);
require
(
__DIR__
.
'/../../common/config/bootstrap.php'
);
$config
=
require
(
__DIR__
.
'/../../common/config/main.php'
);
$application
=
new
yii\web\Application
(
$config
);
<?php
$GLOBALS
[
'arrIpDev'
]
=
[
'172.17.8.10'
=>
[
'victor.oliveira@basis.gov.br'
=>
'Victor Basis'
],
'172.17.8.13'
=>
[
'bernhar.coimbra@basis.gov.br'
=>
'Bernhar Basis'
],
'172.17.8.21'
=>
[
'andre.andrade@basis.gov.br'
=>
'Andre Basis'
],
'172.17.8.168'
=>
[
'matheus.aguiar@basis.gov.br'
=>
'Matheus Basis'
],
'172.17.8.170'
=>
[
'edvan.targino@basis.gov.br'
=>
'Edvan Basis'
],
'172.17.0.5'
=>
[
'marcio.rafael@websis.com.br'
=>
'Márcio Rafael'
],
'172.19.0.5'
=>
[
'teste@websis.com.br'
=>
'Fabrica'
]
];
// Servidor Local
$strEnv
=
(
(
strpos
(
$_SERVER
[
'PHP_SELF'
],
'saci-hmg'
)
!==
false
)
||
(
in_array
(
$_SERVER
[
'SERVER_ADDR'
],
array_keys
(
$GLOBALS
[
'arrIpDev'
])))
||
(
$_SERVER
[
'SERVER_NAME'
]
==
'localhost'
)
||
(
isset
(
$_SERVER
[
'YII_ENV'
])
&&
$_SERVER
[
'YII_ENV'
]
==
'fabrica_dev'
)
)
?
'dev'
:
'prod'
;
$isDebug
=
(
$strEnv
==
'dev'
)
||
(
in_array
(
$_SERVER
[
'REMOTE_ADDR'
],
array_keys
(
$GLOBALS
[
'arrIpDev'
])));
defined
(
'YII_ENV'
)
or
define
(
'YII_ENV'
,
$strEnv
);
defined
(
'YII_DEBUG'
)
or
define
(
'YII_DEBUG'
,
$isDebug
);
require
(
__DIR__
.
'/../../vendor/autoload.php'
);
require
(
__DIR__
.
'/../../vendor/yiisoft/yii2/Yii.php'
);
require
(
__DIR__
.
'/../../common/config/bootstrap.php'
);
$config
=
require
(
__DIR__
.
'/../../common/config/main.php'
);
$application
=
new
yii\web\Application
(
$config
);
$application
->
run
();
\ No newline at end of file
common/config/main.php
View file @
2adb316e
<?php
// Yii::setAlias('@backend',dirname(dirname(__DIR__)) .'/backend');
$params
=
require
(
__DIR__
.
'/params.php'
);
$db
=
getDbName
();
if
(
YII_ENV
!=
'prod'
)
{
$arrConfDb
=
[
'class'
=>
'yii\db\Connection'
,
'dsn'
=>
"pgsql:host=
{
$db
}
;dbname=corporativo_trei"
,
'username'
=>
'sys.saci'
,
'password'
=>
'saci'
,
'charset'
=>
'utf8'
,
];
}
else
{
$arrConfDb
=
[
'class'
=>
'yii\db\Connection'
,
'dsn'
=>
"pgsql:host=
{
$db
}
;dbname=corporativo"
,
'username'
=>
'sys.saci'
,
'password'
=>
'saci'
,
'charset'
=>
'utf8'
,
];
}
$config
=
[
'id'
=>
'app-backend'
,
'name'
=>
$params
[
'name'
],
'params'
=>
$params
,
'basePath'
=>
dirname
(
__DIR__
)
.
'/../backend'
,
'controllerNamespace'
=>
'backend\controllers'
,
'bootstrap'
=>
[],
'timeZone'
=>
'America/Sao_Paulo'
,
'language'
=>
'pt-BR'
,
'sourceLanguage'
=>
'en-US'
,
'vendorPath'
=>
dirname
(
dirname
(
__DIR__
))
.
'/vendor'
,
'modules'
=>
[
'gridview'
=>
[
'class'
=>
'\kartik\grid\Module'
,
],
],
'components'
=>
[
'db'
=>
$arrConfDb
,
'request'
=>
[
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey'
=>
'4yrIZvJXHImhxTJ3BqhZTYxLu2GIiGrK'
,
],
'user'
=>
[
'identityClass'
=>
'common\models\sistema\SistemaTabUsuarios'
,
'enableAutoLogin'
=>
true
,
],
'errorHandler'
=>
[
'errorAction'
=>
'site/falta'
,
],
'cache'
=>
[
'class'
=>
'yii\caching\FileCache'
,
],
'assetManager'
=>
[
'class'
=>
'yii\web\AssetManager'
,
'forceCopy'
=>
((
YII_ENV
!=
'prod'
)
&&
YII_DEBUG
),
//'appendTimestamp' => true,
],
'mailer'
=>
[
'class'
=>
'yii\swiftmailer\Mailer'
,
'viewPath'
=>
'@common/mail'
,
'useFileTransport'
=>
false
,
'transport'
=>
[
'class'
=>
'Swift_SmtpTransport'
,
'host'
=>
'cas-mi.integracao.gov.br'
,
// 'username' => 'saciweb@cidades.gov.br',
// 'password' => 's1c$w3b0',
'port'
=>
'25'
,
'encryption'
=>
''
,
],
],
'i18n'
=>
[
'translations'
=>
[
'yii'
=>
[
'class'
=>
'yii\i18n\PhpMessageSource'
,
'basePath'
=>
"@vendor/yiisoft/yii2/messages"
,
'sourceLanguage'
=>
'en-US'
,
// 'basePath' => '@app/messages',
// 'fileMap' => [
// 'yii' => 'yii.php',
// ]
],
],
],
'formatter'
=>
[
'defaultTimeZone'
=>
'America/Sao_Paulo'
,
'dateFormat'
=>
'php:Y-m-d H:i:s'
,
'datetimeFormat'
=>
'php:Y-m-d H:i:s'
,
'currencyCode'
=>
'BRL'
,
//'currencyCode' => ' ',
'decimalSeparator'
=>
','
,
'thousandSeparator'
=>
'.'
,
'locale'
=>
'pt-BR'
,
'nullDisplay'
=>
'-'
,
'numberFormatterOptions'
=>
[
NumberFormatter
::
MIN_FRACTION_DIGITS
=>
2
,
NumberFormatter
::
MAX_FRACTION_DIGITS
=>
2
,
],
],
],
];
if
(
!
isset
(
$config
[
'bootstrap'
]))
{
$config
[
'bootstrap'
]
=
[];
}
if
(
YII_DEBUG
)
{
$config
[
'bootstrap'
][]
=
'debug'
;
$config
[
'modules'
][
'debug'
][
'class'
]
=
'yii\debug\Module'
;
$config
[
'modules'
][
'debug'
][
'allowedIPs'
]
=
array_merge
([
'127.0.0.1'
],
array_keys
(
$params
[
'arrIpDev'
]));
$config
[
'bootstrap'
][]
=
'gii'
;
$config
[
'modules'
][
'gii'
][
'class'
]
=
'yii\gii\Module'
;
$config
[
'modules'
][
'gii'
][
'allowedIPs'
]
=
array_merge
([
'127.0.0.1'
],
array_keys
(
$params
[
'arrIpDev'
]));
$config
[
'bootstrap'
][]
=
'log'
;
$config
[
'components'
][
'log'
]
=
[
'traceLevel'
=>
YII_DEBUG
?
3
:
0
,
'targets'
=>
[
[
'class'
=>
'yii\log\FileTarget'
,
'levels'
=>
[
'error'
,
'warning'
],
],
],
];
}
return
$config
;
<?php
// Yii::setAlias('@backend',dirname(dirname(__DIR__)) .'/backend');
$params
=
require
(
__DIR__
.
'/params.php'
);
$db
=
getDbName
();
if
(
YII_ENV
!=
'prod'
)
{
$arrConfDb
=
[
'class'
=>
'yii\db\Connection'
,
'dsn'
=>
"pgsql:host=192.168.10.113;dbname=corporativo"
,
'username'
=>
'postgres'
,
'password'
=>
'pg01'
,
'charset'
=>
'utf8'
];
}
else
{
$arrConfDb
=
[
'class'
=>
'yii\db\Connection'
,
'dsn'
=>
"pgsql:host=
{
$db
}
;dbname=corporativo"
,
'username'
=>
'sys.saci'
,
'password'
=>
'saci'
,
'charset'
=>
'utf8'
];
}
$config
=
[
'id'
=>
'app-backend'
,
'name'
=>
$params
[
'name'
],
'params'
=>
$params
,
'basePath'
=>
dirname
(
__DIR__
)
.
'/../backend'
,
'controllerNamespace'
=>
'backend\controllers'
,
'bootstrap'
=>
[],
'timeZone'
=>
'America/Sao_Paulo'
,
'language'
=>
'pt-BR'
,
'sourceLanguage'
=>
'en-US'
,
'vendorPath'
=>
dirname
(
dirname
(
__DIR__
))
.
'/vendor'
,
'modules'
=>
[
'gridview'
=>
[
'class'
=>
'\kartik\grid\Module'
]
],
'components'
=>
[
'db'
=>
$arrConfDb
,
'request'
=>
[
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey'
=>
'4yrIZvJXHImhxTJ3BqhZTYxLu2GIiGrK'
],
'user'
=>
[
'identityClass'
=>
'common\models\sistema\SistemaTabUsuarios'
,
'enableAutoLogin'
=>
true
],
'errorHandler'
=>
[
'errorAction'
=>
'site/falta'
],
'cache'
=>
[
'class'
=>
'yii\caching\FileCache'
],
'assetManager'
=>
[
'class'
=>
'yii\web\AssetManager'
,
'forceCopy'
=>
((
YII_ENV
!=
'prod'
)
&&
YII_DEBUG
)
//'appendTimestamp' => true
],
'mailer'
=>
[
'class'
=>
'yii\swiftmailer\Mailer'
,
'viewPath'
=>
'@common/mail'
,
'useFileTransport'
=>
false
,
'transport'
=>
[
'class'
=>
'Swift_SmtpTransport'
,
'host'
=>
'mail-apl.serpro.gov.br'
,
'username'
=>
'saciweb@cidades.gov.br'
,
'password'
=>
's1c$w3b0'
,
'port'
=>
'25'
,
'encryption'
=>
''
]
],
'i18n'
=>
[
'translations'
=>
[
'yii'
=>
[
'class'
=>
'yii\i18n\PhpMessageSource'
,
'basePath'
=>
"@vendor/yiisoft/yii2/messages"
,
'sourceLanguage'
=>
'en-US'
// 'basePath' => '@app/messages',
// 'fileMap' => [
// 'yii' => 'yii.php',
// ]
]
]
],
'formatter'
=>
[
'defaultTimeZone'
=>
'America/Sao_Paulo'
,
'dateFormat'
=>
'php:Y-m-d H:i:s'
,
'datetimeFormat'
=>
'php:Y-m-d H:i:s'
,
//'currencyCode' => 'R$ ',
'currencyCode'
=>
'BRL'
,
'decimalSeparator'
=>
','
,
'thousandSeparator'
=>
'.'
,
'locale'
=>
'pt-BR'
,
'nullDisplay'
=>
'-'
,
'numberFormatterOptions'
=>
[
NumberFormatter
::
MIN_FRACTION_DIGITS
=>
2
,
NumberFormatter
::
MAX_FRACTION_DIGITS
=>
2
]
]
]
];
if
(
!
isset
(
$config
[
'bootstrap'
]))
{
$config
[
'bootstrap'
]
=
[];
}
if
(
YII_DEBUG
)
{
$config
[
'bootstrap'
][]
=
'debug'
;
$config
[
'modules'
][
'debug'
][
'class'
]
=
'yii\debug\Module'
;
$config
[
'modules'
][
'debug'
][
'allowedIPs'
]
=
array_merge
([
'127.0.0.1'
],
array_keys
(
$params
[
'arrIpDev'
]));
$config
[
'bootstrap'
][]
=
'gii'
;
$config
[
'modules'
][
'gii'
][
'class'
]
=
'yii\gii\Module'
;
$config
[
'modules'
][
'gii'
][
'allowedIPs'
]
=
array_merge
([
'127.0.0.1'
],
array_keys
(
$params
[
'arrIpDev'
]));
$config
[
'bootstrap'
][]
=
'log'
;
$config
[
'components'
][
'log'
]
=
[
'traceLevel'
=>
YII_DEBUG
?
3
:
0
,
'targets'
=>
[
[
'class'
=>
'yii\log\FileTarget'
,
'levels'
=>
[
'error'
,
'warning'
]
]
]
];
}
return
$config
;
\ No newline at end of file
docker-compose.yml
View file @
2adb316e
saci
:
# replace username/repo:tag with your name and image details
build
:
docker
container_name
:
php-saci
ports
:
-
"
83:80"
volumes
:
-
./:/var/www/html
services
:
saci
:
# replace username/repo:tag with your name and image details
build
:
docker
container_name
:
php-saci
ports
:
-
"
8081:80"
volumes
:
-
./:/var/www/html
\ No newline at end of file
docker/Dockerfile
View file @
2adb316e
FROM
yiisoftware/yii2-php:5.6-apache
RUN
docker-php-ext-install zip
\
# Install required libraries for PHP extensions and configure PHP
RUN
apt-get update
&&
apt-get
install
-y
\
libzip-dev
\
zlib1g-dev
\
libpq-dev
\
&&
docker-php-ext-install zip
\
&&
docker-php-ext-install pdo pdo_pgsql pgsql
\
&&
docker-php-ext-install mbstring
\
&&
sed
-i
's/^error_reporting/;error_reporting/g'
/usr/local/etc/php/conf.d/base.ini
&&
sed
-i
's/^error_reporting/;error_reporting/g'
/usr/local/etc/php/conf.d/base.ini
\
&&
apt-get clean
&&
rm
-rf
/var/lib/apt/lists/
*
COPY
./apache_default /etc/apache2/sites-enabled/000-default.conf
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment