Codecov Self-Hosted Install Guide
Prerequisites to Installing Codecov Self-Hosted
Prerequisite | Description |
---|---|
Basic Ingredients List | 1. Git-based code host (GitHub.com, Github Enterprise, Gitlab Community Edition, Gitlab Enterprise Edition, Bitbucket, Bitbucket Server) 2. Coverage reports generation 3. A CI provider |
Installation Lead | Installing Codecov requires deep knowledge of your organization’s infrastructure and how it is implemented, including your CI and Security Configurations. Oftentimes these stakeholders reside on the Operations or SRE team. |
Access Controls | In order to complete the Codecov install your team will need an account key (provided by Codecov), access to object storage, your Kubernetes Cluster (if applicable) / Compute, Source Control Provider, your Database, and Redis. |
Orchestration | Managed Kubernetes |
Deployment Management | Terraform, or, for testing an install, Docker Compose |
Software Distribution | Access to DockerHub from within your network |
Hardware | Managed virtual private cloud (AWS, GCP, Azure) with min. 1 machine for installation testing |
Database | a.) Postgres version 14 or later via managed cloud (e.g., RDS, CloudSQL, or Azure PostgreSQL) b.) TimescaleDB (optional but highly recommended to use all of Codecov's features) |
Cache | Redis via managed services (e.g., ElastiCache) |
Storage | S3 compatible storage (S3, GCS, Azure Blob Storage, Ceph, Minio) |
S3 Compatibility Requirements
Please note, to be able to use any S3 / minio compatible storage, you must be able to grant at least the following policies. The application will not work if any of these cannot be granted.
"s3:GetObject", "s3:PutObject", "s3:AbortMultipartUpload", "s3:ListMultipartUploadParts", "s3:GetBucketLocation", "s3:HeadBucket", "s3:ListBucket", "s3:ListBucketVersions"
Steps to a Working Implementation of Self-Hosted Codecov
1. Clone our self-hosted repo
- Clone the repo at https://github.com/codecov/self-hosted
- Make note that the primary means of configuration is found in the codecov.yml file located in the scripts directory.
2. Setup Required External Services
- For GitLab or BitBucket, create an OAuth level integration in your repo service provider and have the Client ID and Client Secret ready to use.
- For Github, create a GitHub App Integration instead
3. (Optional) Create External Resources
The following steps are optional
Codecov's self-hosted repo comes with containerized services for all of the below resources. If desired, however, these resources can be created externally and added to the codecov.yml configuration.
- Create an external, managed, postgres database (e.g., AWS RDS, Google Cloud SQL, etc) and have the url with username and credentials in your codecov.yml
- Create an object storage mechanism (e.g., an AWS S3 bucket, a Google Cloud Storage Bucket, etc) and have the bucket name on hand, plus credentials to supply to the codecov.yml
- Caveat: If you’re using S3, you can instead ensure codecov runs on a VM with a StorageAdmin S3 role, or using a suitably permissioned* S3 role.
- Create a separate, managed Redis database (e.g., AWS Elasticache, etc) and have the credentials to supply to the codecov.yml.
4. Edit Configuration
- Supply the needed configuration derived from the above steps into the codecov.yml
5. Run Codecov
- Run
docker-compose up
in the self-hosted root directory. - Ensure your codecov installation is working by navigating to it in your browser.
6. Test Codecov
Integrate Codecov into your CI and upload a coverage report
Ensure that Codecov comments and status checks appear on Pull Requests
Updated about 2 months ago
What’s Next