Skip to content

Commit

Permalink
Creatind image Mapas environment
Browse files Browse the repository at this point in the history
  • Loading branch information
evertonkrystian committed Dec 28, 2023
1 parent 5668a3d commit 627391c
Show file tree
Hide file tree
Showing 33 changed files with 307 additions and 14 deletions.
35 changes: 35 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
BASE_URL=http://172.18.3.106/

APP_MODE=production
LOG_LEVEL=DEBUG
LOG_ENABLED=true

CEP_TOKEN=

MAILER_USER=
MAILER_SERVER=
MAILER_PROTOCOL=
MAILER_PORT=
MAILER_PASS=
MAILER_FROM=

# Usado para redirecionar todos os e-mails da plataforma para um email fixo,
# evitand envio de emails para os usuários
MAILER_ALWAYSTO=

DB_HOST=db
DB_NAME=mapas
DB_USER=mapas
DB_PASS=mapas
DB_VERSION=14

REDIS_CACHE=redis
SESSIONS_SAVE_PATH=tcp://sessions:6379
ACTIVE_THEME=Ceara

# as chaves abaixo são de desenvolvimento, precisam ser substituidas em ambiente de produção
GOOGLE_RECAPTCHA_SITEKEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
GOOGLE_RECAPTCHA_SECRET=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe

PENDING_PCACHE_RECREATION_INTERVAL=1
JOBS_INTERVAL=1
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ src/protected/application/themes/mapasculturais-*
src/protected/vendor
src/pub
src/assets
src/protected/application/themes/Ceara
compose/config.d/z.config.local.php
*.log
.idea
Expand Down
56 changes: 56 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[submodule "src/protected/application/plugins/MultipleLocalAuth"]
path = src/protected/application/plugins/MultipleLocalAuth
url = https://github.com/mapasculturais/plugin-MultipleLocalAuth
branch = master
[submodule "src/protected/application/plugins/AldirBlanc"]
path = src/protected/application/plugins/AldirBlanc
url = https://github.com/govce/plugin-AldirBlanc.git
branch = master
[submodule "src/protected/application/plugins/AldirBlancDataprev"]
path = src/protected/application/plugins/AldirBlancDataprev
url = https://github.com/govce/plugin-AldirBlancDataprev.git
branch = master
[submodule "src/protected/application/plugins/AldirBlancValidador"]
path = src/protected/application/plugins/AldirBlancValidador
url = https://github.com/govce/plugin-AldirBlancValidador.git
branch = master
[submodule "src/protected/application/plugins/AldirBlancValidadorFinanceiro"]
path = src/protected/application/plugins/AldirBlancValidadorFinanceiro
url = https://github.com/govce/plugin-AldirBlancValidadorFinanceiro.git
branch = master
[submodule "src/protected/application/plugins/RegistrationPayments"]
path = src/protected/application/plugins/RegistrationPayments
url = https://github.com/govce/plugin-RegistrationPayments.git
branch = master
[submodule "src/protected/application/plugins/RegistrationPaymentsAuxilio"]
path = src/protected/application/plugins/RegistrationPaymentsAuxilio
url = https://github.com/secultce/plugin-FinancialAssistance2021.git
branch = master
[submodule "src/protected/application/plugins/Report"]
path = src/protected/application/plugins/Report
url = https://github.com/secultce/plugin-reports-documentary-technical.git
branch = master
[submodule "src/protected/application/plugins/pwa"]
path = src/protected/application/plugins/pwa
url = https://github.com/govce/plugin-PWA.git
branch = master
[submodule "src/protected/application/plugins/ChatTawkto"]
path = src/protected/application/plugins/ChatTawkto
url = https://github.com/govce/plugin-ChatTawkto.git
branch = master
[submodule "src/protected/application/plugins/EvaluationMethodSeplag"]
path = src/protected/application/plugins/EvaluationMethodSeplag
url = https://github.com/secultce/plugin-EvaluationMethodSeplag.git
branch = master
[submodule "src/protected/application/plugins/Accessibility"]
path = src/protected/application/plugins/Accessibility
url = https://github.com/govce/plugin-Accessibility.git
branch = master
[submodule "src/protected/application/plugins/LocationStateCity"]
path = src/protected/application/plugins/LocationStateCity
url = https://github.com/secultce/plugin-LocationStateCity.git
branch = main
[submodule "src/protected/application/themes/Ceara"]
path = src/protected/application/themes/Ceara
url = https://github.com/secultce/theme-Ceara.git
branch = master
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libfreetype6-dev libjpeg62-turbo-dev libpng-dev less vim \
sudo

RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \
&& apt-get install -y nodejs

RUN rm -rf /var/lib/apt/lists
Expand All @@ -15,7 +15,9 @@ RUN rm -rf /var/lib/apt/lists
RUN npm install -g \
terser \
uglifycss \
autoprefixer
autoprefixer \
pnpm \
jake

