-
Notifications
You must be signed in to change notification settings - Fork 85
Fix/send webhook newsletter group #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b56692e
57d10a5
c9de089
09e17e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| version: '3.8' | ||
|
|
||
| services: | ||
| evolution-go: | ||
| build: | ||
| context: . | ||
| dockerfile: Dockerfile | ||
| container_name: evolution-go | ||
| restart: unless-stopped | ||
| ports: | ||
| - "8080:8080" | ||
| env_file: | ||
| - .env | ||
| volumes: | ||
| - evolution_data:/app/dbdata | ||
| - evolution_logs:/app/logs | ||
| networks: | ||
| - evolution_network | ||
| depends_on: | ||
| - postgres | ||
| - rabbitmq | ||
| - minio | ||
|
|
||
| postgres: | ||
| image: postgres:15-alpine | ||
| container_name: postgres | ||
| restart: unless-stopped | ||
| environment: | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: root | ||
| POSTGRES_DB: postgres | ||
| ports: | ||
| - "5432:5432" | ||
| volumes: | ||
| - postgres_data:/var/lib/postgresql/data | ||
| - ./docker/examples/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql | ||
| networks: | ||
| - evolution_network | ||
|
|
||
| rabbitmq: | ||
| image: rabbitmq:3-management-alpine | ||
| container_name: rabbitmq | ||
| restart: unless-stopped | ||
| environment: | ||
| RABBITMQ_DEFAULT_USER: admin | ||
| RABBITMQ_DEFAULT_PASS: admin | ||
| RABBITMQ_DEFAULT_VHOST: default | ||
| ports: | ||
| - "5672:5672" | ||
| - "15672:15672" | ||
| volumes: | ||
| - rabbitmq_data:/var/lib/rabbitmq | ||
| networks: | ||
| - evolution_network | ||
|
|
||
| minio: | ||
| image: minio/minio:latest | ||
| container_name: minio | ||
| restart: unless-stopped | ||
| command: server /data --console-address ":9001" | ||
| environment: | ||
| MINIO_ROOT_USER: minioadmin | ||
| MINIO_ROOT_PASSWORD: minioadmin | ||
| ports: | ||
| - "9000:9000" | ||
| - "9001:9001" | ||
| volumes: | ||
| - minio_data:/data | ||
| networks: | ||
| - evolution_network | ||
|
|
||
| volumes: | ||
| evolution_data: | ||
| driver: local | ||
| evolution_logs: | ||
| driver: local | ||
| postgres_data: | ||
| driver: local | ||
| rabbitmq_data: | ||
| driver: local | ||
| minio_data: | ||
| driver: local | ||
|
|
||
| networks: | ||
| evolution_network: | ||
| driver: bridge |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Output colors | ||
| GREEN='\033[0;32m' | ||
| BLUE='\033[0;34m' | ||
| YELLOW='\033[1;33m' | ||
| RED='\033[0;31m' | ||
| NC='\033[0m' # No Color | ||
|
|
||
| echo -e "${BLUE}=== Initializing Evolution Go via Docker ===${NC}\n" | ||
|
|
||
| # 1. Update git submodules (fixes empty folder error in whatsmeow-lib) | ||
| echo -e "${YELLOW}[1/4] Preparing dependencies (git submodules)...${NC}" | ||
| git submodule update --init --recursive | ||
| if [ $? -ne 0 ]; then | ||
| echo -e "${RED}Error initializing submodules. Please check if git is installed.${NC}" | ||
| exit 1 | ||
| fi | ||
| echo -e "${GREEN}Dependencies prepared successfully!${NC}\n" | ||
|
|
||
| # 2. Create .env file if it doesn't exist | ||
| echo -e "${YELLOW}[2/4] Configuring environment variables...${NC}" | ||
| if [ ! -f .env ]; then | ||
| if [ -f .env.example ]; then | ||
| cp .env.example .env | ||
|
|
||
| # Automatically adjust for Docker Compose | ||
| sed -i 's/localhost:5432/postgres:5432/g' .env | ||
| sed -i 's/localhost:5672/rabbitmq:5672/g' .env | ||
| sed -i 's/localhost:9000/minio:9000/g' .env | ||
|
Comment on lines
+28
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Using On GNU sed |
||
|
|
||
| echo -e "${GREEN}.env file created from .env.example and adjusted for Docker!${NC}\n" | ||
| else | ||
| echo -e "${RED}.env.example file not found!${NC}" | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo -e "${GREEN}.env file already exists, keeping current configuration.${NC}\n" | ||
| fi | ||
|
|
||
| # 3. Build and start containers via Docker Compose | ||
| echo -e "${YELLOW}[3/4] Building image and starting containers (This may take a few minutes)...${NC}" | ||
| if command -v docker-compose &> /dev/null; then | ||
| docker-compose up -d --build | ||
| elif docker compose version &> /dev/null; then | ||
| docker compose up -d --build | ||
| else | ||
| echo -e "${RED}Docker Compose not found. Please install Docker Compose first.${NC}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ $? -ne 0 ]; then | ||
| echo -e "${RED}Error starting Docker containers.${NC}" | ||
| exit 1 | ||
| fi | ||
| echo -e "${GREEN}Containers started successfully!${NC}\n" | ||
|
|
||
| # 4. Finalization | ||
| echo -e "${BLUE}=== All set! ===${NC}" | ||
| echo -e "Evolution Go and its dependencies are running in the background." | ||
| echo -e "\nServices available:" | ||
| echo -e "- Evolution Go API: ${GREEN}http://localhost:8080${NC}" | ||
| echo -e "- Swagger Docs: ${GREEN}http://localhost:8080/swagger/index.html${NC}" | ||
| echo -e "- Manager UI: ${GREEN}http://localhost:8080/manager/login${NC}" | ||
| echo -e "- RabbitMQ Admin: ${GREEN}http://localhost:15672${NC} (admin/admin)" | ||
| echo -e "- MinIO Console: ${GREEN}http://localhost:9001${NC} (minioadmin/minioadmin)" | ||
| echo -e "\nTo view API logs, run:" | ||
| echo -e "${YELLOW}docker compose logs -f evolution-go${NC}" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Error filtering based on substrings in
err.Error()is brittle and may miss or misclassify network errors.Using
strings.Contains(err.Error(), "no such host")/"connection refused"hard-codes behavior to specific message text, which can differ by OS, Go version, or localization and may change over time. This can cause relevant errors to be hidden or misclassified. Prefer checking concrete error types instead, e.g. usingerrors.Iswithsyscall.ECONNREFUSEDor asserting to*net.OpError/net.Errorand inspecting the underlying cause so DNS/connection issues are handled reliably without relying on message strings.Suggested implementation:
To make this compile and fully integrate:
pkg/telemetry/telemetry.go:errorsnetossyscallstringsimport if it is only used in the removedstrings.Containschecks.returncorrectly exits the telemetry send operation (e.g.SendTelemetry); if the function should not return here, adjust the control flow accordingly (e.g. replacereturnwith just a comment and let the function continue if appropriate).