You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/5.advanced/1.docker.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,8 @@ docker-compose up -d --build
105
105
106
106
## Docker Swarm
107
107
108
+
Unlike ready-to-use Compose manifest provided by DipDup, Swarm one requires some additional setup.
109
+
108
110
Scaffolded projects contain a compose file for Docker Swarm. Before spawning this stack create external networks `traefik-public` and `prometheus-private`. Optionally, deploy Traefik and Prometheus and attach them to these networks to get a fully functional stack.
Note that `ctx` argument is `click.Context` object, not a `dipdup.context.DipDupContext`! If you need deeper integration with DipDup, use the following code:
71
+
72
+
```python[cli.py]
73
+
from dipdup.dipdup import DipDup
74
+
from dipdup.context import DipDupContext
75
+
76
+
77
+
dipdup: DipDup = DipDup(ctx.obj.config)
78
+
dipdup_ctx: DipDupContext = dipdup._ctx
79
+
```
80
+
81
+
Then create a `__main__.py` file to make the module executable:
82
+
83
+
```python[__main__.py
84
+
from {{ project.package }}.cli import cli
68
85
69
86
if __name__ == '__main__':
70
87
cli(prog_name='dipdup', standalone_mode=True)
71
88
```
72
89
73
-
Then use `python -m {{ project.package }}.cli` instead of `dipdup` as an entrypoint. Now you can call `heavy-stuff` like one of DipDup commands. `dipdup.cli:cli` group handles arguments and config parsing, graceful shutdown, and other boilerplate.
90
+
Then use `python -m {{ project.package }}` instead of `dipdup` as an entrypoint. Now you can call `heavy-stuff` like one of DipDup commands. `dipdup.cli:cli` group handles arguments and config parsing, graceful shutdown, and other boilerplate.
74
91
75
92
```shell [Terminal]
76
-
python -m {{ project.package }}.cli heavy-stuff --key value
93
+
python -m {{ project.package }} heavy-stuff --key value
77
94
```
78
95
79
-
If your service is long-running, you need to update Dockerfile and Compose manifests. Copy `deploy/Dockerfile` to `deploy/Dockerfile.service` and add the following lines to the end of the file:
96
+
If your new command is a long long-running service, you need to update Dockerfile and Compose manifests. Update the `deploy/Dockerfile` to use the new entrypoint:
0 commit comments