Skip to content

Conversation

@0xfurai
Copy link
Owner

@0xfurai 0xfurai commented Oct 12, 2025

partly solves #175

0xfurai added 30 commits October 8, 2025 23:20
- Deleted multiple unused modules, including auth, badge, bruteforce, certificate, and others, to reduce complexity and improve maintainability.
- Cleaned up associated test files and configurations to reflect the removal of these modules.
- Updated Dockerfiles to ensure they align with the current project structure.
…ve unused MongoDB and SQL files

- Updated the database connection logic in main.go to utilize the new infra package for SQL and MongoDB connections.
- Deleted obsolete mongo.go and sql.go files to streamline the codebase and eliminate unused dependencies.
… struct

- Introduced new fields for Redis configuration, including host, port, password, and database.
- Added a field for queue concurrency to manage the number of concurrent workers processing tasks.
- Introduced new Makefile targets for building and running the producer binary.
- Added `build-producer` to compile the producer service and `run-producer` to execute it.
- Created an alias `producer` for convenience in running the producer service.
- Added Redis service configuration to Docker Compose files for development environments.
- Implemented Redis event bus functionality, allowing for distributed event handling across services.
- Updated various modules to utilize the new Redis event bus for event subscription and publishing.
- Introduced helper functions for unmarshalling event payloads from Redis.
- Refactored event handling logic to accommodate the new event bus implementation.
…the producer service

- Deleted ARCHITECTURE.md, QUICKSTART.md, and README.md files as they contained outdated information regarding the producer service.
- This cleanup aims to streamline documentation and prepare for future updates.
- Added Redis configuration options to the .env.dev.example file for local development.
- Updated Docker Compose files to change Redis port from 6379 to 6381 for consistency across environments.
- Introduced Asynq monitoring service in the Docker Compose configuration to facilitate task management and monitoring.
- Introduced a new development script for the worker in package.json to facilitate local development.
- Updated turbo.json to include caching and persistence settings for the new worker script.
- Refactored healthcheck methods to follow Go naming conventions by capitalizing the method names for better visibility and consistency.
- Added new Asynq client and inspector to the worker for improved task management.
- Updated health check queue priorities to include 'healthcheck' and 'ingester' for better task handling.
- Refactored health check methods to return structured results, including ping time and maintenance status.
- Streamlined event listener methods for monitor events, preparing for future enhancements.
- Introduced new Makefile targets for building and running the ingester binary.
- Updated package.json to include a development script for the ingester service.
- Modified turbo.json to add caching and persistence settings for the ingester.
- Enhanced queue processing in the worker to enqueue tasks for the ingester service.
- Added a new API service with a main entry point in cmd/api/main.go.
- Updated package.json to change the development script for the API service.
- Enhanced the health check processing by moving important logic to the ingester, including heartbeat management and notification handling.
- Refactored health check methods to streamline event handling and integrate with the new queue system.
- Updated .gitignore to exclude new worker and ingester directories.
- Updated the logging setup in both producer and worker services to filter out debug logs in development mode.
- Customized the log output format to include timestamps and remove unnecessary keys for improved readability.
- Adjusted queue concurrency setting in the configuration to increase the number of concurrent workers from 10 to 300.
- Modified health check task scheduling to dynamically set timeout and retention based on monitor interval, improving task management.
- Implemented stale task detection in the worker to skip processing of outdated health check tasks, enhancing efficiency.
…s configuration

- Replaced cron-based scheduling with Asynq for managing periodic tasks in the MonitorScheduler.
- Added a new ProvideAsynqScheduler function to create and configure the Asynq scheduler.
- Updated Docker Compose to use a Redis Alpine image and added a volume for Redis data.
- Enhanced health check task management by registering tasks with Asynq, improving reliability and performance.
- Removed deprecated cron references and streamlined job management within the MonitorScheduler.
…ntenance status

- Commented out the logic for checking if a monitor is under maintenance in the buildHealthCheckPayload method.
- Set the IsUnderMaintenance field to false by default in the health check payload.
- This change simplifies the health check process while maintaining the existing structure for potential future use.
…dependencies

- Updated the logging setup in the ingester to filter out debug logs in production mode and customize the log output format.
- Refactored the producer module by removing the MonitorScheduler and EventListener dependencies, simplifying the dependency injection process.
- Improved the producer's scheduling logic by integrating Redis for managing monitor intervals and health check tasks.
- Removed the deprecated monitor_scheduler.go file, consolidating scheduling functionality within the producer.
…functionality

