0% found this document useful (0 votes)
84 views3 pages

Whaticket Docker Configuration Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views3 pages

Whaticket Docker Configuration Guide

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

services:

whaticket_backend:
image: whaticket-backend:latest
depends_on:
- postgres_whaticket
- whaticket_redis

environment:
# POSTGRES
- DB_DIALECT=postgres
- DB_HOST=postgres_whaticket # postgres_whaticket
- DB_PORT=5432
- DB_USER=postgres
- DB_PASS=postgres # Configure sua senha do Postgres
- DB_NAME=whaticket
- TZ=America/Sao_Paulo

# BACKEND
- JWT_SECRET=kZaOTd+YZpjRUyyuQUpigJaEMk4vcW4YOymKPZX0Ts8= # Configure seu
segredo JWT
- JWT_REFRESH_SECRET=dBSXqFg9TaNUEDXVp6fhMTRLBysP+j2DSqf7+raxD3A= # Configure
seu refresh do segredo JWT
- PORT=3001
- PROXY_PORT=443
- BACKEND_URL=[Link] # Configure sua url do backend
- FRONTEND_URL=[Link] # Configure sua url do frontend
- CHROME_ARGS=--no-sandbox --disable-setuid-sandbox

# REDIS
- REDIS_URI=redis://:12345@whaticket_redis:6379 # Configure sua senha do
Redis(12345)
- REDIS_OPT_LIMITER_MAX=1
- REDIS_OPT_LIMITER_DURATION=3000

# GERENCIANET(SOMENTE PARA CONFIGURAR PAGAMENTOS)


- GERENCIANET_SANDBOX=false
- GERENCIANET_CLIENT_ID=
- GERENCIANET_CLIENT_SECRET=
- GERENCIANET_PIX_CERT=
- GERENCIANET_PIX_KEY=

# USER LIMIT
- USER_LIMIT=10000
- CONNECTIONS_LIMIT=100000
- CLOSED_SEND_BY_ME=true

# MAIL
- MAIL_HOST=[Link] # Configure seu servidor SMTP
- MAIL_USER=rafacpti@[Link] # Configure seu email
- MAIL_PASS=Ramel@2025 # Configure sua senha
- MAIL_FROM=Recuperar Senha <contato@[Link]> # Configure o remetente
- MAIL_PORT=587 # Configure a porta STMP
labels:
- "[Link]=true"
-
"[Link].whaticket_backend.rule=Host(`[Link]`)" #
Configure sua url do backend
- "[Link].whaticket_backend.entrypoints=websecure"
- "[Link].whaticket_backend.[Link]=leresolver"
-
"[Link].cors_backend.[Link]=https:/
/[Link]" # Configure sua url do frontend(Leve em consideração outras
origens para integrações)
-
"[Link].cors_backend.[Link]=GET,HEAD,P
UT,PATCH,POST,DELETE"
-
"[Link].cors_backend.[Link]=Origin, X-
Requested-With, Content-Type, Accept, Authorization"
-
"[Link].cors_backend.[Link]=true"
- "[Link].backend_headers.[Link].X-
Frame-Options=SAMEORIGIN"
- "[Link].backend_headers.[Link].X-
Content-Type-Options=nosniff"
- "[Link].backend_headers.[Link].X-
XSS-Protection=1; mode=block"
-
"[Link].backend_headers.[Link]-
Transport-Security=max-age=31536000; includeSubdomains;"
-
"[Link].backend_headers.[Link]-
Policy=no-referrer-when-downgrade"
-
"[Link].backend_headers.[Link]-
Control=no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"
- "[Link].backend_compress.compress=true"
-
"[Link].backend_body_size.[Link]=20971520"
# Arquivo máximo configurado para 20 MB
- "[Link].whaticket_backend.[Link]=3000"
-
"[Link].whaticket_backend.middlewares=cors_backend@docker,backend_hea
ders@docker,backend_compress@docker,backend_body_size@docker"
volumes:
- ./backend/public/:/usr/src/app/public/
restart: always
networks:
- typebot
ports:
- "3000:3000"
whaticket_frontend:
image: whaticket-frontend:latest
depends_on:
- whaticket_backend
environment:
- BACKEND_URL=[Link] # Configure sua url do backend
- REACT_APP_BACKEND_URL=[Link] # Configure sua url
do backend
- REACT_APP_HOURS_CLOSE_TICKETS_AUTO=24
labels:
- "[Link]=true"
- "[Link].whaticket_frontend.rule=Host(`[Link]`)"
# Configure sua url do frontend
- "[Link].whaticket_frontend.entrypoints=websecure"
- "[Link].whaticket_frontend.[Link]=leresolver"
- "[Link].frontend_headers.[Link].X-
Frame-Options=SAMEORIGIN"
- "[Link].frontend_headers.[Link].X-
Content-Type-Options=nosniff"
- "[Link].frontend_headers.[Link].X-
XSS-Protection=1; mode=block"
-
"[Link].frontend_headers.[Link]-
Transport-Security=max-age=31536000; includeSubdomains;"
-
"[Link].frontend_headers.[Link]-
Policy=no-referrer-when-downgrade"
-
"[Link].frontend_headers.[Link]-
Control=no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"
- "[Link].frontend_compress.compress=true"
-
"[Link].frontend_body_size.[Link]=20971520
" # Arquivo máximo configurado para 20 MB
- "[Link].whaticket_frontend.[Link]=3250"
-
"[Link].whaticket_frontend.middlewares=frontend_headers@docker,fronte
nd_compress@docker,frontend_body_size@docker"
restart: always
networks:
- typebot
ports:
- "3250:3250"

postgres_whaticket:
image: postgres:13
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=whaticket
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres # Configure sua senha do Postgres
- TZ=America/Sao_Paulo
restart: always
networks:
- typebot
ports:
- "5432:5432"

