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(docker) Add platform to docker-compose command #5683

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/dev-with-cassandra.sh
Expand Up @@ -23,13 +23,13 @@ fi
# YOU MUST BUILD VIA GRADLE BEFORE RUNNING THIS.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR && \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM="$(uname -m)" docker-compose \
-f docker-compose-with-cassandra.yml \
-f docker-compose.dev.yml \
$CONSUMERS_COMPOSE $MONITORING_COMPOSE $M1_COMPOSE \
pull \
&& \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -p datahub \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM="$(uname -m)" docker-compose -p datahub \
-f docker-compose-with-cassandra.yml \
-f docker-compose.dev.yml \
$CONSUMERS_COMPOSE $MONITORING_COMPOSE $M1_COMPOSE \
Expand Down
4 changes: 2 additions & 2 deletions docker/dev-without-neo4j.sh
Expand Up @@ -22,13 +22,13 @@ fi
# YOU MUST BUILD VIA GRADLE BEFORE RUNNING THIS.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR && \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM="$(uname -m)" docker-compose \
-f docker-compose-without-neo4j.yml \
-f docker-compose-without-neo4j.override.yml \
-f docker-compose.dev.yml \
$CONSUMERS_COMPOSE $MONITORING_COMPOSE $M1_COMPOSE pull \
&& \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -p datahub \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM="$(uname -m)" docker-compose -p datahub \
-f docker-compose-without-neo4j.yml \
-f docker-compose-without-neo4j.override.yml \
-f docker-compose.dev.yml \
Expand Down
4 changes: 2 additions & 2 deletions docker/dev.sh
Expand Up @@ -23,13 +23,13 @@ fi
# YOU MUST BUILD VIA GRADLE BEFORE RUNNING THIS.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR && \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM="$(uname -m)" docker-compose \
-f docker-compose.yml \
-f docker-compose.override.yml \
-f docker-compose.dev.yml \
$CONSUMERS_COMPOSE $MONITORING_COMPOSE $M1_COMPOSE pull \
&& \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -p datahub \
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 DOCKER_DEFAULT_PLATFORM="$(uname -m)" docker-compose -p datahub \
-f docker-compose.yml \
-f docker-compose.override.yml \
-f docker-compose.dev.yml \
Expand Down
2 changes: 1 addition & 1 deletion docker/quickstart.sh
Expand Up @@ -37,7 +37,7 @@ then
else
echo "No Datahub Neo4j volume found, starting with elasticsearch as graph service"
cd $DIR && \
docker-compose -p datahub \
DOCKER_DEFAULT_PLATFORM="$(uname -m)" docker-compose -p datahub \
-f quickstart/docker-compose-without-neo4j.quickstart.yml \
$MONITORING_COMPOSE $CONSUMERS_COMPOSE $M1_COMPOSE up $@
fi
Expand Up @@ -56,6 +56,12 @@
GITHUB_M1_QUICKSTART_COMPOSE_URL = f"{GITHUB_BASE_URL}/{M1_QUICKSTART_COMPOSE_FILE}"
GITHUB_BOOTSTRAP_MCES_URL = f"{GITHUB_BASE_URL}/{BOOTSTRAP_MCES_FILE}"

DOCKER_COMPOSE_PLATFORM = (
subprocess.run(["uname", "-m"], stdout=subprocess.PIPE)
.stdout.decode("utf-8")
.rstrip()
)


@click.group()
def docker() -> None:
Expand Down Expand Up @@ -208,6 +214,10 @@ def _attempt_stop(quickstart_compose_file: List[pathlib.Path]) -> None:
subprocess.run(
[*base_command, "stop"],
check=True,
env={
**os.environ,
"DOCKER_DEFAULT_PLATFORM": DOCKER_COMPOSE_PLATFORM,
},
)
click.secho("Stopped datahub successfully.", fg="green")
except subprocess.CalledProcessError:
Expand Down Expand Up @@ -638,6 +648,10 @@ def quickstart(
subprocess.run(
[*base_command, "pull", "-q"],
check=True,
env={
**os.environ,
"DOCKER_DEFAULT_PLATFORM": DOCKER_COMPOSE_PLATFORM,
},
)
click.secho("Finished pulling docker images!")
except subprocess.CalledProcessError:
Expand All @@ -659,6 +673,7 @@ def quickstart(
check=True,
env={
**os.environ,
"DOCKER_DEFAULT_PLATFORM": DOCKER_COMPOSE_PLATFORM,
"DOCKER_BUILDKIT": "1",
},
)
Expand All @@ -674,7 +689,13 @@ def quickstart(
# Attempt to run docker compose up every minute.
if (datetime.datetime.now() - start_time) > up_attempts * up_interval:
click.echo()
subprocess.run(base_command + ["up", "-d", "--remove-orphans"])
subprocess.run(
base_command + ["up", "-d", "--remove-orphans"],
env={
**os.environ,
"DOCKER_DEFAULT_PLATFORM": DOCKER_COMPOSE_PLATFORM,
},
)
up_attempts += 1

# Check docker health every few seconds.
Expand All @@ -694,6 +715,10 @@ def quickstart(
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
check=True,
env={
**os.environ,
"DOCKER_DEFAULT_PLATFORM": DOCKER_COMPOSE_PLATFORM,
},
)
log_file.write(ret.stdout)

Expand Down
2 changes: 1 addition & 1 deletion metadata-ingestion/src/datahub/entrypoints.py
Expand Up @@ -11,7 +11,7 @@
from datahub.cli.check_cli import check
from datahub.cli.cli_utils import DATAHUB_CONFIG_PATH, write_datahub_config
from datahub.cli.delete_cli import delete
from datahub.cli.docker import docker
anshbansal marked this conversation as resolved.
Show resolved Hide resolved
from datahub.cli.docker_cli import docker
from datahub.cli.get_cli import get
from datahub.cli.ingest_cli import ingest
from datahub.cli.migrate import migrate
Expand Down
2 changes: 1 addition & 1 deletion smoke-test/tests/utils.py
Expand Up @@ -6,7 +6,7 @@
import requests

from datahub.cli import cli_utils
from datahub.cli.docker import check_local_docker_containers
from datahub.cli.docker_cli import check_local_docker_containers
from datahub.ingestion.run.pipeline import Pipeline


Expand Down