- Integrated leader election into the producer, allowing it to manage scheduling based on leadership status.
- Updated the EventListener to handle monitor events more effectively, including JSON payload unmarshalling and leadership checks.
- Refactored the producer's methods for adding, updating, and removing monitors, ensuring they interact with the new leader election logic.
- Enhanced logging to provide better insights during event handling and leadership transitions.
…ling methods

- Removed deprecated scheduling methods and constants related to monitor management, including leadership monitoring and scheduling initialization.
- Streamlined the producer's responsibilities by focusing on essential functionalities, enhancing maintainability and readability.
- Updated the import statements to reflect the changes in dependencies and removed unnecessary code artifacts.
… scheduling

- Added functionality to check for existing scheduled monitors in Redis before scheduling new ones, improving efficiency.
- Introduced a map for quick lookup of existing monitor IDs, reducing unnecessary scheduling operations.
- Enhanced logging to provide insights on newly scheduled and already scheduled monitors during initialization.
- Updated the leader election logic to use a fresh context for cleanup when the original context is cancelled, preventing potential issues during leadership release.
- Added a timeout to the cleanup context to ensure it completes within a specified duration, enhancing reliability during shutdown.
- Changed the maximum items to claim per tick from 1000 to 2 for better control over processing.
- Renamed scheduling methods to reflect their purpose in monitor syncing.
- Enhanced the runLeadershipMonitor method to manage monitor syncing instead of scheduling.
- Updated processMonitor to return the monitor interval for rescheduling, improving task management.
- Streamlined job processing initiation to start immediately upon producer start, ensuring efficient task handling.
…processing

- Reintroduced and refined the logic for checking if a health check task is stale, ensuring tasks older than 1.5 times their interval are skipped.
- Enhanced logging for skipped tasks to provide better insights into task management and processing delays.
…ing to prevent duplicates

- Updated the push handler, producer, and worker modules to use EnqueueUnique for task scheduling, ensuring that duplicate tasks are not created.
- Introduced unique keys based on monitor IDs and timestamps to enhance task management and processing reliability.
- Adjusted the maximum items to claim per tick in the producer constants for improved control over processing.
…nhance health check logging

- Commented out the logging statements for successful task enqueuing in the queue service to reduce verbosity.
- Updated health check task processing to use Info level logging for enqueued results, improving clarity in task management.
- Introduced duration logging for health check tasks to provide insights into processing times.
- Implemented the creation of an index on the monitor_id field in the maintenance collection to improve query performance.
- Added error handling to panic if the index creation fails, ensuring immediate feedback on potential issues.
…odule

- Increased the default queue concurrency from 300 to 1000 to improve task processing capabilities.
- Introduced a new configuration parameter for producer concurrency, allowing up to 128 concurrent producer goroutines.
- Adjusted batch claiming size to 50 for better distribution of tasks among workers, reducing contention.
- Enhanced logging to include worker IDs for better traceability during task processing and error handling.
- Implemented context management in task processing to ensure graceful handling of health check tasks.
…k logging

- Modified Redis configuration to disable append-only mode and adjust save settings for improved performance.
- Enhanced logging in the ingester task handler to include task processing duration, providing better insights into task execution times.
- Modify Makefile to streamline development environment startup with updated command structure.
- Enhance package.json by adding individual development scripts for API, producer, worker, and ingester.
- Refactor import paths in API key module files to use the internal directory structure.
- Remove obsolete server binary file from the repository.
…ries

- Enhanced the scheduling logic to retrieve existing scheduled monitors from both due and lease sets in Redis.
- Implemented a mechanism to remove stale monitors that are no longer active in the database.
- Updated logging to reflect the number of removed stale monitors and the total count of active monitors scheduled.
…emon execution

- Added a delay of 2 seconds to the nodemon execution commands for api, producer, worker, and ingester to improve stability during development.
- This change helps prevent potential race conditions when restarting the services.
…er modules

- Removed direct dependencies on bun.DB and replaced with a unified GracefulDatabaseShutdown function to handle various database types.
- Enhanced shutdown logic to support both SQL and MongoDB, ensuring proper disconnection and resource cleanup.
- Updated logging for clearer shutdown status across modules.
@github-actions
Copy link
Contributor

