Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable HTTPS use Custom Certificates #7508

Merged
merged 21 commits into from
Oct 8, 2024
Merged

Conversation

echowxsy
Copy link
Contributor

@echowxsy echowxsy commented Feb 22, 2024

Motivation and context

fix #4767
my docker-compose.https.yml:

# Copyright (C) 2018-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT

services:
  cvat_server:
    labels:
      - traefik.http.routers.cvat.tls=true
      - traefik.http.routers.cvat.entrypoints=websecure

  cvat_ui:
    labels:
      - traefik.http.routers.cvat-ui.tls=true
      - traefik.http.routers.cvat-ui.entrypoints=websecure

  traefik:
    image: traefik:v2.10
    container_name: traefik
    environment:
      TRAEFIK_ENTRYPOINTS_web_ADDRESS: :80
      TRAEFIK_ENTRYPOINTS_web_HTTP_REDIRECTIONS_ENTRYPOINT_TO: websecure
      TRAEFIK_ENTRYPOINTS_web_HTTP_REDIRECTIONS_ENTRYPOINT_SCHEME: https
      TRAEFIK_ENTRYPOINTS_websecure_ADDRESS: :443
      TRAEFIK_LOG: "true"
      TRAEFIK_ACCESSLOG: "true"
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./tls.yml:/etc/traefik/rules/tls.yml
      - ./certs:/certs

Login page:
image
Traefik Dashboard:
image

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • I have linked related issues (see GitHub docs)
  • I have increased versions of npm packages if it is necessary
    (cvat-canvas,
    cvat-core,
    cvat-data and
    cvat-ui)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive documentation for implementing custom SSL certificates in the CVAT environment.
    • Provided step-by-step instructions for setting up and configuring Traefik to use custom certificates.
  • Documentation

    • Added a new file detailing the process of creating a certificates directory, modifying Traefik configuration, and starting CVAT with custom SSL certificates.

Copy link
Contributor

@azhavoro azhavoro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

docker-compose.https.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
tls.yml Outdated
Comment on lines 1 to 9
tls:
certificates:
- certFile: /certs/your-crt.pem
keyFile: /certs/your-key.pem
stores:
default:
defaultCertificate:
certFile: /certs/your-crt.pem
keyFile: /certs/your-key.pem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this stub file should be added, because it can't be used as it is.
I would ask you to add instructions in the documentation on how to configure the use of custom certificates, and it seems reasonable to me to describe an example traefik tls configuration file in the documentation in the same place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this file and add a document

docker-compose.https.yml Outdated Show resolved Hide resolved
@nmanovic
Copy link
Contributor

nmanovic commented Sep 5, 2024

@echowxsy , could you please add a line into changelog as well about the great contribution?

Copy link
Contributor

coderabbitai bot commented Sep 6, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The new documentation file custom_certificates.md provides detailed instructions for implementing custom SSL certificates in the CVAT environment, which uses Traefik as a reverse proxy. It explains the default behavior of Traefik with Let's Encrypt and offers an alternative for users who prefer to deploy their own certificates, including step-by-step guidance on configuration changes.

Changes

Files Change Summary
site/content/en/docs/administration/advanced/custom_certificates.md Added new documentation for implementing custom SSL certificates in CVAT.

Assessment against linked issues

Objective Addressed Explanation
Using CVAT with HTTPS and institutional certificate (4767)

Poem

In the meadow where I hop and play,
Custom certs now light the way!
Traefik's dance with keys so bright,
CVAT's secure, a joyful sight.
With every leap, I cheer and sing,
For SSL joy that changes spring! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
site/content/en/docs/administration/advanced/custom_certificates.md (2)

8-8: Clarify the role of Traefik as a reverse proxy.

The introduction mentions Traefik's default use of Let's Encrypt but could be expanded to briefly explain why Traefik is used as a reverse proxy in CVAT, enhancing understanding for users unfamiliar with Traefik.


22-34: Add a note to replace placeholder paths in move commands.

The documentation does not currently include a note instructing users to replace /path/to/ with their actual certificate paths. This could lead to confusion. Please add a note to clarify this for users.

  • File: site/content/en/docs/administration/advanced/custom_certificates.md
  • Lines: 22-34
Analysis chain

Ensure the path in the move command is accessible.

The commands to move certificates into the ./certs directory use absolute paths. It's important to ensure that these paths are accessible or to provide a note that users need to replace /path/to/ with the actual path to their certificates.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the provided paths are accessible or if there's a note for users to replace them.

