File tree Expand file tree Collapse file tree 5 files changed +40
-19
lines changed
Expand file tree Collapse file tree 5 files changed +40
-19
lines changed Original file line number Diff line number Diff line change @@ -349,32 +349,37 @@ to define the helper functions as locally as possible.
349349
350350### Main application
351351
352- The ` main .py` can be as simple as shown below, and can be deployed by a
352+ The ` wsgi .py` can be as simple as shown below, and can be deployed by a
353353ASGI server like Uvicorn[ ^ 5 ] .
354354
355355``` python
356356from orchestrator import OrchestratorCore
357- from orchestrator.cli.main import app as core_cli
358357from orchestrator.settings import AppSettings
359358
360359import products
361360import workflows
362361
363362app = OrchestratorCore(base_settings = AppSettings())
364363app.register_graphql()
365-
366- if __name__ == " __main__" :
367- core_cli()
368364```
369365
370366All other orchestrator code is referenced by importing the ` products `
371367and ` workflows ` modules. The application is started with:
372368
373369``` shell
374- uvicorn --host localhost --port 8080 main:app
370+ uvicorn --host localhost --port 8080 wsgi:app
371+ ```
372+
373+ To use the orchestrator command line interface create a ` main.py ` like below:
374+
375+ ``` python
376+ from orchestrator.cli.main import app as core_cli
377+
378+ if __name__ == " __main__" :
379+ core_cli()
375380```
376381
377- To use the orchestrator command line interface use :
382+ Run the CLI using :
378383
379384``` shell
380385python main.py --help
Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ services:
183183 - ./migrations:/home/orchestrator/migrations
184184 - ./docker:/home/orchestrator/etc
185185 - ./main.py:/home/orchestrator/main.py
186+ - ./wsgi.py:/home/orchestrator/wsgi.py
186187 - ./settings.py:/home/orchestrator/settings.py
187188 - ./graphql_federation.py:/home/orchestrator/graphql_federation.py
188189 - ./utils:/home/orchestrator/utils
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ if [ -f ${CORE_OVERRIDE}/pyproject.toml ]; then
2727 # Run any missing migrations on the database
2828 python main.py db upgrade heads
2929
30- uvicorn --host 0.0.0.0 --port 8080 $UVICORN_ARGS main :app --reload --proxy-headers \
30+ uvicorn --host 0.0.0.0 --port 8080 $UVICORN_ARGS wsgi :app --reload --proxy-headers \
3131 --reload-dir $CORE_OVERRIDE \
3232 --reload-dir products \
3333 --reload-dir services \
3939 python main.py db upgrade heads
4040
4141 echo " ⏭️ Use orchestrator-core as specified in pyproject.toml $( uv pip freeze | grep orchestrator-core) "
42- uvicorn --host 0.0.0.0 --port 8080 $UVICORN_ARGS main :app --reload --proxy-headers
43- fi
42+ uvicorn --host 0.0.0.0 --port 8080 $UVICORN_ARGS wsgi :app --reload --proxy-headers
43+ fi
Original file line number Diff line number Diff line change 1- # Copyright 2019-2023 SURF.
1+ # Copyright 2019-2025 SURF, ESnet, GÉANT .
22# Licensed under the Apache License, Version 2.0 (the "License");
33# you may not use this file except in compliance with the License.
44# You may obtain a copy of the License at
1212# limitations under the License.
1313
1414
15- from orchestrator import OrchestratorCore
1615from orchestrator .cli .main import app as core_cli
17- from orchestrator .settings import AppSettings
1816
19- from graphql_federation import CUSTOM_GRAPHQL_MODELS
20- import products # noqa: F401 Side-effects
21- import workflows # noqa: F401 Side-effects
22-
23- app = OrchestratorCore (base_settings = AppSettings ())
24- app .register_graphql (graphql_models = CUSTOM_GRAPHQL_MODELS )
2517
2618if __name__ == "__main__" :
2719 core_cli ()
Original file line number Diff line number Diff line change 1+ # Copyright 2019-2025 SURF, ESnet, GÉANT.
2+ # Licensed under the Apache License, Version 2.0 (the "License");
3+ # you may not use this file except in compliance with the License.
4+ # You may obtain a copy of the License at
5+ #
6+ # http://www.apache.org/licenses/LICENSE-2.0
7+ #
8+ # Unless required by applicable law or agreed to in writing, software
9+ # distributed under the License is distributed on an "AS IS" BASIS,
10+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+ # See the License for the specific language governing permissions and
12+ # limitations under the License.
13+
14+
15+ from orchestrator import OrchestratorCore
16+ from orchestrator .settings import AppSettings
17+
18+ from graphql_federation import CUSTOM_GRAPHQL_MODELS
19+ import products # noqa: F401 Side-effects
20+ import workflows # noqa: F401 Side-effects
21+
22+ app = OrchestratorCore (base_settings = AppSettings ())
23+ app .register_graphql (graphql_models = CUSTOM_GRAPHQL_MODELS )
You can’t perform that action at this time.
0 commit comments