Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0608d29
feat (System) : Projeto
rdittmarbr Jun 5, 2025
c1bb196
chore (config) : Arquivos de configuracao do projeto
rdittmarbr Jun 5, 2025
85b05a0
feat (Docker) : Docker
rdittmarbr Jun 6, 2025
b581a82
feat (Docker) : Docker
rdittmarbr Jun 6, 2025
80da8fc
feat (DB:Estabelecimentos) : Tabela Estabelecimentos
rdittmarbr Jun 6, 2025
1962d04
feat (API) : Criacao da API gateway servicos BrasilApi e ViaCEP
rdittmarbr Jun 7, 2025
3546c8a
feat (Docker) : atualizacao do ambiente Docker
rdittmarbr Jun 8, 2025
3019c3e
feat (API) : Validacao do cache para servicos BrasilApi e ViaCEP
rdittmarbr Jun 8, 2025
07837fd
feat (Docker) : atualizacao do ambiente Docker
rdittmarbr Jun 8, 2025
590a4a3
feat (API:estabelecimentos) : CRUD API Estabelecimentos
rdittmarbr Jun 8, 2025
982dd3a
feat (env:development) : env desenvolvimento docker
rdittmarbr Jun 8, 2025
2eaf67b
feat (postman) : Arquivo do postman
rdittmarbr Jun 8, 2025
9b14c05
test (Estabelecimento) : Implementacao de testes
rdittmarbr Jun 8, 2025
9f65ae2
fix (Docker) : Redis - Mantendo todos os dados em memoria
rdittmarbr Jun 8, 2025
65b8c16
chore (readme.md) : Readme de instalacao e funcionalidades
rdittmarbr Jun 8, 2025
8107a74
feat (API) : Implementacao do Strategie Pattern
rdittmarbr Jun 9, 2025
b065488
test (API) : Implementacao do Strategie Pattern
rdittmarbr Jun 9, 2025
e3bb8be
chore (README.md) : Atualizacao do readme.md para incluir o objetivo …
rdittmarbr Jun 9, 2025
c11f059
chore (README.md) : Atualizacao do readme.md para incluir o objetivo …
rdittmarbr Jun 9, 2025
d455d3a
chore (README.md) : Atualizacao do readme.md para incluir o objetivo …
rdittmarbr Jun 9, 2025
dc22c51
chore (README.md) : Atualizacao do readme.md para incluir o objetivo …
rdittmarbr Jun 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .docker/Dockerfile.api.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM composer:latest AS composer_stage

FROM php:8.3-fpm

# Instala dependencias
RUN apt-get update && apt-get install -y \
git curl zip unzip libzip-dev libonig-dev libpq-dev \
&& docker-php-ext-install pdo pdo_pgsql zip \
&& pecl install redis \
&& docker-php-ext-enable redis

# Copia o Composer do stage anterior
COPY --from=composer_stage /usr/bin/composer /usr/bin/composer

# Copia o script de build
COPY .docker/build.sh /build.sh
RUN chmod +x /build.sh

# Define o diretório de trabalho
WORKDIR /var/www

EXPOSE 9000

CMD ["sh", "/build.sh"]
26 changes: 26 additions & 0 deletions .docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

APP_DIR="/var/www"

# Aguarda volume montado
while [ ! -d "$APP_DIR" ]; do
echo "Aguardando montagem de volume..."
sleep 1
done

cd "$APP_DIR" || exit 1

# Instala dependencias do Laravel se vendor não existir
if [ ! -d "vendor" ]; then
echo "Executando composer install..."
composer install --no-interaction --prefer-dist --optimize-autoloader
fi

# Gera cache se .env existir
if [ -f ".env" ]; then
php artisan config:cache
php artisan route:cache
fi

# Inicia o PHP-FPM
exec php-fpm
41 changes: 41 additions & 0 deletions .docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;

server {
listen 80;
server_name localhost;

root /var/www/public;
index index.php index.html;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}

location ~ /\.ht {
deny all;
}

error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
}
}
144 changes: 144 additions & 0 deletions .docker/pg17.pg_hba.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# ----------------------
# Authentication Records
# ----------------------
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#
# local DATABASE USER METHOD [OPTIONS]
# host DATABASE USER ADDRESS METHOD [OPTIONS]
# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
# hostgssenc DATABASE USER ADDRESS METHOD [OPTIONS]
# hostnogssenc DATABASE USER ADDRESS METHOD [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type:
# - "local" is a Unix-domain socket
# - "host" is a TCP/IP socket (encrypted or not)
# - "hostssl" is a TCP/IP socket that is SSL-encrypted
# - "hostnossl" is a TCP/IP socket that is not SSL-encrypted
# - "hostgssenc" is a TCP/IP socket that is GSSAPI-encrypted
# - "hostnogssenc" is a TCP/IP socket that is not GSSAPI-encrypted
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# database name, a regular expression (if it starts with a slash (/))
# or a comma-separated list thereof. The "all" keyword does not match
# "replication". Access to replication must be enabled in a separate
# record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", a
# regular expression (if it starts with a slash (/)) or a comma-separated
# list thereof. In both the DATABASE and USER fields you can also write
# a file name prefixed with "@" to include names from a separate file.
#
# ADDRESS specifies the set of hosts the record matches. It can be a
# host name, or it is made up of an IP address and a CIDR mask that is
# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# specifies the number of significant bits in the mask. A host name
# that starts with a dot (.) matches a suffix of the actual host name.
# Alternatively, you can write an IP address and netmask in separate
# columns to specify the set of hosts. Instead of a CIDR-address, you
# can write "samehost" to match any of the server's own IP addresses,
# or "samenet" to match any address in any subnet that the server is
# directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "scram-sha-256",
# "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert".
# Note that "password" sends passwords in clear text; "md5" or
# "scram-sha-256" are preferred since they send encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME=VALUE. The available options depend on the different
# authentication methods -- refer to the "Client Authentication"
# section in the documentation for a list of which options are
# available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# special characters must be quoted. Quoting one of the keywords
# "all", "sameuser", "samerole" or "replication" makes the name lose
# its special character, and just match a database or username with
# that name.
#
# ---------------
# Include Records
# ---------------
#
# This file allows the inclusion of external files or directories holding
# more records, using the following keywords:
#
# include FILE
# include_if_exists FILE
# include_dir DIRECTORY
#
# FILE is the file name to include, and DIR is the directory name containing
# the file(s) to include. Any file in a directory will be loaded if suffixed
# with ".conf". The files of a directory are ordered by name.
# include_if_exists ignores missing files. FILE and DIRECTORY can be
# specified as a relative or an absolute path, and can be double-quoted if
# they contain spaces.
#
# -------------
# Miscellaneous
# -------------
#
# This file is read on server startup and when the server receives a
# SIGHUP signal. If you edit the file on a running system, you have to
# SIGHUP the server for the changes to take effect, run "pg_ctl reload",
# or execute "SELECT pg_reload_conf()".
#
# ----------------------------------
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.

# CAUTION: Configuring the system for local "trust" authentication
# allows any local user to connect as any PostgreSQL user, including
# the database superuser. If you do not trust all your local users,
# use another authentication method.


# TYPE DATABASE USER ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust

# Replicacao
#host replication replicator 172.30.0.110/32 trust # replicacao
#host replication replicator 172.30.0.210/32 trust # BI

# Acesso pela rede local

host all all 192.168.0.0/24 md5
host all all 172.16.0.0/12 md5
host all all 172.30.0.0/24 md5

# Acesso a redes Docker (rede bridge padrão do Docker)
host all all 172.20.0.0/16 md5

# ---------------------------
# Acesso irrestrito
# ---------------------------
host all all 0.0.0.0/0 md5
147 changes: 147 additions & 0 deletions .docker/redis.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# redis.conf

# ----------------------------------------------------------------------------
# NETWORK
# ----------------------------------------------------------------------------

# By default, if no "bind" configuration directive is specified,
# Redis listens in all the network interfaces available on the server.
# In a container environment, binding to 0.0.0.0 is usually desired
# to allow access from other containers on the same network.
bind 0.0.0.0

# Protected mode is enabled by default. When protected mode is enabled,
# Redis only accepts connections from the loopback address (127.0.0.1).
# For production environments, you should disable protected mode and
# set a strong password using requirepass.
protected-mode no

# Accept connections on the specified port.
port 6379

# ----------------------------------------------------------------------------
# GENERAL
# ----------------------------------------------------------------------------

# Set the number of databases. The default database is DB 0.
databases 16

