Migration of @gcp/doc-index/functions/src/edinet2/ to standalone Go application with dev container environment.
- Runtime: Go 1.21+
- Web Framework: Gin
- Database: PostgreSQL 15
- Cache: Redis 7
- Object Storage: MinIO (S3-compatible)
- Development: Dev Container with Docker Compose
apps/edinet-go/
├── .devcontainer/
│ ├── devcontainer.json
│ └── docker-compose.yml
├── cmd/
│ └── server/
│ └── main.go
├── internal/
│ ├── config/
│ ├── handlers/
│ ├── services/
│ ├── models/
│ └── storage/
├── migrations/
├── logs/
├── tasks/
│ └── 1-migration-plan.md
├── go.mod
├── go.sum
├── Dockerfile
└── README.md
Goal: Establish dev container environment with basic Go framework and essential infrastructure
- Create
.devcontainer/devcontainer.json- Go 1.21+ with extensions
- Database tools (psql, redis-cli, mc)
- Air for hot reload
- Create
docker-compose.ymlwith services:- PostgreSQL 15 (port 5432)
- Redis 7 (port 6379)
- MinIO (port 9000/9001)
- Configure service networking and volumes
- Initialize Go module:
go mod init edinet-go - Add core dependencies:
github.com/gin-gonic/gin github.com/lib/pq github.com/go-redis/redis/v8 github.com/minio/minio-go/v7 github.com/sirupsen/logrus github.com/stretchr/testify gopkg.in/natefinch/lumberjack.v2
- Create
cmd/server/main.gowith:- Configuration loading
- Database connection
- Redis connection
- MinIO connection
- Gin router setup
- Graceful shutdown
- Create
internal/config/config.go:- Environment variable loading
- Service connection strings
- Logging configuration
- Create storage layer (
internal/storage/):- Database connection management
- Redis client setup
- MinIO client setup
- Implement structured logging with logrus
- Log rotation configuration
- Different log levels (DEBUG, INFO, WARN, ERROR)
- Request/response logging middleware
- Error logging with stack traces
-
GET /health- Basic health check -
GET /health/db- Database connection test -
GET /health/redis- Redis connection test -
GET /health/minio- MinIO connection test -
GET /health/full- All services health check
- Unit tests for configuration loading
- HTTP handler tests for health endpoints with mocks
- Test framework setup with testify
- Mock implementations for storage interfaces
- Air configuration for hot reload
- Makefile for common tasks:
make dev- Start dev environmentmake test- Run testsmake build- Build applicationmake clean- Clean containersmake setup- Setup dev environmentmake health- Check service health
- Linting configuration (golangci-lint)
- Git ignore configuration
- Development workflow automation
- README.md with setup instructions
- Environment variable documentation
- Development workflow documentation
- API endpoint documentation
- Project structure documentation
- Dev container starts successfully
- All services (PostgreSQL, Redis, MinIO) are accessible
- Go application starts without errors
- All health check endpoints return 200 OK
- File logging works with proper rotation
- All tests pass
- Hot reload works during development
Implementation Date: January 2025
All deliverables: ✅ Complete
Success criteria: ✅ All met
- Working dev container environment
- Basic Go web server with Gin
- Database, Redis, and MinIO connections
- Health check endpoints
- File logging system
- Basic test suite
- Development tooling (Makefile, Air)
- Documentation
- Phase 2: Database schema and models
- Phase 3: EDINET search API migration
- Phase 4: XBRL download and processing
- Phase 5: Document storage and caching
- Phase 6: Performance optimization and monitoring