Skip to content

Build: always use gvisor Docker runtime #10469

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

Merged
merged 2 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/dev/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Set up your environment

pip install -r common/dockerfiles/requirements.txt

#. Set up gVisor following :doc:`rtd-dev:guides/gvisor`.

#. Build the Docker image for the servers:

.. warning::
Expand Down
2 changes: 0 additions & 2 deletions readthedocs/doc_builder/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,12 @@ def create_vcs_environment(self):
)

def create_build_environment(self):
use_gvisor = self.data.config.using_build_tools and self.data.config.build.jobs
self.build_environment = self.data.environment_class(
project=self.data.project,
version=self.data.version,
config=self.data.config,
build=self.data.build,
environment=self.get_build_env_vars(),
use_gvisor=use_gvisor,
api_client=self.data.api_client,
)

Expand Down
8 changes: 1 addition & 7 deletions readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,15 +564,11 @@ class DockerBuildEnvironment(BaseBuildEnvironment):

def __init__(self, *args, **kwargs):
container_image = kwargs.pop("container_image", None)
self.use_gvisor = kwargs.pop("use_gvisor", False)
super().__init__(*args, **kwargs)
self.client = None
self.container = None
self.container_name = self.get_container_name()

if self.project.has_feature(Feature.DOCKER_GVISOR_RUNTIME):
self.use_gvisor = True

# Decide what Docker image to use, based on priorities:
# The image set by user or,
if self.config and self.config.docker_image:
Expand Down Expand Up @@ -799,12 +795,10 @@ def create_container(self):
"""Create docker container."""
client = self.get_client()
try:
docker_runtime = "runsc" if self.use_gvisor else None
log.info(
'Creating Docker container.',
container_image=self.container_image,
container_id=self.container_id,
docker_runtime=docker_runtime,
)
self.container = client.create_container(
image=self.container_image,
Expand All @@ -819,7 +813,7 @@ def create_container(self):
host_config=self.get_container_host_config(),
detach=True,
user=settings.RTD_DOCKER_USER,
runtime=docker_runtime,
runtime="runsc", # gVisor runtime
)
client.start(container=self.container_id)
except (DockerAPIError, ConnectionError) as exc:
Expand Down
5 changes: 0 additions & 5 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,6 @@ def add_features(sender, **kwargs):
CONDA_APPEND_CORE_REQUIREMENTS = "conda_append_core_requirements"
ALL_VERSIONS_IN_HTML_CONTEXT = "all_versions_in_html_context"
CDN_ENABLED = "cdn_enabled"
DOCKER_GVISOR_RUNTIME = "gvisor_runtime"
RECORD_404_PAGE_VIEWS = "record_404_page_views"
ALLOW_FORCED_REDIRECTS = "allow_forced_redirects"
DISABLE_PAGEVIEWS = "disable_pageviews"
Expand Down Expand Up @@ -1982,10 +1981,6 @@ def add_features(sender, **kwargs):
"are enabled."
),
),
(
DOCKER_GVISOR_RUNTIME,
_("Build: Use Docker gVisor runtime to create build container."),
),
(
RECORD_404_PAGE_VIEWS,
_("Proxito: Record 404s page views."),
Expand Down