A high-performance, configurable web server built with C++ and CMake. This project implements a robust HTTP server with support for static file serving, configurable handlers, and comprehensive test coverage.
- HTTP/1.1 compliant web server
- Configurable request handlers
- Static file serving
- Logging system with Boost.Log
- Comprehensive unit and integration tests
- Docker support for containerized deployment
- Code coverage reporting
- CMake-based build system
- CMake (version 3.10.0 or higher)
- C++ compiler with C++11 support
- Boost libraries (version 1.50 or higher)
- system
- log
- log_setup
- regex
- Google Test framework
- Docker (optional, for containerized deployment)
- Create a build directory:
mkdir build && cd build- Configure and build:
cmake ..
makeBuild and run using Docker:
cd docker
./docker-test.sh.
├── src/ # Source files
├── include/ # Header files
├── tests/ # Test files
│ ├── integration/ # Integration tests
│ └── unit/ # Unit tests
├── config/ # Configuration files
├── docker/ # Docker configuration
├── docs/ # Documentation
├── cmake/ # CMake configuration
└── build/ # Build directory
The project includes comprehensive test coverage:
- Unit tests for individual components
- Integration tests for end-to-end functionality
- Code coverage reports
To run tests:
cd build
ctestThe server can be configured using the configuration files in the config/ directory. See the documentation in docs/ for detailed configuration options.
The project includes Docker support for containerized deployment with a multi-stage build process:
- Build the base image:
docker build -f docker/base.Dockerfile -t vibe-code-only:base .- Build the production image:
docker build -f docker/Dockerfile -t vibe-code-only:latest .- Run the container:
docker run --rm -p 80:80 vibe-code-only:latest- Check running containers:
docker ps- View container logs:
docker logs <container_id>The project is configured for Google Cloud Build and Container Registry:
- Set up Google Cloud project:
gcloud config set project <your-project-id>- Enable required APIs:
gcloud services enable cloudbuild.googleapis.com
gcloud services enable containerregistry.googleapis.com-
Configure Cloud Build triggers:
- Connect your GitHub repository to Cloud Build
- Set up triggers for:
- Push to main branch
- Pull request creation
- Tag creation
-
Build and deploy using Cloud Build:
gcloud builds submit --config=docker/cloudbuild.yamlThe production container includes:
- Web server binary at
/usr/local/bin/webserver - Configuration file at
/etc/webserver/config - Static assets at
/var/www/static - Log directory at
/var/log/webserver
LOG_DIR: Directory for log files (default:/var/log/webserver)- Configuration can be overridden at runtime by mounting a custom config file
The Cloud Build pipeline (cloudbuild.yaml) includes:
- Pulling cached base image
- Building and caching base image
- Building production image
- Building coverage test image
- Pushing images to Container Registry
- View container logs:
docker logs <container_id>
docker cp <container_id:/logs ./logs_from_container
cd <path to logs_from_container>
cat logs/<date of log>.log- Access logs in production:
kubectl logs <pod-name> -n <namespace>- Monitor container metrics:
kubectl top pod <pod-name>- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
- Alexander West
- Krish Patel
- William Wu
- Guanhua Ji