# Install sass
RUN gem install sass -v 3.4.22
Expand Down Expand Up @@ -50,6 +52,7 @@ RUN pecl install -o -f redis \
COPY src/index.php /var/www/html/index.php
COPY src/protected/composer.json /var/www/html/protected/composer.json
COPY src/protected/composer.lock /var/www/html/protected/composer.lock
#COPY .env /.env

WORKDIR /var/www/html/protected
RUN composer.phar install
Expand All @@ -67,7 +70,7 @@ RUN find . -maxdepth 1 -mindepth 1 -exec echo "compilando sass do tema " {} \; -
COPY src/protected /var/www/html/protected

RUN mkdir -p /var/www/html/protected/DoctrineProxies
RUN chown -R www-data: /var/www/html/protected/DoctrineProxies
RUN chown -R www-data: /var/www/html/

RUN ln -s /var/www/html/protected/application/lib/postgis-restful-web-service-framework /var/www/html/geojson

Expand All @@ -76,7 +79,8 @@ COPY compose/production/php.ini /usr/local/etc/php/php.ini
COPY compose/config.php /var/www/html/protected/application/conf/config.php
COPY compose/config.d /var/www/html/protected/application/conf/config.d

RUN ln -s /var/www/html /var/www/src

WORKDIR /var/www/html

COPY version.txt /var/www/version.txt

Expand All @@ -88,4 +92,4 @@ ENTRYPOINT ["/entrypoint.sh"]
WORKDIR /var/www/html/
EXPOSE 9000

CMD ["php-fpm"]
CMD ["php-fpm"]
11 changes: 11 additions & 0 deletions addsubmodules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

#git submodule add -b master https://github.com/govce/plugin-AldirBlanc.git plugins/AldirBlanc

for i in $(cat submodules)
do
git submodule add -b $(echo $i | cut -d ";" -f 1) $(echo $i | cut -d ";" -f 2) $(echo $i | cut -d ";" -f 3)
# git submodule deinit -f $(echo $i | cut -d ";" -f 3)
# rm -rf .git/modules/$(echo $i | cut -d ";" -f 3)
# git rm -f $(echo $i | cut -d ";" -f 3)
done
2 changes: 1 addition & 1 deletion cli/src/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$_SERVER['SERVER_PORT'] = '8080';
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';

require __DIR__ . '../../../src/protected/application/bootstrap.php';
require '/var/www/html/protected/application/bootstrap.php';

require __DIR__ . '/McCli.php';

Expand Down
File renamed without changes.
76 changes: 76 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
version: '3'
services:
nginx:
image: nginx:latest
restart: unless-stopped
volumes:
- /dev/null:/var/www/html/index.php
- ./docker-data/public-files:/var/www/html/files
- ./docker-data/assets:/var/www/html/assets
##### versão sem ssl
- ./compose/production/nginx.conf:/etc/nginx/conf.d/default.conf

##### versão com ssl
# - ./compose/production/nginx-ssl.conf:/etc/nginx/conf.d/default.conf
# - ./docker-data/certs/conf:/etc/letsencrypt
# - ./docker-data/certs/www:/var/www/certbot
ports:
- "80:80"
- "443:443"
depends_on:
- mapas
links:
- mapas

mapas:
env_file:
- .env
image: secultceara/mapa:5.7.1
restart: unless-stopped
volumes:
- ./docker-data/assets:/var/www/html/assets
#- ./docker-data/public-files:/var/www/html/files
#- ./docker-data/private-files:/var/www/private-files
#- ./docker-data/saas-files:/var/www/SaaS
links:
- db
- redis
- sessions
depends_on:
- db
- redis
- sessions

redis:
image: redis:6
command: --maxmemory 256Mb --maxmemory-policy allkeys-lru
restart: unless-stopped

sessions:
image: redis:6
command: --maxmemory 384Mb --maxmemory-policy allkeys-lru
restart: unless-stopped
volumes:
- ./docker-data/sessions:/data

db:
image: postgis/postgis:14-master
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=mapas
- POSTGRES_USER=mapas
- POSTGRES_DB=mapas
volumes:
#- ./compose/db/dump.sql:/docker-entrypoint-initdb.d/dump.sql
- ./docker-data/db-data:/var/lib/postgresql/data


## Em ambiente de homologação pode ser uma boa ideia utilizar o mailhog para testar
## o envio de emails e também prevenir que emails de tete sejam disparados acidentalmente
## para os usuários no caso de o ambiente de homologação utilizar um banco de dados cópia
## de produção

# mailhog:
# image: mailhog/mailhog
# ports:
# - "8025:8025"
4 changes: 2 additions & 2 deletions scripts/compile-sass.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")/../" && pwd )"
BaseV1=$DIR/src/protected/application/themes/BaseV1/assets
BaseV1=$DIR/protected/application/themes/BaseV1/assets

if [ $1 ]; then
DOMAIN=$1
Expand All @@ -17,7 +17,7 @@ else
fi

CDIR=$( pwd )
cd $DIR/src/protected/tools/
cd $DIR/protected/tools/

