Skip to content

Commit 3b4d156

Browse files
authored
fix(compose): Correct dependencies and config files (#148)
1 parent 068b357 commit 3b4d156

8 files changed

+44
-23
lines changed

infrastructure/docker-compose.yaml

+37-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
name: dagster
22

3+
# Postgres variables, used in both the postgres container for configuration,
4+
# and in the dagster services for connecting to the postgres container.
5+
# The variable names are the same in both thanks to the dagster.yaml
6+
# configuration file specifying such.
37
x-postgres-variables: &postgres-variables
48
POSTGRES_USER: ${POSTGRES_USER:-dagster_user}
59
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-dagster_password}
6-
POSTGRES_DB: ${POSTGRES_DB:-dagster_db}
10+
POSTGRES_DB: dagster_db
711
POSTGRES_HOST: "dagster-postgres"
812

913
x-dagster-configs: &dagster-configs
@@ -15,8 +19,7 @@ x-dagster-configs: &dagster-configs
1519

1620
services:
1721
# This service runs the postgres DB used by dagster for run storage, schedule storage,
18-
# and event log storage. Depending on the hardware you run this Compose on, you may be able
19-
# to reduce the interval and timeout in the healthcheck to speed up your `docker-compose up` times.
22+
# and event log storage.
2023
dagster-postgres:
2124
image: postgres:16
2225
container_name: dagster-postgres
@@ -37,8 +40,9 @@ services:
3740
# run launcher to use this same image when launching runs in a new container as well.
3841
dagster-codeserver:
3942
container_name: dagster-codeserver
40-
image: ghcr.io/openclimatefix/dagster-dags:devsjc-code-container
43+
image: ghcr.io/openclimatefix/dagster-dags:latest
4144
restart: always
45+
pull_policy: always
4246
environment:
4347
<<: *postgres-variables
4448
DAGSTER_CURRENT_IMAGE: "ghcr.io/openclimatefix/dagster-dags"
@@ -53,6 +57,8 @@ services:
5357
container_name: dagster-webserver
5458
image: dagster/dagster-k8s:latest
5559
command: ["dagster-webserver", "-h", "0.0.0.0", "-p", "3008", "-w", "/opt/dagster/home/workspace.yaml"]
60+
post_start:
61+
- command: ["pip", "install", "dagster-docker"] # Required for using dagster_docker Pipes
5662
ports:
5763
- "3008:3008"
5864
environment:
@@ -67,7 +73,7 @@ services:
6773
depends_on:
6874
dagster-postgres:
6975
condition: service_healthy
70-
dagster-codeserver_local-archives:
76+
dagster-codeserver:
7177
condition: service_started
7278

7379
# This service runs the dagster-daemon process, which is responsible for taking runs
@@ -76,6 +82,8 @@ services:
7682
container_name: dagster-daemon
7783
image: dagster/dagster-k8s:latest
7884
command: ["dagster-daemon", "run", "-w", "/opt/dagster/home/workspace.yaml"]
85+
post_start:
86+
- command: ["pip", "install", "dagster-docker"] # Required for using dagster_docker Pipes
7987
restart: on-failure
8088
environment:
8189
<<: *postgres-variables
@@ -89,7 +97,7 @@ services:
8997
depends_on:
9098
dagster-postgres:
9199
condition: service_healthy
92-
dagster-codeserver_local-archives:
100+
dagster-codeserver:
93101
condition: service_started
94102

95103
networks:
@@ -118,35 +126,48 @@ configs:
118126
postgres_db:
119127
username: {"env": "POSTGRES_USER"}
120128
password: {"env": "POSTGRES_PASSWORD"}
121-
hostname: {"env": "POSTGRES_HOST"}
122-
db_name: {"env": "POSTGRES_DB"}
129+
hostname: dagster-postgres
130+
db_name: dagster_db
123131
port: 5432
124132
125133
local_artifact_storage:
126134
module: dagster.core.storage.root
127135
class: LocalArtifactStorage
128136
config:
129-
base_dir: "/opt/dagster/local/"
137+
base_dir: "/opt/dagster/local"
130138
131139
run_coordinator:
132140
module: dagster.core.run_coordinator
133141
class: QueuedRunCoordinator
134142
config:
135-
max_concurrent_runs: 30
143+
max_concurrent_runs: 15
136144
tag_concurrency_limits:
137145
- key: "dagster/backfill"
138-
limit: 15
146+
limit: 10
139147
- key: "nwp-consumer"
140-
limit: 1
148+
limit: 5
141149
142150
run_launcher:
143151
module: dagster_docker
144152
class: DockerRunLauncher
145153
config:
146-
env_vars:
147-
- POSTGRES_USER
148-
- POSTGRES_PASSWORD
149-
- POSTGRES_DB
154+
network: dagster-network
155+
env_vars:
156+
- ENVIRONMENT=leo
157+
- ECMWF_API_KEY=<YOUR_API_KEY>
158+
- ECMWF_URL=<YOUR_URL>
159+
- ECMWF_EMAIL=<YOUR_EMAIL>
160+
- EUMETSAT_CONSUMER_KEY=<YOUR_CONSUMER_KEY>
161+
- EUMETSAT_CONSUMER_SECRET=<YOUR_CONSUMER_SECRET>
162+
- CEDA_FTP_USER=<YOUR_USERNAME>
163+
- CEDA_FTP_PASS=<YOUR_PASSWORD>
164+
- HUGGINGFACE_TOKEN=<YOUR_HF_TOKEN>
165+
- SS_USER_ID=<YOUR_USERID>
166+
- SS_API_KEY=<YOUR_API_KEY>
167+
container_kwargs:
168+
volumes:
169+
- /var/run/docker.sock:/var/run/docker.sock # So jobs can launch docker pipes assets
170+
- <YOUR_STORAGE_PATH>:/opt/dagster/local
150171
151172
retention:
152173
schedule:

