635 Commits
Author SHA1 Message Date
nutcas3 4008a19f4a refactor: Pre-allocate Vec capacity in rating_billing.rs to reduce reallocations
- Set applied_rules capacity to 6 (maximum number of charging rules that can be applied)
- Set keys capacity to 100 in get_usage_history and get_all_accounts (matches SCAN batch size)
- Add comments explaining capacity choices for each Vec initialization
2026-04-29 04:24:22 +03:00
nutcas3 5ec01e591e refactor: Replace fallback defaults with required environment variable validation in charging-engine auth
- Change AuthConfig::from_env() return type from Self to Result<Self, String>
- Remove default JWT_SECRET fallback, require environment variable to be set
- Add validation requiring JWT_SECRET to be at least 32 characters for security
- Replace expect() with ok_or_else in create_token timestamp calculation
- Replace expect() with map_err in DATABASE_URL environment variable loading
2026-04-29 04:23:58 +03:00
nutcas3 8bb332964b refactor: Replace unwrap() with unwrap_or_else fallback in rate limiter configuration
- Add fallback to default GovernorConfig (10 req/s, burst 20) if custom config fails
- Replace unwrap() with unwrap_or_else providing sensible defaults
- Add comment explaining fallback behavior for rate limiter initialization
2026-04-29 04:23:11 +03:00
nutcas3 5340469a1a refactor: Replace expect() with unwrap_or_else fallbacks and improve error handling in charging-engine
- Remove unused _account variable in calculate_usage_cost
- Replace HashMap::with_capacity with HashMap::new and use iterator chain in get_all_plans
- Add std::process::Command import and set current_dir to repo root in run_migrations
- Add comment explaining directory change to locate migrations folder
- Replace expect() with unwrap_or_else providing fallback JSON in SubscriberAccount and UsageEvent
2026-04-29 04:22:52 +03:00
nutcas3 1deecf32fe refactor: Replace manual Display and Error implementations with thiserror derive macro in ChargingError
- Add thiserror::Error derive to ChargingError enum
- Replace manual fmt::Display implementation with #[error] attributes on each variant
- Remove manual std::error::Error implementation (provided by thiserror)
- Remove std::fmt import as it's no longer needed
- Maintain same error message formats and functionality
2026-04-29 04:22:02 +03:00
nutcas3 4cc0b80b1c refactor: Remove unnecessary clone() calls and improve error handling in packet-gateway
- Remove clone() from rating plan parameter in add_rating_plan call
- Remove clone() calls from ChargingEngineClient and EbpfManager initialization
- Remove clone() from Redis client Arc wrapping
- Remove clone() calls from PacketGatewayConfig field assignments
- Replace expect() with proper error handling using map_err and anyhow in health check server
- Remove clone() from IP string in session data collection
2026-04-29 04:21:52 +03:00
nutcas3 b3ff568bd4 feat: Add workspace-level linting rules and cargo-audit configuration
- Add cargo-audit metadata section with placeholder for ignored advisories
- Forbid unsafe_code at workspace level
- Enable all and pedantic clippy warnings
- Deny unwrap_used, expect_used, and panic to enforce error handling
- Add thiserror dependency to charging-engine for improved error handling
2026-04-29 04:21:33 +03:00
nutcas3 609bdb16fa feat: Set repository root as working directory for Goose migrations in carrier-connector
- Add filepath import for path manipulation
- Calculate repository root path relative to carrier-connector location (../../)
- Set cmd.Dir to repository root before executing Goose command
- Add comment explaining directory change to locate migrations folder
- Ensure migrations can be found from carrier-connector's nested location
2026-04-29 04:21:19 +03:00
NutcaseandGitHub 2eadc64af6 Merge pull request #15 from nutcas3/ci-&migrations
Ci &migrations
2026-04-29 03:49:51 +03:00
nutcas3 898e58201f refactor: Extract CRUD operations from database.go into separate crud.go file
- Move all subscriber, payment method, transaction, and notification CRUD operations to crud.go
- Remove models import from database.go as it's no longer needed
- Keep database initialization, connection management, and IMSI allocation in database.go
- Maintain ListSubscribersRequest struct definition in crud.go alongside related functions
2026-04-29 03:36:45 +03:00
nutcas3 393685846c fix: Convert Status field to string in ListSubscribers database request
- Cast req.Status to string when passing to database.ListSubscribersRequest
- Ensure type compatibility between service and database layer status fields
2026-04-29 03:31:29 +03:00
nutcas3 cc2590bb17 fix: Reorder working-directory and env blocks in database migration step for consistency
- Move working-directory after env block in Run database migrations step
- Maintain same functionality while following standard YAML ordering convention
2026-04-29 03:31:21 +03:00
nutcas3 71353fc237 feat: Replace GORM AutoMigrate with Goose CLI migrations in api-server database initialization
- Add os/exec import for running external commands
- Replace AutoMigrate function with runMigrations function using goose postgres command
- Call runMigrations in NewDatabase before initializing IMSI allocation
- Remove PoolStats function and GORM-based schema migration code
- Reorganize database methods with section comments (Subscriber CRUD, Payment methods, Transactions, Additional CRUD, IMSI allocation)
-
2026-04-29 03:31:00 +03:00
nutcas3 e6450f15ad feat: Add comprehensive database schema migrations for all platform tables
- Add subscribers table with IMSI, MSISDN, authentication keys, and eSIM profile fields
- Add service_plans table for data/voice/SMS limits and QoS parameters (ARPA, AMBR)
- Add sessions table for tracking PDU sessions with QoS and usage metrics
- Add usage_records table for billing and charging data
- Add users table with role-based access control fields
- Add roles, permissions, and role_permissions junction table for RBAC
- Add auth
2026-04-29 03:25:28 +03:00
nutcas3 28422fafc1 fix: Standardize migrations directory path and add explicit working-directory in CI workflow
- Change migrations path from './migrations' to 'migrations' in all test jobs
- Add explicit working-directory: . to migration steps for clarity
- Apply changes to api-server-test, charging-engine-test, and packet-gateway-test jobs
2026-04-29 03:18:11 +03:00
nutcas3 96eacf8e77 fix: Add goose to PATH and correct migrations directory path in CI workflow
- Add explicit PATH configuration step to ensure goose binary is accessible after installation
- Fix migrations directory path from 'migrations' to './migrations' in all test jobs
- Apply changes to api-server-test, charging-engine-test, and packet-gateway-test jobs
2026-04-29 03:11:46 +03:00
nutcas3 62ab577e82 Merge branch 'main' of https://github.com/nutcas3/telecom-platform into ci-&migrations 2026-04-29 03:04:59 +03:00
NutcaseandGitHub 0a8f4660ff Merge pull request #14 from nutcas3/upgraded
feat: Add database migration steps to CI and deployment workflows
2026-04-29 03:04:31 +03:00
nutcas3 9c445aa894 Merge branch 'main' of https://github.com/nutcas3/telecom-platform into ci-&migrations 2026-04-29 03:03:23 +03:00
nutcas3 69241334aa feat: Add automatic Goose migration execution on startup in charging-engine RatingPlansRepo
- Add std::process::Command import for running external commands
- Implement run_migrations function to execute goose postgres migrations
- Call run_migrations in RatingPlansRepo::connect before returning repository instance
- Update function comments to reflect automatic migration execution on startup
- Add error handling and output capture for migration failures
- Add tracing log for successful migration
2026-04-29 03:00:28 +03:00
nutcas3 85012f380f feat: Add PostgreSQL service and database migrations to Rust component test jobs in CI workflow
- Upgrade PostgreSQL service from version 15 to 18 in api-server-test job
- Add PostgreSQL 18 service configuration to charging-engine-test and packet-gateway-test jobs
- Configure database health checks with pg_isready command for all Postgres services
- Add goose installation step to charging-engine-test and packet-gateway-test jobs
- Add database migration execution step before running tests in Rust components
2026-04-29 02:58:48 +03:00
nutcas3 0a02fe4e03 feat: Replace custom migration runner with goose CLI and add migration management commands to Makefile
- Replace custom Go migration runner (go run cmd/migrate/main.go) with goose postgres command in db-migrate target
- Add db-migrate-down target for rolling back migrations
- Add db-migrate-status target to show current migration status
- Add db-create-migration target for creating new migration files with NAME parameter validation
- Add db-migrate-rust target for Rust service migrations (uses same
2026-04-29 02:57:50 +03:00
nutcas3 76d7661443 feat: Add automatic Goose migration execution on startup in carrier-connector PostgresProfileStore
- Add os/exec import for running external commands
- Implement runMigrations function to execute goose postgres migrations
- Call runMigrations in NewPostgresProfileStore before returning store instance
- Update function comment to reflect automatic migration execution on startup
- Add error handling and output capture for migration failures
2026-04-29 02:57:41 +03:00
nutcas3 a8381e6b8f refactor: Remove inline schema creation from PostgresProfileStore in favor of centralized migration system
- Remove AutoMigrate call for profileRow from NewPostgresProfileStore
- Update function comment to reference migration system (make db-migrate) instead of inline schema creation
- Add note that esim_profiles table is created by migration system
- Remove error handling for AutoMigrate execution
2026-04-29 02:55:13 +03:00
nutcas3 85b97c0950 deps: Update lib/pq from v1.10.2 to v1.12.3 in api-server 2026-04-29 02:55:05 +03:00
nutcas3 601c34654e feat: Add goose database migrations for rating_plans and esim_profiles tables
- Create 00001_init_rating_plans.sql migration with rating_plans table schema
- Add plan_id, name, rate fields (data/voice/sms), monthly_fee, and limit fields (data/voice/sms)
- Include is_active flag and timestamp fields (created_at, updated_at)
- Add indexes on is_active and created_at columns
- Create 00002_init_esim_profiles.sql migration with esim_profiles table schema
- Add iccid (primary key), eid, imsi, mcc, mnc, profile_
2026-04-29 02:54:52 +03:00
nutcas3 eb5b9092c9 refactor: Remove inline schema creation from RatingPlansRepo in favor of centralized migration system
- Remove CREATE TABLE IF NOT EXISTS query for rating_plans table from connect() method
- Update comment to reference migration system (make db-migrate) instead of inline schema creation
- Add note that rating_plans table is created by 000001_init_rating_plans.up.sql migration
- Remove sqlx::query execution and error mapping for schema creation
- Keep database connection pool and circuit breaker initialization
2026-04-29 02:54:41 +03:00
nutcas3 87dd487d48 refactor: Replace custom migration runner with goose CLI tool in CI and deployment workflows
- Install goose CLI tool using go install in CI and deploy workflows
- Replace custom migration command (go run cmd/migrate/main.go --action=up) with goose postgres command
- Remove working-directory specification from CI migration step
- Update commented kubectl exec commands in deploy workflow to use goose instead of custom runner
- Simplify migration execution by using standardized goose tool across all environments
2026-04-29 02:54:08 +03:00
nutcas3 6fd5d89671 feat: Add database migration steps to CI and deployment workflows
- Add migration execution step in CI workflow before linter runs
- Configure DATABASE_URL environment variable for test database connection
- Add placeholder migration steps in deploy workflow for staging and production environments
- Include commented kubectl exec commands for future implementation in Kubernetes deployments
2026-04-29 02:52:51 +03:00
NutcaseandGitHub 14508dc47d Merge pull request #13 from nutcas3/ci fixes
ci and docker fixes
2026-04-29 02:48:28 +03:00
nutcas3 3cfd5d672c refactor: Enhance all Dockerfiles with security hardening, optimization, and production best practices
- Add maintainer and description labels to all build and runtime stages
- Change builder WORKDIR from /app to /build for clarity
- Install build dependencies with --no-cache/--no-install-recommends flags
- Add build optimizations: -ldflags="-w -s -extldflags '-static'" and -trimpath for Go, strip for Rust
- Implement dependency caching strategy for Rust builds (dummy app pattern)
- Pin Alpine base
2026-04-29 02:45:33 +03:00
nutcas3 095eb0bdf3 refactor: Update Docker build contexts to use root directory with explicit Dockerfile paths in deploy workflow
- Change all docker/build-push-action contexts from ./apps/<component> to root directory (.)
- Add explicit file parameter pointing to ./deployments/docker/<component>.Dockerfile for all components
- Update build configurations for api-server, carrier-connector, charging-engine, packet-gateway, CLI, and web-dashboard
2026-04-29 02:45:07 +03:00
nutcas3 821a3bfb17 refactor: Update Docker build contexts to use root directory with explicit Dockerfile paths in CI workflow
- Change all docker/build-push-action contexts from ./apps/<component> to root directory (.)
- Add explicit file parameter pointing to ./deployments/docker/<component>.Dockerfile for all components
- Update build configurations for api-server, carrier-connector, charging-engine, packet-gateway, CLI, and web-dashboard
2026-04-29 02:44:51 +03:00
nutcas3 5f8da8faef feat: Add Dockerfile for CLI component
- Create multi-stage Dockerfile for CLI application
- Use golang:1.26-alpine as builder image
- Copy go.mod and go.sum for dependency caching
- Build static binary with CGO_ENABLED=0
- Use alpine:latest as runtime image with ca-certificates
- Set /root/ as working directory and ./cli as default command
2026-04-29 02:43:49 +03:00
NutcaseandGitHub f02dd5e83a Merge pull request #12 from nutcas3/upgraded
Upgraded
2026-04-29 02:35:38 +03:00
nutcas3 4e5ad491ef refactor: Remove unused CircuitBreaker and ChargingError imports from charging-engine
- Remove unused CircuitBreaker import from credit_management.rs
- Remove unused ChargingError import from engine.rs
- Keep CircuitBreakerError import in credit_management.rs
- Keep CircuitBreaker import in engine.rs
2026-04-26 02:32:23 +03:00
nutcas3 db4d8bf56a refactor: Re-enable rate limiter with environment variable configuration in charging-engine routes
- Add tower_governor imports (GovernorConfigBuilder and GovernorLayer)
- Remove commented-out rate_limit module import
- Add environment variable parsing for RATE_LIMIT_RPS (default: 10) and RATE_LIMIT_BURST (default: 20)
- Create GovernorConfigBuilder with per_second and burst_size configuration
- Replace commented-out rate_limiter layer with GovernorLayer::new(governor_conf)
2026-04-26 02:32:14 +03:00
nutcas3 2094a3b952 refactor: Simplify rate limiter to use default configuration in charging-engine
- Remove unused imports: governor clock/state/Quota, std::num::NonZeroU32, std::sync::Arc, and SmartIpKeyExtractor
- Change create_rate_limiter return type from explicit generic parameters to simple GovernorLayer
- Replace custom rate limit configuration (RATE_LIMIT_RPS, RATE_LIMIT_BURST environment variables) with GovernorConfig::default()
- Remove quota builder logic and pass config directly to GovernorLayer::new()
2026-04-26 02:31:59 +03:00
nutcas3 186bba04a8 refactor: Remove duplicate imports and comment out rate limiter implementation in charging-engine
- Remove duplicate CreditManager and RatingPlansRepo imports from engine.rs
- Add circuit_breaker module to main.rs imports
- Comment out rate_limit module in lib.rs
- Update rate_limit.rs imports to use GovernorConfig and GovernorLayer directly
- Change GovernorConfigBuilder to GovernorConfig::builder() and update config initialization
- Update GovernorLayer::new() to take config reference
2026-04-26 02:17:26 +03:00
nutcas3 a4aec94314 refactor: Re-enable circuit breaker implementation in charging-engine credit management and rating plans
- Uncomment CircuitBreaker and CircuitBreakerError imports in credit_management.rs and rating_plans_repo.rs
- Re-enable redis_circuit_breaker execute calls for all Redis operations (get_balance, add_credit, deduct_credit, block_user, unblock_user, is_user_blocked, get_subscriber_account, update_subscriber_account, record_usage_event)
- Re-enable postgres circuit_breaker execute calls for all database operations
2026-04-26 02:13:07 +03:00
nutcas3 1d489a0a8a refactor: Make eBPF dependencies optional and add conditional compilation support to packet-gateway
- Add ebpf feature flag to Cargo.toml with default disabled
- Make aya and aya-log dependencies optional and tied to ebpf feature
- Add #[cfg(feature = "ebpf")] conditional compilation directives for EbpfManager imports and usage
- Add feature-gated readiness check logic (ebpf_ok only checked when feature enabled)
- Add feature-gated metrics_handler implementations (full version with eBPF, stub version without)
- Change
2026-04-26 02:00:27 +03:00
nutcas3 95def1bcab refactor: Re-enable circuit breaker implementation and add conditional eBPF compilation support
- Uncomment CircuitBreaker and CircuitBreakerError imports in charging-engine
- Re-enable redis_circuit_breaker and postgres_circuit_breaker fields in ChargingEngine struct
- Add circuit breaker initialization with environment variable configuration (REDIS_FAILURE_THRESHOLD, REDIS_TIMEOUT, POSTGRES_FAILURE_THRESHOLD, POSTGRES_TIMEOUT)
- Add #[cfg(feature = "ebpf")] conditional compilation directives throughout
2026-04-26 01:50:29 +03:00
nutcas3 05f95a5c75 refactor: Update Go build commands to use explicit source paths and improve output formatting
- Change api-server build path from default to ./cmd/ directory
- Change carrier-connector build path from default to current directory
- Change CLI build path from default to current directory
- Update build-go echo color from CYAN to GREEN for consistency
- Remove redundant mkdir -p dist from build-go target
2026-04-26 01:26:05 +03:00
nutcas3 10ac6bb861 refactor: Make eBPF build optional in packet-gateway build script
- Change eBPF build from required to optional with graceful fallback
- Add match statement to handle build success, failure, and missing cargo-build-bpf cases
- Add cargo warnings when eBPF build fails or cargo-build-bpf is not installed
- Remove panic on build failure to allow compilation without eBPF toolchain
2026-04-26 01:24:17 +03:00
nutcas3 3b2edc5ccf ci: Fix Go build paths for carrier-connector and CLI components
- Change carrier-connector build path from ./cmd/ to .
- Change CLI build path from ./cmd/ to .
2026-04-26 01:24:06 +03:00
nutcas3 d5ebb3bfd8 refactor: Comment out circuit breaker implementation and remove thiserror dependency
- Remove thiserror 2.0.18 dependency from Cargo.toml
- Comment out CircuitBreakerError import and all circuit breaker execute calls in credit_management.rs
- Comment out redis_circuit_breaker and postgres_circuit_breaker fields in ChargingEngine struct
- Comment out circuit breaker initialization code in engine.rs
- Comment out circuit_breaker field and initialization in RatingPlansRepo
- Remove circuit breaker
2026-04-26 01:15:58 +03:00
nutcas3 b6bcad067b refactor: Update rate limiter to use StateInformationMiddleware and QuantaClock
- Change create_rate_limiter return type from InMemoryState/DefaultClock to StateInformationMiddleware with QuantaClock
- Add StateInformationMiddleware import from governor::middleware
- Add Arc import from std::sync
- Remove explicit key_extractor field from GovernorLayer initialization
2026-04-26 00:44:00 +03:00
nutcas3 b4b0966937 refactor: Update charging-engine dependencies and fix rate limiter configuration
- Upgrade tower_governor from 0.4.2 to 0.8.0 and add governor 0.10.4 dependency
- Add thiserror 2.0.18 for error handling
- Update dev dependencies: tokio-test to 0.4.5, mockall to 0.14.0, serial_test to 3.4.0
- Add Copy trait to CircuitState enum
- Add Clone derive to CircuitBreaker struct
- Add error trait bounds to CircuitBreakerError generic type
- Update create_rate_limiter return type to use explicit generic parameters
- Fix Go
2026-04-26 00:42:19 +03:00
nutcas3 133523d83b ci: Add Docker build and push steps for carrier-connector, charging-engine, packet-gateway, and CLI components
- Add carrier-connector-meta and carrier-connector build/push steps with ghcr.io image tagging
- Add charging-engine-meta and charging-engine build/push steps with ghcr.io image tagging
- Add packet-gateway-meta and packet-gateway build/push steps with ghcr.io image tagging
- Add cli-meta and CLI build/push steps with ghcr.io image tagging
- Add carrier-image, charging-image, gateway-image,
2026-04-26 00:26:19 +03:00
nutcas3 261d55d831 ci: Add CI workflows for carrier-connector, charging-engine, packet-gateway, and CLI components
- Add carrier-connector-test job with Go 1.23 setup, linting, testing with race detector, and build step
- Add charging-engine-test job with Rust 1.94 setup, cargo caching, release mode testing, and build step
- Add packet-gateway-test job with Rust 1.94 setup, cargo caching, release mode testing, and build step
- Add cli-test job with Go 1.23 setup, linting, testing with race detector, and build step
2026-04-26 00:26:01 +03:00