# Specify the server verbosity level.
# This can be one of:
# debug (a lot of information, useful for development/testing)
# verbose (many rarely useful info, but not as much as debug)
# notice (moderately verbose, good for production environments)
# warning (only very important / critical messages are logged)
loglevel notice

# Specify the log file name. Also "stdout" can be used to force
# Redis to log on the standard output.
logfile stdout

# ----------------------------------------------------------------------------
# SNAPSHOTTING (RDB Persistence)
# ----------------------------------------------------------------------------

# Save the DB on disk:
# save <seconds> <changes>
# Disable RDB persistence by commenting out all "save" lines.
# save 900 1 # Save if at least 1 key changed in 15 minutes
# save 300 10 # Save if at least 10 keys changed in 5 minutes
# save 60 10000 # Save if at least 10000 keys changed in 1 minute

# By default Redis will refuse to write on disk if running out of disk space.
stop-writes-on-bgsave-error yes

# Compress RDB files?
rdbcompression yes

# Store checksum for RDB files?
rdbchecksum yes

# The filename of the dump file.
dbfilename dump.rdb

# ----------------------------------------------------------------------------
# APPEND ONLY MODE (AOF Persistence)
# ----------------------------------------------------------------------------

# By default Redis asynchronously dumps the dataset on disk. This mode is
# good when your data is not critical and you can afford to lose a few
# seconds of data in case of a power outage, etc.
#
# Highly critical data sets may instead require a stronger guarantee that
# no data is lost. In order to obtain this in a usable way, Redis supports
# a fully durable mode called AOF (Append Only File).
#
# When AOF is enabled, every write operation received by the server is
# logged in the AOF file, using a format similar to the Redis protocol
# itself.
#
# It is strongly advised to use AOF + RDB persistence. In case of a crash,
# Redis will use the AOF file to recover the dataset, as it is usually
# the most complete one.
appendonly yes

# The name of the append only file (default: "appendonly.aof")
appendfilename "appendonly.aof"

# The fsync() system call tells the kernel to write data from the internal
# cache to disk. The three specified modes are:
# no: don't fsync, just put data in the kernel buffer. Faster.
# always: fsync every time new commands are appended to the AOF. Very slow.
# every: fsync every second. Compromise between speed and data safety.
appendfsync every

# When the AOF file becomes too big, Redis is able to automatically
# rewrite it in the background. The following two options configure the
# automatic rewrite:
# auto-aof-rewrite-percentage 100
# auto-aof-rewrite-min-size 64mb

# ----------------------------------------------------------------------------
# SECURITY
# ----------------------------------------------------------------------------

# Require a password to authenticate the clients.
# Please use a strong password.
# requirepass your_very_strong_password # <-- CHANGE THIS TO A REAL, STRONG PASSWORD!

# ----------------------------------------------------------------------------
# MEMORY MANAGEMENT
# ----------------------------------------------------------------------------

# Set a memory limit in bytes. When the memory limit is reached Redis
# will start removing keys according to the configured eviction policy.
# maxmemory <bytes> # Example: maxmemory 100mb

# Select the eviction policy to use when maxmemory is reached.
# Possible values are:
# volatile-lru -> Evict using approximated LRU among the keys with an expire set.
# allkeys-lru -> Evict using approximated LRU among all the keys.
# volatile-lfru -> Evict using approximated LFU among keys with an expire set.
# allkeys-lfru -> Evict using approximated LFU among all keys.
# volatile-random -> Remove random keys among keys with an expire set.
# allkeys-random -> Remove random keys among all keys.
# volatile-ttl -> Remove keys with the nearest expiration time (minor TTL)
# noeviction -> Don't evict anything, just return an error on write operations.
# maxmemory-policy noeviction

# ----------------------------------------------------------------------------
# LAZYFREEING
# ----------------------------------------------------------------------------

# Redis has two policies to free memory when needed:
# 1) Eager freeing: Immediately frees memory synchronously.
# 2) Lazy freeing: Defers memory freeing in a background thread.
# lazyfree-lazy-expire yes
# lazyfree-lazy-server-del yes
# lazyfree-lazy-eviction yes

# ----------------------------------------------------------------------------
# DOCKER
# ----------------------------------------------------------------------------

# In a Docker environment, setting 'supervised no' (the default) is typical.
# supervised no
# Or use systemd: supervised systemd
# Or use upstart: supervised upstart
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./data/development
Loading