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

Fix #3236: Add support for secure docker compose with an env file #3241

Merged
merged 2 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/openmetadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ authorizerConfiguration:
adminPrincipals:
- ${AUTHORIZER_ADMIN_PRINCIPALS:-admin}
botPrincipals:
- ${AUTHORIZER_INGESTION_PRINCIPAL:-ingestion-bot]}
- ${AUTHORIZER_INGESTION_PRINCIPAL:-ingestion-bot}
principalDomain: ${AUTHORIZER_PRINCIPAL_DOMAIN:-""}

authenticationConfiguration:
Expand Down
10 changes: 10 additions & 0 deletions docker/local-metadata/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ services:
environment:
ELASTICSEARCH_HOST: elasticsearch
AIRFLOW_HOST: ingestion
AUTHORIZER_CLASS_NAME: ${AUTHORIZER_CLASS_NAME:-org.openmetadata.catalog.security.NoopAuthorizer}
AUTHORIZER_REQUEST_FILTER: ${AUTHORIZER_REQUEST_FILTER:-org.openmetadata.catalog.security.NoopFilter}
AUTHORIZER_ADMIN_PRINCIPALS: ${AUTHORIZER_ADMIN_PRINCIPALS:-admin}
AUTHORIZER_INGESTION_PRINCIPAL: ${AUTHORIZER_INGESTION_PRINCIPAL:-ingestion-bot}
AUTHORIZER_PRINCIPAL_DOMAIN: ${AUTHORIZER_PRINCIPAL_DOMAIN:-""}
AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-no-auth}
AUTHENTICATION_PUBLIC_KEY: ${AUTHENTICATION_PUBLIC_KEY:-https://www.googleapis.com/oauth2/v3/certs}
AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com}
AUTHENTICATION_CLIENT_ID: ${AUTHENTICATION_CLIENT_ID:-""}
AUTHENTICATION_CALLBACK_URL: ${AUTHENTICATION_CALLBACK_URL:-""}
expose:
- 8585
- 9200
Expand Down
10 changes: 10 additions & 0 deletions docker/metadata/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ services:
environment:
ELASTICSEARCH_HOST: elasticsearch
AIRFLOW_HOST: ingestion
AUTHORIZER_CLASS_NAME: ${AUTHORIZER_CLASS_NAME:-org.openmetadata.catalog.security.NoopAuthorizer}
AUTHORIZER_REQUEST_FILTER: ${AUTHORIZER_REQUEST_FILTER:-org.openmetadata.catalog.security.NoopFilter}
AUTHORIZER_ADMIN_PRINCIPALS: ${AUTHORIZER_ADMIN_PRINCIPALS:-admin}
AUTHORIZER_INGESTION_PRINCIPAL: ${AUTHORIZER_INGESTION_PRINCIPAL:-ingestion-bot}
AUTHORIZER_PRINCIPAL_DOMAIN: ${AUTHORIZER_PRINCIPAL_DOMAIN:-""}
AUTHENTICATION_PROVIDER: ${AUTHENTICATION_PROVIDER:-no-auth}
AUTHENTICATION_PUBLIC_KEY: ${AUTHENTICATION_PUBLIC_KEY:-https://www.googleapis.com/oauth2/v3/certs}
AUTHENTICATION_AUTHORITY: ${AUTHENTICATION_AUTHORITY:-https://accounts.google.com}
AUTHENTICATION_CLIENT_ID: ${AUTHENTICATION_CLIENT_ID:-""}
AUTHENTICATION_CALLBACK_URL: ${AUTHENTICATION_CALLBACK_URL:-""}
expose:
- 8585
- 9200
Expand Down
11 changes: 10 additions & 1 deletion ingestion/src/metadata/cli/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
min_memory_limit = 3 * calc_gb


def run_docker(start, stop, pause, resume, clean, file_path):
def run_docker(start, stop, pause, resume, clean, file_path, env_file_path):
try:
from python_on_whales import DockerClient

Expand Down Expand Up @@ -69,10 +69,19 @@ def run_docker(start, stop, pause, resume, clean, file_path):
logger.info(f"Using docker compose file from {file_path}")
docker_compose_file_path = pathlib.Path(file_path)

env_file = None
if env_file_path is not None:
if env_file_path == "":
raise ValueError("Please provide path to env file")
else:
logger.info(f"Using env file from {env_file_path}")
env_file = pathlib.Path(env_file_path)

# Set up Docker Client Config with docker compose file path
docker = DockerClient(
compose_project_name="openmetadata",
compose_files=[docker_compose_file_path],
compose_env_file=env_file
)

if start:
Expand Down
11 changes: 9 additions & 2 deletions ingestion/src/metadata/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,20 @@ def report(config: str) -> None:
type=click.Path(exists=True, dir_okay=False),
required=False,
)
def docker(start, stop, pause, resume, clean, file_path) -> None:
@click.option(
"-env-file",
"--env-file-path",
help="Path to env file containing the environment variables",
type=click.Path(exists=True, dir_okay=False),
required=False,
)
def docker(start, stop, pause, resume, clean, file_path, env_file_path) -> None:
"""
Checks Docker Memory Allocation
Run Latest Release Docker - metadata docker --start
Run Local Docker - metadata docker --start -f path/to/docker-compose.yml
"""
run_docker(start, stop, pause, resume, clean, file_path)
run_docker(start, stop, pause, resume, clean, file_path, env_file_path)


@metadata.command()
Expand Down