ASSETS_FOLDER=$(MAPASCULTURAIS_CONFIG_FILE=$CONFIG HTTP_HOST=$DOMAIN REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php get-theme-assets-path.php)

Expand Down
2 changes: 1 addition & 1 deletion scripts/db-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ else
CONFIG=config.php
fi

MAPASCULTURAIS_CONFIG_FILE=$CONFIG HTTP_HOST=$DOMAIN REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php ../src/protected/tools/apply-updates.php $SAVE_LOG
MAPASCULTURAIS_CONFIG_FILE=$CONFIG HTTP_HOST=$DOMAIN REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php protected/tools/apply-updates.php $SAVE_LOG
2 changes: 1 addition & 1 deletion scripts/execute-job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ CDIR=$( pwd )

cd $DIR

REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' HTTP_HOST=localhost SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php ../src/protected/tools/execute-job.php
REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' HTTP_HOST=localhost SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php /var/www/html/protected/tools/execute-job.php

cd $CDIR
4 changes: 2 additions & 2 deletions scripts/mc-db-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ COUNTER=0
while [ $COUNTER -lt $NUM_PROCESSES ]; do
let COUNTER=COUNTER+1
if [ $NUM_PROCESSES -eq 1 ]; then
MAPASCULTURAIS_CONFIG_FILE=$CONFIG HTTP_HOST=$DOMAIN REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php src/protected/tools/apply-multicore-db-update.php $NUM_PROCESSES $COUNTER "$NAME"
MAPASCULTURAIS_CONFIG_FILE=$CONFIG HTTP_HOST=$DOMAIN REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php /var/www/html/protected/tools/apply-multicore-db-update.php $NUM_PROCESSES $COUNTER "$NAME"
else
MAPASCULTURAIS_CONFIG_FILE=$CONFIG HTTP_HOST=$DOMAIN REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php src/protected/tools/apply-multicore-db-update.php $NUM_PROCESSES $COUNTER "$NAME"&
MAPASCULTURAIS_CONFIG_FILE=$CONFIG HTTP_HOST=$DOMAIN REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php /var/www/html/protected/tools/apply-multicore-db-update.php $NUM_PROCESSES $COUNTER "$NAME"&
fi
done
2 changes: 1 addition & 1 deletion scripts/recreate-pending-pcache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ CDIR=$( pwd )

cd $DIR

LOG_HOOK=true REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php ../src/protected/tools/recreate-pending-pcache.php
LOG_HOOK=true REQUEST_METHOD='CLI' REMOTE_ADDR='127.0.0.1' REQUEST_URI='/' SERVER_NAME=127.0.0.1 SERVER_PORT="8000" php /var/www/html/protected/tools/recreate-pending-pcache.php

cd $CDIR
1 change: 1 addition & 0 deletions src/protected/application/conf/conf-base.d/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
'EvaluationMethodSimple' => ['namespace' => 'EvaluationMethodSimple'],
'EvaluationMethodDocumentary' => ['namespace' => 'EvaluationMethodDocumentary'],
'EvaluationMethodQualification' => ['namespace' => 'EvaluationMethodQualification'],
'MultipleLocalAuth' => [ 'namespace' => 'MultipleLocalAuth' ]
]
];
13 changes: 13 additions & 0 deletions src/protected/application/conf/conf-common.d/0.main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
'app.siteName' => 'Mapas Culturais Base Project',
'app.siteDescription' => 'O Mapas Culturais é uma plataforma colaborativa que reúne informações sobre agentes, espaços, eventos, projetos culturais e oportunidades',

// Define o tema ativo no site principal. Deve ser informado o namespace do tema e neste deve existir uma classe Theme.
'themes.active' => 'MapasCulturais\Themes\BaseV1',

// Ids dos selos verificadores. Para utilizar múltiplos selos informe os ids separados por vírgula.
'app.verifiedSealsIds' => '1',

];
16 changes: 16 additions & 0 deletions src/protected/application/conf/conf-common.d/maps.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

return [
'maps.center' => [
-14.2400732, //latitude
-53.1805018 // longitude
],

'maps.zoom.default' => 5,
'maps.zoom.approximate' => 14,
'maps.zoom.precise' => 16,
'maps.zoom.max' => 18,
'maps.zoom.min' => 5,

'maps.tileServer' => '//{s}.tile.osm.org/{z}/{x}/{y}.png',
];
12 changes: 12 additions & 0 deletions src/protected/application/conf/conf-common.d/plugins.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

return [
'plugins' => [
'EvaluationMethodTechnical' => ['namespace' => 'EvaluationMethodTechnical', 'config' => ['step' => 0.5]],
'EvaluationMethodSimple' => ['namespace' => 'EvaluationMethodSimple'],
'EvaluationMethodDocumentary' => ['namespace' => 'EvaluationMethodDocumentary'],

'MultipleLocalAuth' => [ 'namespace' => 'MultipleLocalAuth' ],
'SamplePlugin' => ['namespace' => 'SamplePlugin'],
]
];
Loading

0 comments on commit 627391c

Please sign in to comment.