-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add build logic for Dagster container images
As part of the updated build/deployment we want to have separate images for the Dagit and dagaster-daemon processes, which are also separate from the user pipeline code so that they can all be built, deployed, and scaled independently. For the user pipelines we also want to ensure that the dbt project is available in the runtime environment. This does the following: - Copy all files related to the dbt project into user pipeline images by default - Create a multi-stage build for Dagit/dagster-daemon to avoid duplicate logic - Moves the Dagster-specific workspace and Dagster yaml files into the `ol_orchestrate` directory - Moves the dbt project files to the proper directory level in the repo - Adds the initial work to package up collections of Dagster pipelines based on the 'repository' as the entry-point for the Python distribution
- Loading branch information
1 parent
3579bc3
commit 863294a
Showing
23 changed files
with
115 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
docker_image( | ||
name="docker", | ||
name="dagit", | ||
source="Dockerfile.dagit", | ||
dependencies=[ | ||
"src/ol_orchestrate:dagit", | ||
"src/ol_orchestrate:dagster-daemon", | ||
"src/ol_orchestrate:project-config", | ||
], | ||
target_stage="dagit" | ||
) | ||
|
||
docker_image( | ||
name="docker0", | ||
name="dagster-daemon", | ||
source="Dockerfile.dagit", | ||
dependencies=[ | ||
"src/ol_orchestrate:dagster-daemon", | ||
"src/ol_orchestrate:project-config", | ||
], | ||
target_stage="dagster-daemon" | ||
) | ||
|
||
docker_image( | ||
name="pipeline", | ||
dependencies=[ | ||
"src/ol_orchestrate:open-edx", | ||
"src/ol_dbt:dbt_project" | ||
], | ||
source="Dockerfile.user_pipeline", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
FROM python:3.9-slim AS dagster-base | ||
RUN mkdir -p /opt/dagster/dagster_home /opt/dagster/app | ||
RUN useradd -s /bin/bash -d /opt/dagster/dagster_home/ dagster | ||
RUN chown -R dagster: /opt/dagster/ | ||
RUN mkdir -p /opt/dagster/dagster_home /opt/dagster/app && \ | ||
useradd -s /bin/bash -d /opt/dagster/dagster_home/ dagster &&\ | ||
chown -R dagster: /opt/dagster/ | ||
USER dagster | ||
ENV DAGSTER_HOME=/opt/dagster/dagster_home/ | ||
|
||
# Copy your code and workspace to /opt/dagster/app | ||
COPY workspace.yaml /opt/dagster/app/ | ||
COPY --chown=dagster:dagster src/ol_orchestrate/workspace.yaml /opt/dagster/app/ | ||
|
||
# Copy dagster instance YAML to $DAGSTER_HOME | ||
COPY dagster.yaml /opt/dagster/dagster_home/ | ||
COPY --chown=dagster:dagster src/ol_orchestrate/dagster.yaml /opt/dagster/dagster_home/ | ||
|
||
WORKDIR /opt/dagster/app | ||
|
||
EXPOSE 3000 | ||
|
||
FROM dagster-base AS dagit | ||
ENTRYPOINT ["dagit", "-h", "0.0.0.0", "-p", "3000"] | ||
|
||
FROM dagster-base AS dagster-daemon | ||
COPY --chown=dagster:dagster src.ol_orchestrate/dagster-daemon.pex /usr/local/bin/dagster-daemon | ||
ENTRYPOINT ["dagster-daemon", "run"] | ||
|
||
FROM dagster-base AS dagit | ||
COPY --chown=dagster:dagster src.ol_orchestrate/dagit.pex /usr/local/bin/dagit | ||
ENTRYPOINT ["dagit", "-h", "0.0.0.0", "-p", "3000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
FROM python:3.9-slim | ||
|
||
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4000", ] | ||
RUN mkdir -p /opt/dagster/dagster_home /opt/dagster/app /tmp/packages && \ | ||
useradd -s /bin/bash -d /opt/dagster/dagster_home/ dagster | ||
COPY *.whl /tmp/packages/ | ||
RUN pip install --no-cache-dir /tmp/packages/* && rm -r /tmp/packages/ | ||
COPY --chown=dagster:dagster src/ol_dbt/ /opt/dbt/ | ||
USER dagster | ||
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4000"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
files( | ||
name="dbt_project", | ||
sources=["**/*.yml", "**/*.json", "**/*.sql", "**/*.yaml"], | ||
) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
postgres_config: &postgres_config | ||
config: | ||
postgres_db: | ||
username: | ||
env: DAGSTER_PG_USERNAME | ||
password: | ||
env: DAGSTER_PG_PASSWORD | ||
hostname: | ||
env: DAGSTER_PG_HOST | ||
db_name: | ||
env: dagster | ||
port: 5432 | ||
|
||
telemetry: | ||
enabled: true | ||
scheduler: | ||
module: dagster.core.scheduler | ||
class: DagsterDaemonScheduler | ||
compute_logs: | ||
module: dagster_aws.s3.compute_log_manager | ||
class: S3ComputeLogManager | ||
config: | ||
bucket: dagster-{{ environment }} | ||
prefix: compute-logs/ | ||
run_storage: | ||
module: dagster_postgres.run_storage | ||
class: PostgresRunStorage | ||
config: | ||
<<: *postgres_config | ||
event_log_storage: | ||
module: dagster_postgres.event_log | ||
class: PostgresEventLogStorage | ||
config: | ||
<<: *postgres_config | ||
schedule_storage: | ||
module: dagster_postgres.schedule_storage | ||
class: PostgresScheduleStorage | ||
config: | ||
<<: *postgres_config |
File renamed without changes.