Skip to content

Commit

Permalink
Merge pull request #7 from SoftagonSistemas/jaboatao-outubro
Browse files Browse the repository at this point in the history
removendo o redis
  • Loading branch information
hermesalvesbr authored Oct 11, 2024
2 parents c350b19 + 532655c commit fe21588
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 49 deletions.
32 changes: 19 additions & 13 deletions docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ services:
- ./docker-data/saas-files:/var/www/var/saas-files
- ./docker-data/sessions:/var/www/var/sessions
- ./docker-data/logs:/var/www/var/logs
# Adicionar o volume específico para o arquivo template.php
- ./custom/modules/:/var/www/src/modules/

links:
- db
- redis
ports:
- 8080:80
- 443:443
- 8080:80
- 443:443
depends_on:
- db
- redis
environment:
- REDIS_CACHE=redis
- REDIS_SESSION_PORT=6379
- SESSIONS_SAVE_PATH=tcp://redis:6379

db:
image: softagon/mapasculturais-db:latest
restart: unless-stopped
Expand All @@ -33,15 +38,16 @@ services:
- POSTGRES_DB=mapas
volumes:
- ./docker-data/db-data:/var/lib/postgresql/data
ports:
- 5433:5432

redis:
image: redis:6.2.14
restart: unless-stopped
ports:
- 5433:5432
## 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
- 6379:6379
volumes:
- redis_data:/data

# smtp:
# image: mailhog/mailhog
# ports:
# - "8025:8025"
volumes:
redis_data:
16 changes: 1 addition & 15 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,6 @@ RUN apt update && \
apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules wget git neovim -y && \
sed -i 's/ y / n /g' /etc/postfix/master.cf

# Instalando redis
ENV REDIS_VERSION=6.2.14
COPY docker/custom/redis-${REDIS_VERSION}.tar.gz /tmp/
RUN tar -xz -C /usr/src/ -f /tmp/redis-${REDIS_VERSION}.tar.gz && \
cd /usr/src/redis-${REDIS_VERSION}/ && \
make install && \
rm -rf /usr/src/redis-${REDIS_VERSION}

# Definindo variáveis de ambiente separadamente
ENV REDIS_CACHE=localhost
ENV REDIS_SESSION_PORT=6380
ENV SESSIONS_SAVE_PATH=tcp://localhost:${REDIS_SESSION_PORT}


# Instalando nginx
RUN apt install nginx -y &&\
ln -sf /dev/stderr /var/log/nginx/error.log &&\
Expand All @@ -72,4 +58,4 @@ COPY config/lgpd-terms /var/www/config/lgpd-terms
COPY docker/custom/entrypoint-custom.sh /tmp/entrypoint-custom.sh
RUN sed -i '/^set/a chown www-data:www-data /var/www/html -R' /entrypoint.sh &&\
sed -i '/^set/a /tmp/entrypoint-custom.sh' /entrypoint.sh &&\
chmod +x /tmp/entrypoint-custom.sh
chmod +x /tmp/entrypoint-custom.sh
22 changes: 1 addition & 21 deletions docker/custom/entrypoint-custom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,7 @@
echo "INICIANDO NGINX"
nginx

######### REDIS CACHE/SESSION #########

REDIS_SESSION_DIR=${REDIS_SESSION_DIR:-/var/www/var/sessions}

[ ! -e $REDIS_SESSION_DIR ] && mkdir $REDIS_SESSION_DIR || chmod o+rx $REDIS_SESSION_DIR -R
[ ! -e /etc/redis ] && mkdir /etc/redis || true

REDIS_CACHE_PORT=${REDIS_CACHE_PORT:-6379}
echo "INICIANDO REDIS-CACHE *:$REDIS_CACHE_PORT"
echo -e "daemonize yes\nprotected-mode no\nport $REDIS_CACHE_PORT\nmaxmemory 1256Mb\nmaxmemory-policy allkeys-lru\nlogfile /tmp/redis-cache.log\npidfile /var/run/redis-cache.pid" > /etc/redis/redis-cache.conf
redis-server /etc/redis/redis-cache.conf
tail -F /tmp/redis-cache.log &

REDIS_SESSION_PORT=${REDIS_SESSION_PORT:-6380}
echo "INICIANDO REDIS-SESSION *:$REDIS_SESSION_PORT - REDIS_SESSION_DIR:$REDIS_SESSION_DIR"
echo -e "daemonize yes\nprotected-mode no\nport $REDIS_SESSION_PORT\nmaxmemory 384Mb\nmaxmemory-policy allkeys-lru\ndir $REDIS_SESSION_DIR\nlogfile /tmp/redis-session.log\npidfile /var/run/redis-session.pid" > /etc/redis/redis-session.conf
redis-server /etc/redis/redis-session.conf
tail -F /tmp/redis-session.log &

######### SMTP ##########

RECIPIENT_RESTRICTIONS=static:OK

export SMTP_LOGIN SMTP_PASSWORD RECIPIENT_RESTRICTIONS
Expand Down Expand Up @@ -81,4 +61,4 @@ newaliases
echo "INICIANDO SMTP -> [$SMTP_HOST]:$SMTP_PORT"
rm -f /var/spool/postfix/pid/*.pid
postfix -c /etc/postfix start
tail -F /var/log/mail.log &
tail -F /var/log/mail.log &

0 comments on commit fe21588

Please sign in to comment.