whaticket_redis:
image: redis:latest
command: redis-server --requirepass "12345" # Configure sua senha do Redis
volumes:
- redis-data:/data
restart: always
networks:
- typebot

networks:
typebot:
external: true

volumes:
postgres-data:
redis-data:

Common questions

Powered by AI

The MAIL configuration parameters, including MAIL_HOST, MAIL_USER, MAIL_PASS, MAIL_FROM, and MAIL_PORT, are essential for setting up SMTP email services in the Whaticket architecture. These parameters ensure that the backend can send emails for functionalities, such as user verification and password recovery. Proper configuration is critical for ensuring reliable email delivery and maintaining the integrity and security of outbound messages, as email systems are common vectors for security issues. They also support user engagement and operational communications within the platform .

The configuration for handling inbound HTTP request sizes in Whaticket, specified by 'backend_body_size.buffering.maxRequestBodyBytes=20971520' and similarly for the frontend, limits the maximum request body to 20 MB. This setting helps mitigate denial-of-service (DoS) attacks by preventing excessively large requests that could exhaust server resources. However, it balances performance needs, as too small a limit might prevent legitimate large requests, impacting functionality. Proper configuration ensures the system can efficiently handle expected traffic without vulnerability to resource-based attacks .

The use of volume mounts in the Whaticket Docker setup, such as `postgres-data:/var/lib/postgresql/data` and `redis-data:/data`, contributes significantly to data persistence by mapping container paths to persistent storage locations on the host system. This ensures that data remains available even after container restarts or updates, which is crucial for maintaining database consistency and cache data. By separating data from the container lifecycle, it enhances the system's reliability and simplifies data management, as data can be backed up and restored independently of the container states .

In the Whaticket infrastructure, JWT_SECRET and JWT_REFRESH_SECRET are used to sign and validate JSON Web Tokens (JWTs). JWT_SECRET secures the token against tampering, ensuring the payload's authenticity, while JWT_REFRESH_SECRET is used for refresh tokens that clients use to obtain new JWTs after expiration. Managing these secrets securely is crucial because exposure can lead to unauthorized access, allowing attackers to impersonate legitimate users. This security need is fulfilled by storing them securely, using environment variables, and regularly rotating them to minimize risk .

Docker networking in the Whaticket configuration utilizes a user-defined network called `typebot`, which is marked as external. This facilitates container-to-container communication for services like whaticket_backend, whaticket_frontend, postgres_whaticket, and whaticket_redis, ensuring they can communicate securely and correctly. By using a separate network, services are isolated from the host network, reducing potential security risks and ensuring that the services can only communicate with each other, which is crucial for managing microservices in a complex environment securely .

Using Traefik middlewares for compression and request handling in Whaticket offers several benefits, such as reduced bandwidth usage due to compression, improved response times, and enforcing security headers. The middleware, like `backend_compress` or `frontend_compress`, ensures data is transferred efficiently between the client and server. However, risks include potential over-compression leading to CPU overhead on the server, possibly degrading performance. Additionally, compression could make cryptographic security weaker if not properly configured, making it essential to optimize settings for both security and performance .

The Whaticket backend requires several key environment variables for configuration: - **DB_DIALECT, DB_HOST, DB_PORT, DB_USER, DB_PASS, DB_NAME**: These variables are critical for configuring the connection to the PostgreSQL database. DB_DIALECT specifies the database type, which is 'postgres'. DB_HOST and DB_PORT specify the host and port where the database is running. DB_USER and DB_PASS are used for authentication, while DB_NAME specifies the database name. - **JWT_SECRET, JWT_REFRESH_SECRET**: These are used for secure handling of JSON Web Tokens (JWT), ensuring authentication and authorization processes. - **REDIS_URI**: Specifies the connection string to the Redis instance, including authentication details, ensuring the backend can efficiently manage session data and other cache-like data. - **MAIL_HOST, MAIL_USER, MAIL_PASS, MAIL_FROM, MAIL_PORT**: These configure the SMTP settings, crucial for sending emails, such as password recovery or notifications. Each variable plays a specific role in ensuring communication and secure transactions between components of the Whaticket system .

The parameter REACT_APP_HOURS_CLOSE_TICKETS_AUTO, set to 24, in the Whaticket system automatically closes tickets that have been inactive for 24 hours. This automation helps streamline operations by reducing the workload on support staff who would otherwise manually close inactive tickets. It enhances user experience by ensuring outdated tickets don't clutter their interface, while also maintaining an up-to-date ticketing system. However, it requires careful communication to users to avoid confusion about ticket status, ensuring the automation aligns with user expectations and business rules .

Using a hardcoded password for the Redis instance in the Whaticket system poses significant security risks. A hardcoded password like '12345' can be easily compromised, granting unauthorized access to sensitive session and cache data. This weak practice violates security best practices, which recommend using environment variables to inject secrets, rotating passwords regularly, and utilizing tools like HashiCorp Vault for secret management. Such weaknesses could lead to data breaches and undermine the overall security posture of the system .

Traefik impacts the accessibility and security of the Whaticket services by managing how requests are routed and handled by adding critical HTTP headers for security. Traefik labels such as `traefik.enable`, `traefik.http.routers.whaticket_backend.rule`, and `traefik.http.routers.whaticket_backend.tls.certresolver` enable secure HTTPS routing by specifying the domain and handling TLS certificate resolution. Security headers including `X-Frame-Options`, `X-Content-Type-Options`, `Strict-Transport-Security`, `Cache-Control`, and `Referrer-Policy` enhance security by preventing clickjacking, sniffing, enforcing secure connections, controlling caching, and managing referrer information. These configurations enhance both secure access and protection against common web vulnerabilities .

You might also like