src/dagster_dags/assets/air/cams_eu.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
ARCHIVE_FOLDER = "/var/dagster-storage/air/cams-europe"
2121
if os.getenv("ENVIRONMENT", "local") == "leo":
22-
ARCHIVE_FOLDER = "/mnt/storage_b/air/cams-europe"
22+
ARCHIVE_FOLDER = "/mnt/storage_ssd_4tb/air/cams-europe"
2323

2424
partitions_def: dg.TimeWindowPartitionsDefinition = dg.WeeklyPartitionsDefinition(
2525
start_date="2020-02-08",

src/dagster_dags/assets/nwp/ceda_mo_um_global.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
ARCHIVE_FOLDER = "/var/dagster-storage/nwp/ceda-mo-um-global"
2323
if os.getenv("ENVIRONMENT", "local") == "leo":
24-
ARCHIVE_FOLDER = "/mnt/storage_b/nwp/ceda-mo-um-global"
24+
ARCHIVE_FOLDER = "/mnt/storage_ssd_4tb/nwp/ceda-mo-um-global"
2525

2626
partitions_def: dg.TimeWindowPartitionsDefinition = dg.MonthlyPartitionsDefinition(
2727
start_date="2019-01-01",

src/dagster_dags/assets/nwp/ecmwf_ens_stat_india.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
ARCHIVE_FOLDER = "/var/dagster-storage/nwp/ecmwf-ens-stat-india"
2323
if os.getenv("ENVIRONMENT", "local") == "leo":
24-
ARCHIVE_FOLDER = "/mnt/storage_b/nwp/ecmwf-ens-stat-india"
24+
ARCHIVE_FOLDER = "/mnt/storage_ssd_4tb/nwp/ecmwf-ens-stat-india"
2525

2626
partitions_def: dg.TimeWindowPartitionsDefinition = dg.MonthlyPartitionsDefinition(
2727
start_date="2020-01-01",

src/dagster_dags/assets/nwp/ecmwf_hres_ifs_india.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
ARCHIVE_FOLDER = "/var/dagster-storage/nwp/ecmwf-hres-ifs-india"
2222
if os.getenv("ENVIRONMENT", "local") == "leo":
23-
ARCHIVE_FOLDER = "/mnt/storage_b/nwp/ecmwf-hres-ifs-india"
23+
ARCHIVE_FOLDER = "/mnt/storage_ssd_4tb/nwp/ecmwf-hres-ifs-india"
2424

2525
partitions_def: dg.TimeWindowPartitionsDefinition = dg.MonthlyPartitionsDefinition(
2626
start_date="2017-01-01",

src/dagster_dags/assets/nwp/ecmwf_hres_ifs_west_europe.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
ARCHIVE_FOLDER = "/var/dagster-storage/nwp/ecmwf-hres-ifs-west-europe"
2222
if os.getenv("ENVIRONMENT", "local") == "leo":
23-
ARCHIVE_FOLDER = "/mnt/storage_b/nwp/ecmwf-hres-ifs-west-europe"
23+
ARCHIVE_FOLDER = "/mnt/storage_ssd_4tb/nwp/ecmwf-hres-ifs-west-europe"
2424

2525
partitions_def: dg.TimeWindowPartitionsDefinition = dg.MonthlyPartitionsDefinition(
2626
start_date="2017-01-01",

src/dagster_dags/assets/nwp/noaa-gfs-global.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
ARCHIVE_FOLDER = "/var/dagster-storage/nwp/ncep-gfs-global"
2323
if os.getenv("ENVIRONMENT", "local") == "leo":
24-
ARCHIVE_FOLDER = "/mnt/storage_b/nwp/ncep-gfs-global"
24+
ARCHIVE_FOLDER = "/mnt/storage_ssd_4tb/nwp/ncep-gfs-global"
2525

2626
partitions_def: dg.TimeWindowPartitionsDefinition = dg.MonthlyPartitionsDefinition(
2727
start_date="2021-01-01",

src/dagster_dags/assets/sat/eumetsat_iodc_lrv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
ARCHIVE_FOLDER = "/var/dagster-storage/sat/eumetsat-iodc-lrv"
2323
if os.getenv("ENVIRONMENT", "local") == "leo":
24-
ARCHIVE_FOLDER = "/mnt/storage_b/sat/eumetsat-iodc-lrv"
24+
ARCHIVE_FOLDER = "/mnt/storage_ssd_4tb/sat/eumetsat-iodc-lrv"
2525

2626
partitions_def: dg.TimeWindowPartitionsDefinition = dg.MonthlyPartitionsDefinition(
2727
start_date="2019-01-01",

0 commit comments

Comments
 (0)