🚀 Release Candidate Built: 0.0.43-rc.20

    The release candidate has been successfully built and published!

    **Docker Images:**
    - UI: `ghcr.io/0xfurai/peekaping-web:0.0.43-rc.20`
    - API: `ghcr.io/0xfurai/peekaping-api:0.0.43-rc.20`
    - Worker: `ghcr.io/0xfurai/peekaping-worker:0.0.43-rc.20`
    - Producer: `ghcr.io/0xfurai/peekaping-producer:0.0.43-rc.20`
    - Ingester: `ghcr.io/0xfurai/peekaping-ingester:0.0.43-rc.20`
    - Migrate: `ghcr.io/0xfurai/peekaping-migrate:0.0.43-rc.20`

    **Bundle Containers:**
    - SQLite: `ghcr.io/0xfurai/peekaping-bundle-sqlite:0.0.43-rc.20`
    - MongoDB: `ghcr.io/0xfurai/peekaping-bundle-mongo:0.0.43-rc.20`
    - PostgreSQL: `ghcr.io/0xfurai/peekaping-bundle-postgres:0.0.43-rc.20`

    [View Release](https://github.com/0xfurai/peekaping/releases/tag/0.0.43-rc.20)

@github-actions
Copy link
Contributor

🚀 Release Candidate Built: 0.0.43-rc.21

    The release candidate has been successfully built and published!

    **Docker Images:**
    - UI: `ghcr.io/0xfurai/peekaping-web:0.0.43-rc.21`
    - API: `ghcr.io/0xfurai/peekaping-api:0.0.43-rc.21`
    - Worker: `ghcr.io/0xfurai/peekaping-worker:0.0.43-rc.21`
    - Producer: `ghcr.io/0xfurai/peekaping-producer:0.0.43-rc.21`
    - Ingester: `ghcr.io/0xfurai/peekaping-ingester:0.0.43-rc.21`
    - Migrate: `ghcr.io/0xfurai/peekaping-migrate:0.0.43-rc.21`

    **Bundle Containers:**
    - SQLite: `ghcr.io/0xfurai/peekaping-bundle-sqlite:0.0.43-rc.21`
    - MongoDB: `ghcr.io/0xfurai/peekaping-bundle-mongo:0.0.43-rc.21`
    - PostgreSQL: `ghcr.io/0xfurai/peekaping-bundle-postgres:0.0.43-rc.21`

    [View Release](https://github.com/0xfurai/peekaping/releases/tag/0.0.43-rc.21)

@github-actions
Copy link
Contributor

🚀 Release Candidate Built: 0.0.43-rc.22

    The release candidate has been successfully built and published!

    **Docker Images:**
    - UI: `ghcr.io/0xfurai/peekaping-web:0.0.43-rc.22`
    - API: `ghcr.io/0xfurai/peekaping-api:0.0.43-rc.22`
    - Worker: `ghcr.io/0xfurai/peekaping-worker:0.0.43-rc.22`
    - Producer: `ghcr.io/0xfurai/peekaping-producer:0.0.43-rc.22`
    - Ingester: `ghcr.io/0xfurai/peekaping-ingester:0.0.43-rc.22`
    - Migrate: `ghcr.io/0xfurai/peekaping-migrate:0.0.43-rc.22`

    **Bundle Containers:**
    - SQLite: `ghcr.io/0xfurai/peekaping-bundle-sqlite:0.0.43-rc.22`
    - MongoDB: `ghcr.io/0xfurai/peekaping-bundle-mongo:0.0.43-rc.22`
    - PostgreSQL: `ghcr.io/0xfurai/peekaping-bundle-postgres:0.0.43-rc.22`

    [View Release](https://github.com/0xfurai/peekaping/releases/tag/0.0.43-rc.22)

…proving health checks

- Introduced Redis service in development and production Docker Compose files for better caching and message brokering.
- Updated MongoDB and PostgreSQL services to use a unified 'database' naming convention.
- Implemented health checks for Redis and other services to ensure proper startup and readiness.
- Removed redundant environment variables related to Redis from service definitions, streamlining configuration.
…ation

- Changed DB_HOST in the production environment example from 'localhost' to 'database' for better deployment alignment.
- Updated Redis port configuration in development Docker Compose files to use an environment variable for flexibility.
- Added Redis environment variables in the Playwright workflow for improved testing setup.
…abase and server configurations for improved deployment consistency
…database' for consistency with naming conventions
@github-actions
Copy link
Contributor

🚀 Release Candidate Built: 0.0.43-rc.25

    The release candidate has been successfully built and published!

    **Docker Images:**
    - UI: `ghcr.io/0xfurai/peekaping-web:0.0.43-rc.25`
    - API: `ghcr.io/0xfurai/peekaping-api:0.0.43-rc.25`
    - Worker: `ghcr.io/0xfurai/peekaping-worker:0.0.43-rc.25`
    - Producer: `ghcr.io/0xfurai/peekaping-producer:0.0.43-rc.25`
    - Ingester: `ghcr.io/0xfurai/peekaping-ingester:0.0.43-rc.25`
    - Migrate: `ghcr.io/0xfurai/peekaping-migrate:0.0.43-rc.25`

    **Bundle Containers:**
    - SQLite: `ghcr.io/0xfurai/peekaping-bundle-sqlite:0.0.43-rc.25`
    - MongoDB: `ghcr.io/0xfurai/peekaping-bundle-mongo:0.0.43-rc.25`
    - PostgreSQL: `ghcr.io/0xfurai/peekaping-bundle-postgres:0.0.43-rc.25`

    [View Release](https://github.com/0xfurai/peekaping/releases/tag/0.0.43-rc.25)

…es, ensuring the most recent versions are deployed.
…rom scratch to alpine for improved size and security
@github-actions
Copy link
Contributor

🚀 Release Candidate Built: 0.0.43-rc.26

    The release candidate has been successfully built and published!

    **Docker Images:**
    - UI: `ghcr.io/0xfurai/peekaping-web:0.0.43-rc.26`
    - API: `ghcr.io/0xfurai/peekaping-api:0.0.43-rc.26`
    - Worker: `ghcr.io/0xfurai/peekaping-worker:0.0.43-rc.26`
    - Producer: `ghcr.io/0xfurai/peekaping-producer:0.0.43-rc.26`
    - Ingester: `ghcr.io/0xfurai/peekaping-ingester:0.0.43-rc.26`
    - Migrate: `ghcr.io/0xfurai/peekaping-migrate:0.0.43-rc.26`

    **Bundle Containers:**
    - SQLite: `ghcr.io/0xfurai/peekaping-bundle-sqlite:0.0.43-rc.26`
    - MongoDB: `ghcr.io/0xfurai/peekaping-bundle-mongo:0.0.43-rc.26`
    - PostgreSQL: `ghcr.io/0xfurai/peekaping-bundle-postgres:0.0.43-rc.26`

    [View Release](https://github.com/0xfurai/peekaping/releases/tag/0.0.43-rc.26)

…rvices

- Adjusted health check intervals to 30s, timeouts to 2s, and retries to 5 for improved reliability.
- Added start_period of 5s to ensure services have adequate time to initialize before health checks commence.
…er Compose files

- Updated health check commands to use a more structured format for clarity.
- Standardized health check intervals, timeouts, and retries across all services to enhance reliability.
- Renamed services from 'mongodb' and 'postgres' to 'database' for consistency.
- Introduced new services (redis, api, producer, worker, ingester) with appropriate health checks and dependencies to improve service orchestration.
@github-actions
Copy link
Contributor

🚀 Release Candidate Built: 0.0.43-rc.27

    The release candidate has been successfully built and published!

    **Docker Images:**
    - UI: `ghcr.io/0xfurai/peekaping-web:0.0.43-rc.27`
    - API: `ghcr.io/0xfurai/peekaping-api:0.0.43-rc.27`
    - Worker: `ghcr.io/0xfurai/peekaping-worker:0.0.43-rc.27`
    - Producer: `ghcr.io/0xfurai/peekaping-producer:0.0.43-rc.27`
    - Ingester: `ghcr.io/0xfurai/peekaping-ingester:0.0.43-rc.27`
    - Migrate: `ghcr.io/0xfurai/peekaping-migrate:0.0.43-rc.27`

    **Bundle Containers:**
    - SQLite: `ghcr.io/0xfurai/peekaping-bundle-sqlite:0.0.43-rc.27`
    - MongoDB: `ghcr.io/0xfurai/peekaping-bundle-mongo:0.0.43-rc.27`
    - PostgreSQL: `ghcr.io/0xfurai/peekaping-bundle-postgres:0.0.43-rc.27`

    [View Release](https://github.com/0xfurai/peekaping/releases/tag/0.0.43-rc.27)

…MongoDB and PostgreSQL to 'database' for consistency
@0xfurai 0xfurai marked this pull request as ready for review October 29, 2025 03:32
cursor[bot]

This comment was marked as outdated.

…anced system availability and scalability, including updates for microservices configuration in Docker Compose.
@0xfurai 0xfurai merged commit af8a453 into main Oct 29, 2025
9 of 10 checks passed

if err != nil {
panic("Failed to create index on stat_minutely collection:" + err.Error())
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Duplicate Index Creation Causes Overhead

The NewMongoRepository function creates a duplicate index on (monitor_id, timestamp) for the stat_minutely collection. This redundant operation could lead to unnecessary overhead or MongoDB warnings.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants