Deploying with Docker Compose

Using Codecov's official Docker image and docker-compose

Installing

Please follow the directions below to install Codecov.

Prerequisites

Install and run Codecov Enterprise

install.sh

 
1# Download assets 2curl -fsSL https://raw.githubusercontent.com/codecov/enterprise/v4.5/compose-assets/codecov.yml > codecov.yml 3curl -fsSL https://raw.githubusercontent.com/codecov/enterprise/v4.5/compose-assets/docker-compose.yml > docker-compose.yml 4 5# Start Codecov Enterprise 6docker-compose up -d 7 

Navigate to port 127.0.0.1:80 (or your DOCKER_HOST).

Next Steps

* Get a trial license key by contacting Codecov Self-Hosted Sales.
* Configure your setup via the codecov.yml. Learn more at Configuration.

Codecov Self-Hosted will not run without a trial license key.

❗️ Receiving following error?

ERROR: Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?

1. service docker start

2. Try sudo: sudo docker-compose up -d

Logs

Shell

1# all logs 2docker-compose logs -f 3# just web logs 4docker-compose logs -f web 5 

Upgrading

To upgrade Codecov, please follow the directions below.

Shell

1docker-compose pull                                              # pull new version 2docker-compose stop web worker             # stop old containers 3docker-compose rm -f web worker            # remove old containers 4docker-compose up -d --no-deps web worker  # start new containers 5docker-compose restart nginx                       # restart nginx 6 
  • New versions are tagged here.

  • The Docker latest version will be updated with stable releases, which may slightly lag tagged releases.

Restarting

It is important to restart nginxweb, and worker when changing configuration.

Shell

1docker-compose restart web worker nginx 2 

If you change the docker-compose.yml you will need to down/up the services as demonstrated next.

Text

1docker-compose down 2docker-compose up -d 3 

Scaling Nodes

Coming soon.

Enable SSL

To enable SSL, please follow the directions below.

Add SSL server in nginx.conf.

nginx.conf

 
1...other nginx.conf is above... 2    keepalive_timeout 65; 3 4    # REMOVE OLD SERVER 5    # server { 6    #     listen          80; 7    # 8    #     location / { 9    #         proxy_pass_header Server; 10    #         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 11    #         proxy_set_header X-Real-IP $remote_addr; 12    #         proxy_set_header X-Scheme $scheme; 13    #         proxy_set_header Host $http_host; 14    #         proxy_redirect off; 15    #         proxy_pass http://frontends; 16    #     } 17    # } 18 19    # ADD NEW SERVER FOR 80 and 443 20    server { 21       listen         80; 22       return         301 https://$host$request_uri; 23       client_max_body_size  0;  # accept all file upload sizes 24    } 25 26    server { 27        listen                     443; 28        keepalive_timeout          5; 29        ssl                        on; 30        ssl_certificate            /etc/nginx/codecov.crt; 31        ssl_certificate_key        /etc/nginx/codecov.key; 32        ssl_session_cache          shared:SSL:10m; 33        ssl_session_timeout        10m; 34        ssl_protocols              TLSv1.2; 35        ssl_prefer_server_ciphers  on; 36        ssl_ciphers                ECDHE-RSA-AES256-SHA384:AES256-SHA256:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM:!3DES; 37        client_max_body_size  0;  # accept all file upload sizes 38    39        location / { 40            proxy_pass_header Server; 41            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 42            proxy_set_header X-Real-IP $remote_addr; 43            proxy_set_header X-Scheme $scheme; 44            proxy_set_header Host $http_host; 45            proxy_redirect off; 46            proxy_pass http://frontends; 47        } 48    } 4950 

Include certificates in docker-compose.yml.

docker-compose.yml

 
1services: 2  nginx: 3    volumes: 4      - ./codecov.crt:/etc/nginx/codecov.crt:ro 5      - ./codecov.key:/etc/nginx/codecov.key:ro 6 

Once you have adjusted both the nginx.conf and the docker-compose.yml, restart the system via docker-compose down && docker-compose up -d.

Report archiving

Report archiving is enabled by default. Codecov will store uploaded reports in their raw, unprocessed form. This can help debug coverage, and reduce vendor lock-in.

Enabled

docker-compose.yml

1services: 2  web: 3    volumes: 4      - archive-volume:/archive 5  worker: 6    volumes: 7      - archive-volume:/archive 8volumes: 9  archive-volume: 10 

Disabled

docker-compose.yml

1services: 2  web: 3    volumes: 4      # - archive-volume:/archive 5  worker: 6    volumes: 7      # - archive-volume:/archive 8volumes: 9  # archive-volume: 10 

The archive folder may get very large over time.

Depending on your usage, the archive folder may become very large. We recommend mounting a NFS drive that can scale with demand.

Adding SSL pem for your git provider

Do you have a self-signed certificate with your git service provider? Please follow these directions to include the cert.pem to enable ssl communication.

Provide the certificate in the volume list when starting Codecov. It is important to name the file after the service provider listed in your configuration.

docker-compose.yml

1services: 2  web: 3    volumes: 4      - ./github_enterprise.pem:/config/github_enterprise.pem:ro 5  worker: 6    volumes: 7      - ./github_enterprise.pem:/config/github_enterprise.pem:ro 8 

❗️ Docker Single Container

Codecov does not provide support for Docker Single Container deployments

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more