Skip to content

Commit

Permalink
New configuration values to disable entrypoint (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
theCapypara authored Oct 7, 2024
1 parent d97b211 commit b3eefc7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "riptide-lib"
version = "0.9.0"
version = "0.9.1"
description = "Tool to manage development environments for web applications using containers - Library Package"
readme = "README.rst"
requires-python = ">=3.8"
Expand Down
11 changes: 11 additions & 0 deletions riptide/config/document/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ def schema_in_service(cls):
If enabled, the container uses network mode `host`. Overrides network and port settings
Default: False
[ignore_original_entrypoint]: bool
If true, Riptide will not run the original entrypoint of the OCI image, but instead run the
command directly, as if no entrypoint was defined in the image.
Note that engines might ignore this setting, if they don't support it.
Default: False
**Example Document:**
.. code-block:: yaml
Expand All @@ -185,6 +192,7 @@ def schema_in_service(cls):
Optional('environment'): {str: str},
Optional('read_env_file'): bool,
Optional('use_host_network'): bool,
Optional('ignore_original_entrypoint'): bool
})

@classmethod
Expand Down Expand Up @@ -215,6 +223,9 @@ def _initialize_data_after_variables(self, data: dict) -> dict:

if "read_env_file" not in self:
data["read_env_file"] = True

if "ignore_original_entrypoint" not in data:
data["ignore_original_entrypoint"] = False
return data

def get_project(self) -> 'Project':
Expand Down
38 changes: 25 additions & 13 deletions riptide/config/document/service.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import warnings
from collections import OrderedDict

from typing import List

from configcrunch import ConfigcrunchError
from configcrunch import variable_helper
from dotenv import dotenv_values
from schema import Schema, Optional, Or

from configcrunch import YamlConfigDocument, ConfigcrunchError
from configcrunch import variable_helper
from riptide.config.document.common_service_command import ContainerDefinitionYamlConfigDocument
from riptide.config.errors import RiptideDeprecationWarning
from riptide.config.files import CONTAINER_SRC_PATH
from riptide.config.service.config_files import *
from riptide.config.service.logging import *

# todo: validate actual schema values -> better schema | ALL documents
from riptide.config.service.ports import get_additional_port
from riptide.config.service.volumes import process_additional_volumes
Expand Down Expand Up @@ -262,7 +259,6 @@ def schema(cls) -> Schema:
or image default. Default is 'auto' which means the value of `run_as_current_user`
will be used.
[allow_full_memlock]: bool
Whether to set memlock ulimit to -1:-1 (soft:hard).
This is required for some database services, such as Elasticsearch.
Expand All @@ -274,6 +270,13 @@ def schema(cls) -> Schema:
If enabled, read the environment variables in the env-files defined in the project (``env_files``).
Default: True
[ignore_original_entrypoint]: bool
If true, Riptide will not run the original entrypoint of the OCI image, but instead run the
command directly, as if no entrypoint was defined in the image.
Note that engines might ignore this setting, if they don't support it.
Default: False
**Example Document:**
.. code-block:: yaml
Expand Down Expand Up @@ -344,7 +347,8 @@ def schema(cls) -> Schema:
Optional('config'): {
str: {
'from': str,
'$source': str, # Path to the document that "from" references. Is added durinng loading of service
'$source': str,
# Path to the document that "from" references. Is added durinng loading of service
'to': str,
Optional('force_recreate'): bool
}
Expand Down Expand Up @@ -383,7 +387,8 @@ def schema(cls) -> Schema:
'name': str,
'config': any # defined by driver
},
Optional('read_env_file'): bool
Optional('read_env_file'): bool,
Optional('ignore_original_entrypoint'): bool
}
)

Expand Down Expand Up @@ -427,6 +432,9 @@ def _initialize_data_after_merge(self, data):
if "read_env_file" not in data:
data["read_env_file"] = True

if "ignore_original_entrypoint" not in data:
data["ignore_original_entrypoint"] = False

if "additional_subdomains" not in data:
data["additional_subdomains"] = []

Expand Down Expand Up @@ -736,8 +744,10 @@ def domain(self) -> str:
something: 'https://project--service.riptide.local'
"""
if "main" in self.internal_get("roles"):
return self.get_project().internal_get("name") + "." + self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]
return self.get_project().internal_get("name") + DOMAIN_PROJECT_SERVICE_SEP + self.internal_get("$name") + "." + self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]
return self.get_project().internal_get("name") + "." + \
self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]
return self.get_project().internal_get("name") + DOMAIN_PROJECT_SERVICE_SEP + self.internal_get("$name") + "." + \
self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]

@variable_helper
def additional_domains(self) -> Dict[str, str]:
Expand All @@ -760,7 +770,9 @@ def additional_domains(self) -> Dict[str, str]:
second: 'https://seccond.project--service.riptide.local'
"""
if "main" in self.internal_get("roles"):
return {subdomain: f'{subdomain}.{self.get_project().internal_get("name")}.{self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]}'
for subdomain in self.internal_get("additional_subdomains")}
return {subdomain: f'{subdomain}.{self.get_project().internal_get("name")}{DOMAIN_PROJECT_SERVICE_SEP}{self.internal_get("$name")}.{self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]}'
return {
subdomain: f'{subdomain}.{self.get_project().internal_get("name")}.{self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]}'
for subdomain in self.internal_get("additional_subdomains")}
return {
subdomain: f'{subdomain}.{self.get_project().internal_get("name")}{DOMAIN_PROJECT_SERVICE_SEP}{self.internal_get("$name")}.{self.parent_doc.parent_doc.parent_doc.internal_get("proxy")["url"]}'
for subdomain in self.internal_get("additional_subdomains")}

0 comments on commit b3eefc7

Please sign in to comment.