# Test: Search for a note about replacing paths in the documentation.
rg --type markdown -A 5 $'mv /path/to/'

Length of output: 714

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 510fd98 and 01862d9.

Files selected for processing (1)
  • site/content/en/docs/administration/advanced/custom_certificates.md (1 hunks)
Additional comments not posted (3)
site/content/en/docs/administration/advanced/custom_certificates.md (3)

38-47: Verify the file path accuracy in the TLS configuration.

The tls.yml configuration specifies certificate paths as /certs/cert.pem and /certs/key.pem. It's crucial to ensure that these paths are correctly mapped in the Docker configuration to avoid runtime errors.


49-68: Review and validate the Docker Compose configuration changes.

The changes to the docker-compose.https.yml file include environment variables for Traefik and volume mappings. It's important to ensure that these changes are correctly implemented and do not conflict with existing configurations.

Verification successful

No conflicts found between Docker Compose configurations.

The changes in docker-compose.https.yml are intended for HTTPS configurations and do not conflict with the existing HTTP configurations in docker-compose.yml. Ensure that users are aware of the different purposes of these files to avoid accidental simultaneous use. Consider documenting the intended use cases for clarity.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the Docker Compose changes do not conflict with existing configurations.

# Test: Search for potential conflicts in the Docker Compose files.
rg --type yaml -A 5 $'docker-compose.https.yml'

Length of output: 46


Script:

#!/bin/bash
# Search for Traefik-related environment variables in the repository to identify potential conflicts.
rg 'TRAEFIK_' --type yaml

# Find other Docker Compose files in the repository.
fd --type f --name 'docker-compose*.yml'

Length of output: 1528


Script:

#!/bin/bash
# Correct the fd command to list all Docker Compose files.
fd --extension yml --exec echo {}

# Review the context of the configurations in both files to determine their intended use.
rg 'TRAEFIK_' --type yaml -A 5

Length of output: 4147


72-76: Confirm the Docker Compose command's correctness.

The command to start CVAT using Docker Compose includes both docker-compose.yml and docker-compose.https.yml. It's essential to verify that both files are correctly configured to work together without issues.

Verification successful

Docker Compose Command Verified

The Docker Compose command in the documentation is correct. The docker-compose.yml and docker-compose.https.yml files are configured to work together, with the latter adding HTTPS support to the services defined in the former. No issues were found in their configurations.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the Docker Compose files are configured to work together.

# Test: Search for configurations in both Docker Compose files.
rg --type yaml -A 5 $'docker-compose.yml'
rg --type yaml -A 5 $'docker-compose.https.yml'

Length of output: 87


Script:

#!/bin/bash
# Check for the existence of docker-compose.yml and docker-compose.https.yml
fd --type f --name 'docker-compose.yml'
fd --type f --name 'docker-compose.https.yml'

Length of output: 587


Script:

#!/bin/bash
# Correctly check for the existence of docker-compose.yml and docker-compose.https.yml
fd 'docker-compose.yml'
fd 'docker-compose.https.yml'

Length of output: 97


Script:

#!/bin/bash
# Inspect the contents of docker-compose.yml and docker-compose.https.yml
cat docker-compose.yml
cat docker-compose.https.yml

Length of output: 12441

CHANGELOG.md Outdated Show resolved Hide resolved
@azhavoro
Copy link
Contributor

@echowxsy Thanks for the contribution!

@azhavoro
Copy link
Contributor

Could you please fix Remark linter warning?

site/content/en/docs/administration/advanced/custom_certificates.md
  8:202  warning  Line must be at most 120 characters                        maximum-line-length       remark-lint
   13:5  warning  Don’t use mixed indentation for children, remove 2 spaces  list-item-content-indent  remark-lint

@echowxsy
Copy link
Contributor Author

echowxsy commented Oct 6, 2024

Could you please fix Remark linter warning?

Done,I just finished my vacation. so sorry too late.

Copy link

sonarcloud bot commented Oct 7, 2024

@azhavoro
Copy link
Contributor

azhavoro commented Oct 8, 2024

Could you please fix Remark linter warning?

Done,I just finished my vacation. so sorry too late.

Thank you!

@azhavoro azhavoro merged commit 5f27977 into cvat-ai:develop Oct 8, 2024
15 checks passed
@cvat-bot cvat-bot bot mentioned this pull request Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using CVAT with https and institutional certificate
3 participants