python-ship 0.3.0__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_ship-0.3.0/src/python_ship.egg-info → python_ship-0.4.0}/PKG-INFO +22 -6
- {python_ship-0.3.0 → python_ship-0.4.0}/README.md +21 -5
- {python_ship-0.3.0 → python_ship-0.4.0}/docs/adding-a-service.md +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/docs/build-environment.md +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/schema/service-environment.json +2 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/schema/ship.schema.json +7 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/__init__.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/cli.py +13 -12
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/config.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/environment.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/production.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/schema/service-environment.json +2 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/schema/ship.schema.json +7 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/service_setup.py +1 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/services.py +42 -2
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/terminal.py +5 -7
- {python_ship-0.3.0 → python_ship-0.4.0/src/python_ship.egg-info}/PKG-INFO +22 -6
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_cli.py +10 -6
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_docker_development.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_docker_production.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_docker_services.py +10 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_extensions.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_plugins.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_portable_services.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_production.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_servers.py +1 -1
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_services.py +23 -2
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_wizard_terminal.py +5 -2
- {python_ship-0.3.0 → python_ship-0.4.0}/LICENSE.md +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/MANIFEST.in +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/docs/releasing.md +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/docs/standalone-runtimes.md +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/docs/upgrading.md +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/examples/community-adapter/README.md +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/examples/community-adapter/pyproject.toml +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/examples/community-adapter/src/ship_example_starlette_adapter/__init__.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/examples/community-service/README.md +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/examples/community-service/pyproject.toml +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/examples/community-service/src/ship_example_http_service/__init__.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/pyproject.toml +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/schema/ship-release.schema.json +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/setup.cfg +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/__main__.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/adapters.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/build_environment.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/capabilities.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/compose.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/contracts.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/image_build.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/init.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/layout.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/mutagen.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/package_managers.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/plugins.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/portable.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/portable_data.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/ports.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/py.typed +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/release.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/runtime.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/schema/ship-release.schema.json +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/security.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/servers.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/storage.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/stubs.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/templates/Dockerfile +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/templates/app-entrypoint.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/templates/check-python-security-floor.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/templates/garage/Dockerfile +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/templates/garage/garage.toml +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/templates/launcher +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/uv.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/wizard.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship.egg-info/SOURCES.txt +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship.egg-info/dependency_links.txt +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship.egg-info/entry_points.txt +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship.egg-info/requires.txt +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship.egg-info/top_level.txt +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/__init__.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/django_app/manage.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/django_app/project/__init__.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/django_app/project/asgi.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/django_app/project/settings.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/django_app/project/urls.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/django_app/project/views.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/django_app/requirements.txt +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/fastapi_app/main.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/fastapi_app/requirements.txt +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/flask_app/app.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/flask_app/requirements.txt +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/fixtures/plain_asgi/main.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/helpers.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_adapters.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_build_environment.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_capabilities.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_compose.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_config.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_docker_portable.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_docker_release.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_docker_tooling.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_environment.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_image_build.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_init.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_mutagen.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_package_managers.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_plain_asgi_http.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_release.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_release_contract.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_runtime.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_schema.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_security.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_shared_contract.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/test_uv.py +0 -0
- {python_ship-0.3.0 → python_ship-0.4.0}/tests/vite.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-ship
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Framework-agnostic, cross-platform Docker development environment and portable releases for Python web apps.
|
|
5
5
|
Author: python-ship
|
|
6
6
|
License-Expression: MIT
|
|
@@ -212,7 +212,7 @@ options and examples.
|
|
|
212
212
|
| `ship shell [service]` | Opens a shell (`sh`) in a service; defaults to the app. |
|
|
213
213
|
| `ship logs [service] [-f]` | Shows logs for one service, or all of them. `-f`/`--follow` streams. |
|
|
214
214
|
| `ship db [instance]` | Opens the database's client (`psql`/`mysql`/`mariadb`/`mongosh`/`sqlcmd`) with credentials from its own container. Name one of `additionalServices`' databases to open that instance instead. |
|
|
215
|
-
| `ship check` | Validates `ship.json`, published files, both Compose models, and required production settings without Docker. Groups errors and warnings.
|
|
215
|
+
| `ship check` | Validates `ship.json`, published files, both Compose models, and required production settings without Docker. Groups errors and warnings. |
|
|
216
216
|
| `ship doctor` | Shows project and runtime versions, published templates, and a color-coded table of development service states, health, images, and ports. Lists problems with recovery commands. |
|
|
217
217
|
| `ship uv <args...>` | Runs uv dependency commands (`add`, `remove`, `lock`, `tree`, ...) in a temporary container with the project's Python. See [Dependencies](#dependencies-and-ship-uv). |
|
|
218
218
|
| `ship npm/pnpm/yarn <args...>` | Runs the selected, exactly pinned tool in the Node frontend service. The manifest and lockfile remain authoritative. |
|
|
@@ -284,6 +284,22 @@ client dependencies and connects using those settings.
|
|
|
284
284
|
| MariaDB (`mariadb`) | The `DB_*` settings, a separate root credential, and `ship db` | A MySQL/MariaDB driver |
|
|
285
285
|
| MongoDB (`mongodb`) | Separate app and admin users, `MONGODB_DATABASE`, and an encoded `MONGODB_URI` at app startup | A client such as `pymongo` and your framework's MongoDB backend, if needed |
|
|
286
286
|
| SQL Server (`sqlserver`) | An application database and login, `DB_*` settings, and `ship db`. The image uses linux/amd64 and defaults to Developer edition. | A driver such as `pymssql` or `pyodbc` with its native driver. Set `MSSQL_PID` in `.env.production` to select the edition for deployment. |
|
|
287
|
+
| ClickHouse (`clickhouse`) | `CLICKHOUSE_*` settings, an authenticated `ship db` console, and a persistent volume | A driver such as `clickhouse-connect` over HTTP or `clickhouse-driver` for the native protocol. Set `CLICKHOUSE_PASSWORD` in `.env.production` |
|
|
288
|
+
|
|
289
|
+
ClickHouse uses HTTP on `CLICKHOUSE_HTTP_URL` (8123) and the native protocol
|
|
290
|
+
on `CLICKHOUSE_HOST` and `CLICKHOUSE_PORT` (9000). Pass `CLICKHOUSE_DB`,
|
|
291
|
+
`CLICKHOUSE_USER`, and `CLICKHOUSE_PASSWORD` to the client. Add a named
|
|
292
|
+
instance to keep another primary database. [ClickHouse Python integration](https://clickhouse.com/integrations/python)
|
|
293
|
+
|
|
294
|
+
```sh
|
|
295
|
+
ship init --no-interaction --database postgres --additional-service database=clickhouse:warehouse
|
|
296
|
+
ship up
|
|
297
|
+
ship db warehouse
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
The named instance uses `WAREHOUSE_CLICKHOUSE_*` variables, including the
|
|
301
|
+
required `WAREHOUSE_CLICKHOUSE_PASSWORD` in `.env.production`. Select the
|
|
302
|
+
HTTP or native port in port publishing when a host client needs access.
|
|
287
303
|
|
|
288
304
|
For example, Django can configure PostgreSQL and Redis from the container's
|
|
289
305
|
environment in `settings.py`.
|
|
@@ -623,7 +639,7 @@ manifest for the services you selected.
|
|
|
623
639
|
Re-running `ship init` keeps your `docker/ship/Dockerfile`. Use `ship init --force`
|
|
624
640
|
to replace it with the version matching the installed package. Ship records the
|
|
625
641
|
version that published the Dockerfile in `docker/ship/.ship-version`, and `ship up`,
|
|
626
|
-
`ship init` and `ship
|
|
642
|
+
`ship init` and `ship check` warn when it differs from what's installed.
|
|
627
643
|
|
|
628
644
|
### Multiple instances of a service
|
|
629
645
|
|
|
@@ -790,7 +806,7 @@ Ship enforces the following minimum Python versions for application images.
|
|
|
790
806
|
|
|
791
807
|
It is enforced at three points:
|
|
792
808
|
|
|
793
|
-
- **`ship init`, `ship
|
|
809
|
+
- **`ship init`, `ship check` and every command that generates a
|
|
794
810
|
Compose file** reject an end-of-life `python` branch, or a pinned patch
|
|
795
811
|
release below the floor (`"3.13.4"`).
|
|
796
812
|
- **The Dockerfile's `base` stage** runs `docker/ship/check-python-security-floor.py`
|
|
@@ -808,7 +824,7 @@ ships a security release.
|
|
|
808
824
|
`ship init` appends required production setting names to `.env.production`
|
|
809
825
|
with empty values, preserving existing values and comments. Fill them before
|
|
810
826
|
building. It also merges development settings into `.env.example` and `.env`.
|
|
811
|
-
`ship
|
|
827
|
+
`ship check`, `build` and `release` reject missing required credentials
|
|
812
828
|
and known development defaults. The release copies the file privately unless
|
|
813
829
|
`--no-env` is requested. With no required settings, an absent file is allowed.
|
|
814
830
|
|
|
@@ -816,7 +832,7 @@ Selected services' secrets (`DB_PASSWORD`, `DB_ROOT_PASSWORD`,
|
|
|
816
832
|
`MEILISEARCH_KEY`, `AWS_SECRET_ACCESS_KEY`, `GARAGE_RPC_SECRET`,
|
|
817
833
|
`GARAGE_ADMIN_TOKEN`, each with its instance prefix where one applies) are
|
|
818
834
|
*required* in production: Compose itself refuses to start without them, and
|
|
819
|
-
`ship
|
|
835
|
+
`ship check`/`ship build`/`ship release` check before Docker is invoked
|
|
820
836
|
— reporting a missing value, or one still set to a development default such
|
|
821
837
|
as `ship`. Non-secret settings (`DB_DATABASE`, `DB_USERNAME`, `AWS_BUCKET`, ...) keep
|
|
822
838
|
their defaults unless you set them.
|
|
@@ -177,7 +177,7 @@ options and examples.
|
|
|
177
177
|
| `ship shell [service]` | Opens a shell (`sh`) in a service; defaults to the app. |
|
|
178
178
|
| `ship logs [service] [-f]` | Shows logs for one service, or all of them. `-f`/`--follow` streams. |
|
|
179
179
|
| `ship db [instance]` | Opens the database's client (`psql`/`mysql`/`mariadb`/`mongosh`/`sqlcmd`) with credentials from its own container. Name one of `additionalServices`' databases to open that instance instead. |
|
|
180
|
-
| `ship check` | Validates `ship.json`, published files, both Compose models, and required production settings without Docker. Groups errors and warnings.
|
|
180
|
+
| `ship check` | Validates `ship.json`, published files, both Compose models, and required production settings without Docker. Groups errors and warnings. |
|
|
181
181
|
| `ship doctor` | Shows project and runtime versions, published templates, and a color-coded table of development service states, health, images, and ports. Lists problems with recovery commands. |
|
|
182
182
|
| `ship uv <args...>` | Runs uv dependency commands (`add`, `remove`, `lock`, `tree`, ...) in a temporary container with the project's Python. See [Dependencies](#dependencies-and-ship-uv). |
|
|
183
183
|
| `ship npm/pnpm/yarn <args...>` | Runs the selected, exactly pinned tool in the Node frontend service. The manifest and lockfile remain authoritative. |
|
|
@@ -249,6 +249,22 @@ client dependencies and connects using those settings.
|
|
|
249
249
|
| MariaDB (`mariadb`) | The `DB_*` settings, a separate root credential, and `ship db` | A MySQL/MariaDB driver |
|
|
250
250
|
| MongoDB (`mongodb`) | Separate app and admin users, `MONGODB_DATABASE`, and an encoded `MONGODB_URI` at app startup | A client such as `pymongo` and your framework's MongoDB backend, if needed |
|
|
251
251
|
| SQL Server (`sqlserver`) | An application database and login, `DB_*` settings, and `ship db`. The image uses linux/amd64 and defaults to Developer edition. | A driver such as `pymssql` or `pyodbc` with its native driver. Set `MSSQL_PID` in `.env.production` to select the edition for deployment. |
|
|
252
|
+
| ClickHouse (`clickhouse`) | `CLICKHOUSE_*` settings, an authenticated `ship db` console, and a persistent volume | A driver such as `clickhouse-connect` over HTTP or `clickhouse-driver` for the native protocol. Set `CLICKHOUSE_PASSWORD` in `.env.production` |
|
|
253
|
+
|
|
254
|
+
ClickHouse uses HTTP on `CLICKHOUSE_HTTP_URL` (8123) and the native protocol
|
|
255
|
+
on `CLICKHOUSE_HOST` and `CLICKHOUSE_PORT` (9000). Pass `CLICKHOUSE_DB`,
|
|
256
|
+
`CLICKHOUSE_USER`, and `CLICKHOUSE_PASSWORD` to the client. Add a named
|
|
257
|
+
instance to keep another primary database. [ClickHouse Python integration](https://clickhouse.com/integrations/python)
|
|
258
|
+
|
|
259
|
+
```sh
|
|
260
|
+
ship init --no-interaction --database postgres --additional-service database=clickhouse:warehouse
|
|
261
|
+
ship up
|
|
262
|
+
ship db warehouse
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The named instance uses `WAREHOUSE_CLICKHOUSE_*` variables, including the
|
|
266
|
+
required `WAREHOUSE_CLICKHOUSE_PASSWORD` in `.env.production`. Select the
|
|
267
|
+
HTTP or native port in port publishing when a host client needs access.
|
|
252
268
|
|
|
253
269
|
For example, Django can configure PostgreSQL and Redis from the container's
|
|
254
270
|
environment in `settings.py`.
|
|
@@ -588,7 +604,7 @@ manifest for the services you selected.
|
|
|
588
604
|
Re-running `ship init` keeps your `docker/ship/Dockerfile`. Use `ship init --force`
|
|
589
605
|
to replace it with the version matching the installed package. Ship records the
|
|
590
606
|
version that published the Dockerfile in `docker/ship/.ship-version`, and `ship up`,
|
|
591
|
-
`ship init` and `ship
|
|
607
|
+
`ship init` and `ship check` warn when it differs from what's installed.
|
|
592
608
|
|
|
593
609
|
### Multiple instances of a service
|
|
594
610
|
|
|
@@ -755,7 +771,7 @@ Ship enforces the following minimum Python versions for application images.
|
|
|
755
771
|
|
|
756
772
|
It is enforced at three points:
|
|
757
773
|
|
|
758
|
-
- **`ship init`, `ship
|
|
774
|
+
- **`ship init`, `ship check` and every command that generates a
|
|
759
775
|
Compose file** reject an end-of-life `python` branch, or a pinned patch
|
|
760
776
|
release below the floor (`"3.13.4"`).
|
|
761
777
|
- **The Dockerfile's `base` stage** runs `docker/ship/check-python-security-floor.py`
|
|
@@ -773,7 +789,7 @@ ships a security release.
|
|
|
773
789
|
`ship init` appends required production setting names to `.env.production`
|
|
774
790
|
with empty values, preserving existing values and comments. Fill them before
|
|
775
791
|
building. It also merges development settings into `.env.example` and `.env`.
|
|
776
|
-
`ship
|
|
792
|
+
`ship check`, `build` and `release` reject missing required credentials
|
|
777
793
|
and known development defaults. The release copies the file privately unless
|
|
778
794
|
`--no-env` is requested. With no required settings, an absent file is allowed.
|
|
779
795
|
|
|
@@ -781,7 +797,7 @@ Selected services' secrets (`DB_PASSWORD`, `DB_ROOT_PASSWORD`,
|
|
|
781
797
|
`MEILISEARCH_KEY`, `AWS_SECRET_ACCESS_KEY`, `GARAGE_RPC_SECRET`,
|
|
782
798
|
`GARAGE_ADMIN_TOKEN`, each with its instance prefix where one applies) are
|
|
783
799
|
*required* in production: Compose itself refuses to start without them, and
|
|
784
|
-
`ship
|
|
800
|
+
`ship check`/`ship build`/`ship release` check before Docker is invoked
|
|
785
801
|
— reporting a missing value, or one still set to a development default such
|
|
786
802
|
as `ship`. Non-secret settings (`DB_DATABASE`, `DB_USERNAME`, `AWS_BUCKET`, ...) keep
|
|
787
803
|
their defaults unless you set them.
|
|
@@ -70,7 +70,7 @@ is how it's registered (see [Extending without forking](#extending-without-forki
|
|
|
70
70
|
| `resource_name` | A name that stays stable across renames (`key`, or `key-instance`). Use it for named volumes. |
|
|
71
71
|
| `instance_name` | `None` for the default selection; the `additionalServices` name otherwise. |
|
|
72
72
|
| `env_prefix` | `""`, or `"ANALYTICS_"` for an instance named `analytics`. Prefix every variable with it. |
|
|
73
|
-
| `credential(name, default)` | `${PREFIX_NAME:-default}` in development; `${PREFIX_NAME:?...}` in production, so Compose refuses to start without a real value and `ship
|
|
73
|
+
| `credential(name, default)` | `${PREFIX_NAME:-default}` in development; `${PREFIX_NAME:?...}` in production, so Compose refuses to start without a real value and `ship check` reports it. Use it for every secret. |
|
|
74
74
|
| `setting(name, default)` | `${PREFIX_NAME:-default}` in every environment, for non-secret settings. |
|
|
75
75
|
| `config`, `project_root` | The whole `ShipConfig` (for a setting such as `siloImage`) and the project directory. |
|
|
76
76
|
|
|
@@ -27,7 +27,7 @@ these mounts; ordinary client credentials remain runtime settings.
|
|
|
27
27
|
|
|
28
28
|
Run `ship init --force` after changing the set of build variables, secret names,
|
|
29
29
|
Node branch or asset mode, after reviewing template edits. Changing only a public
|
|
30
|
-
value does not require a template refresh. `
|
|
30
|
+
value does not require a template refresh. `check` and builds reject missing
|
|
31
31
|
secret files and refuse frontend-public names in the secret list.
|
|
32
32
|
|
|
33
33
|
Frontend package.json records an exact `packageManager` pin. Keep one authoritative
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"centrifugo": ["CENTRIFUGO_API_KEY", "CENTRIFUGO_TOKEN_SECRET", "CENTRIFUGO_URL"],
|
|
3
|
+
"clickhouse": ["CLICKHOUSE_DB", "CLICKHOUSE_HOST", "CLICKHOUSE_HTTP_URL", "CLICKHOUSE_PASSWORD", "CLICKHOUSE_PORT", "CLICKHOUSE_USER"],
|
|
3
4
|
"elasticsearch": ["ELASTICSEARCH_HOST", "ELASTICSEARCH_PASSWORD", "ELASTICSEARCH_USERNAME"],
|
|
4
5
|
"garage": ["AWS_ACCESS_KEY_ID", "AWS_BUCKET", "AWS_DEFAULT_REGION", "AWS_ENDPOINT", "AWS_SECRET_ACCESS_KEY", "AWS_USE_PATH_STYLE_ENDPOINT"],
|
|
5
6
|
"mailpit": ["MAIL_HOST", "MAIL_PORT"],
|
|
6
7
|
"mariadb": ["DB_DATABASE", "DB_HOST", "DB_PASSWORD", "DB_PORT", "DB_USERNAME"],
|
|
7
8
|
"meilisearch": ["MEILISEARCH_HOST", "MEILISEARCH_KEY"],
|
|
8
9
|
"memcached": ["MEMCACHED_HOST", "MEMCACHED_PORT"],
|
|
10
|
+
"mercure": ["MERCURE_JWT_ISSUER", "MERCURE_JWT_SECRET", "MERCURE_PUBLIC_URL", "MERCURE_URL"],
|
|
9
11
|
"mongodb": ["MONGODB_DATABASE", "MONGODB_HOST", "MONGODB_PASSWORD", "MONGODB_PORT", "MONGODB_USERNAME"],
|
|
10
12
|
"mysql": ["DB_DATABASE", "DB_HOST", "DB_PASSWORD", "DB_PORT", "DB_USERNAME"],
|
|
11
13
|
"playwright": ["PLAYWRIGHT_BASE_URL", "PW_TEST_CONNECT_WS_ENDPOINT"],
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
},
|
|
103
103
|
"portPublishing": {
|
|
104
104
|
"type": "object",
|
|
105
|
-
"description": "
|
|
105
|
+
"description": "Explicitly select the generated ports to publish per environment. Takes precedence over publishPorts. Development binds to localhost; production can bind to all host interfaces. Empty lists publish no ports in that environment.",
|
|
106
106
|
"additionalProperties": false,
|
|
107
107
|
"required": ["development", "production"],
|
|
108
108
|
"properties": {
|
|
@@ -318,6 +318,12 @@
|
|
|
318
318
|
],
|
|
319
319
|
"description": "JavaScript: Runtime strategy. Supported modes depend on the framework adapter."
|
|
320
320
|
},
|
|
321
|
+
"javascriptRuntime": {
|
|
322
|
+
"type": "string",
|
|
323
|
+
"enum": ["node", "bun"],
|
|
324
|
+
"default": "node",
|
|
325
|
+
"description": "JavaScript: Runtime for server package scripts. Bun availability depends on the selected framework and deployment mode."
|
|
326
|
+
},
|
|
321
327
|
"serverEntry": {
|
|
322
328
|
"anyOf": [
|
|
323
329
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""The `ship` command line, built on Typer.
|
|
2
2
|
|
|
3
3
|
The command set mirrors PHP Ship: init, up, down, exec, shell, logs, db,
|
|
4
|
-
|
|
4
|
+
check, build and release, plus proxies (npm, uv, and each framework
|
|
5
5
|
adapter's console commands such as Django's `manage`).
|
|
6
6
|
"""
|
|
7
7
|
|
|
@@ -79,7 +79,7 @@ class ShipHelpGroup(TyperGroup):
|
|
|
79
79
|
continue
|
|
80
80
|
group = getattr(command, "rich_help_panel", None) or "Other commands"
|
|
81
81
|
summary = command.get_short_help_str(max(20, formatter.width - 24))
|
|
82
|
-
groups.setdefault(group, []).append((
|
|
82
|
+
groups.setdefault(group, []).append((name, summary))
|
|
83
83
|
for group, rows in groups.items():
|
|
84
84
|
if rows:
|
|
85
85
|
with formatter.section(group):
|
|
@@ -272,7 +272,7 @@ def read_config(project: Path) -> ShipConfig:
|
|
|
272
272
|
return ShipConfig.read(project)
|
|
273
273
|
|
|
274
274
|
|
|
275
|
-
# Checks shared by
|
|
275
|
+
# Checks shared by check, doctor, up, build and release -------------------------------------------
|
|
276
276
|
|
|
277
277
|
def config_problems(project: Path, *, production: bool = True) -> list[str]:
|
|
278
278
|
"""Every independent problem with ship.json, Docker files and both Compose models, in one pass.
|
|
@@ -361,7 +361,7 @@ def create_app(adapter_commands: dict[str, list[str]] | None = None) -> typer.Ty
|
|
|
361
361
|
help="Docker development environments and portable releases for Python web apps.",
|
|
362
362
|
no_args_is_help=True,
|
|
363
363
|
add_completion=True,
|
|
364
|
-
rich_markup_mode=None,
|
|
364
|
+
rich_markup_mode="rich" if terminal.use_color() else None,
|
|
365
365
|
pretty_exceptions_enable=False,
|
|
366
366
|
)
|
|
367
367
|
|
|
@@ -499,10 +499,9 @@ def create_app(adapter_commands: dict[str, list[str]] | None = None) -> typer.Ty
|
|
|
499
499
|
"""Open a database's interactive client, using credentials from its own container."""
|
|
500
500
|
return execute(lambda: database_shell(instance))
|
|
501
501
|
|
|
502
|
-
@app.command("
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
"""Validate settings and Compose models without Docker (alias: config:test)."""
|
|
502
|
+
@app.command("check", rich_help_panel="Troubleshooting", short_help="Validate settings without Docker.")
|
|
503
|
+
def check_command() -> int:
|
|
504
|
+
"""Validate settings and both Compose models without Docker."""
|
|
506
505
|
def action() -> int:
|
|
507
506
|
terminal.heading("Ship configuration check")
|
|
508
507
|
project = root()
|
|
@@ -515,7 +514,7 @@ def create_app(adapter_commands: dict[str, list[str]] | None = None) -> typer.Ty
|
|
|
515
514
|
warning = stub_version_warning(project)
|
|
516
515
|
if warning:
|
|
517
516
|
warnings.append(warning)
|
|
518
|
-
terminal.diagnostics("Warnings", warnings, color=typer.colors.
|
|
517
|
+
terminal.diagnostics("Warnings", warnings, color=typer.colors.BRIGHT_YELLOW)
|
|
519
518
|
terminal.success("ship.json, Docker files and both Compose models are valid.")
|
|
520
519
|
return 0
|
|
521
520
|
return execute(action)
|
|
@@ -641,14 +640,16 @@ def create_app(adapter_commands: dict[str, list[str]] | None = None) -> typer.Ty
|
|
|
641
640
|
"""List all commands or show help for one command."""
|
|
642
641
|
parent = ctx.find_root()
|
|
643
642
|
if command is None:
|
|
644
|
-
|
|
643
|
+
if text := parent.get_help():
|
|
644
|
+
typer.echo(text)
|
|
645
645
|
return 0
|
|
646
646
|
selected = cast(TyperGroup, parent.command).get_command(parent, command)
|
|
647
647
|
if selected is None:
|
|
648
648
|
terminal.error(f"No such command {command!r}.")
|
|
649
649
|
return 2
|
|
650
650
|
with selected.make_context(command, [], parent=parent, resilient_parsing=True) as child:
|
|
651
|
-
|
|
651
|
+
if text := selected.get_help(child):
|
|
652
|
+
typer.echo(text)
|
|
652
653
|
return 0
|
|
653
654
|
|
|
654
655
|
for name, command_prefix in (adapter_commands or {}).items():
|
|
@@ -841,7 +842,7 @@ def discover_adapter_commands(project: Path) -> dict[str, list[str]]:
|
|
|
841
842
|
"""The selected adapter's console commands, registered like PHP Ship's artisan/console.
|
|
842
843
|
|
|
843
844
|
A project whose ship.json can't be read yet simply gets no extra commands;
|
|
844
|
-
`ship
|
|
845
|
+
`ship check` reports why.
|
|
845
846
|
"""
|
|
846
847
|
if not (project / "ship.json").is_file():
|
|
847
848
|
return {}
|
|
@@ -42,7 +42,7 @@ SILO_IMAGES = ("standard", "distroless")
|
|
|
42
42
|
GROUPS_SUPPORTING_ADDITIONAL_INSTANCES = ("database", "cache", "storage", "search", "mail")
|
|
43
43
|
# Ship's own commands; a process or a framework console command can't take these names.
|
|
44
44
|
RESERVED_COMMANDS = frozenset({
|
|
45
|
-
"init", "up", "down", "ps", "run", "exec", "shell", "logs", "db", "check", "
|
|
45
|
+
"init", "up", "down", "ps", "run", "exec", "shell", "logs", "db", "check", "build", "release", "help",
|
|
46
46
|
"npm", "pnpm", "yarn", "package-manager", "test", "uv", "doctor",
|
|
47
47
|
})
|
|
48
48
|
|
|
@@ -27,7 +27,7 @@ _DEVELOPMENT_TOOLS = frozenset({
|
|
|
27
27
|
})
|
|
28
28
|
_SECTIONS = {
|
|
29
29
|
"Application": ("APP_", "DJANGO_", "FLASK_", "DEBUG", "FORWARDED_ALLOW_IPS"),
|
|
30
|
-
"Database": ("DB_", "MONGODB_"), "Cache": ("REDIS_", "MEMCACHED_", "VALKEY_"),
|
|
30
|
+
"Database": ("DB_", "MONGODB_", "CLICKHOUSE_"), "Cache": ("REDIS_", "MEMCACHED_", "VALKEY_"),
|
|
31
31
|
"Object storage": ("AWS_", "GARAGE_", "RUSTFS_", "SEAWEEDFS_", "SILO_"),
|
|
32
32
|
"Search": ("MEILISEARCH_", "ELASTICSEARCH_", "TYPESENSE_"), "Mail": ("MAIL_", "MAILPIT_"),
|
|
33
33
|
"Messaging and events": ("AMQP_", "RABBITMQ_", "CELERY_", "CENTRIFUGO_", "MERCURE_"),
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"centrifugo": ["CENTRIFUGO_API_KEY", "CENTRIFUGO_TOKEN_SECRET", "CENTRIFUGO_URL"],
|
|
3
|
+
"clickhouse": ["CLICKHOUSE_DB", "CLICKHOUSE_HOST", "CLICKHOUSE_HTTP_URL", "CLICKHOUSE_PASSWORD", "CLICKHOUSE_PORT", "CLICKHOUSE_USER"],
|
|
3
4
|
"elasticsearch": ["ELASTICSEARCH_HOST", "ELASTICSEARCH_PASSWORD", "ELASTICSEARCH_USERNAME"],
|
|
4
5
|
"garage": ["AWS_ACCESS_KEY_ID", "AWS_BUCKET", "AWS_DEFAULT_REGION", "AWS_ENDPOINT", "AWS_SECRET_ACCESS_KEY", "AWS_USE_PATH_STYLE_ENDPOINT"],
|
|
5
6
|
"mailpit": ["MAIL_HOST", "MAIL_PORT"],
|
|
6
7
|
"mariadb": ["DB_DATABASE", "DB_HOST", "DB_PASSWORD", "DB_PORT", "DB_USERNAME"],
|
|
7
8
|
"meilisearch": ["MEILISEARCH_HOST", "MEILISEARCH_KEY"],
|
|
8
9
|
"memcached": ["MEMCACHED_HOST", "MEMCACHED_PORT"],
|
|
10
|
+
"mercure": ["MERCURE_JWT_ISSUER", "MERCURE_JWT_SECRET", "MERCURE_PUBLIC_URL", "MERCURE_URL"],
|
|
9
11
|
"mongodb": ["MONGODB_DATABASE", "MONGODB_HOST", "MONGODB_PASSWORD", "MONGODB_PORT", "MONGODB_USERNAME"],
|
|
10
12
|
"mysql": ["DB_DATABASE", "DB_HOST", "DB_PASSWORD", "DB_PORT", "DB_USERNAME"],
|
|
11
13
|
"playwright": ["PLAYWRIGHT_BASE_URL", "PW_TEST_CONNECT_WS_ENDPOINT"],
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
},
|
|
103
103
|
"portPublishing": {
|
|
104
104
|
"type": "object",
|
|
105
|
-
"description": "
|
|
105
|
+
"description": "Explicitly select the generated ports to publish per environment. Takes precedence over publishPorts. Development binds to localhost; production can bind to all host interfaces. Empty lists publish no ports in that environment.",
|
|
106
106
|
"additionalProperties": false,
|
|
107
107
|
"required": ["development", "production"],
|
|
108
108
|
"properties": {
|
|
@@ -318,6 +318,12 @@
|
|
|
318
318
|
],
|
|
319
319
|
"description": "JavaScript: Runtime strategy. Supported modes depend on the framework adapter."
|
|
320
320
|
},
|
|
321
|
+
"javascriptRuntime": {
|
|
322
|
+
"type": "string",
|
|
323
|
+
"enum": ["node", "bun"],
|
|
324
|
+
"default": "node",
|
|
325
|
+
"description": "JavaScript: Runtime for server package scripts. Bun availability depends on the selected framework and deployment mode."
|
|
326
|
+
},
|
|
321
327
|
"serverEntry": {
|
|
322
328
|
"anyOf": [
|
|
323
329
|
{
|
|
@@ -15,6 +15,7 @@ _CLIENTS = {
|
|
|
15
15
|
"mariadb": (("PyMySQL", "mariadb", "mysqlclient", "aiomysql", "asyncmy"),),
|
|
16
16
|
"mongodb": (("pymongo", "motor"),),
|
|
17
17
|
"sqlserver": (("pyodbc", "pymssql"),),
|
|
18
|
+
"clickhouse": (("clickhouse-connect", "clickhouse-driver"),),
|
|
18
19
|
"redis": (("redis", "valkey"),), "valkey": (("redis", "valkey"),),
|
|
19
20
|
"memcached": (("pymemcache", "pylibmc", "python-memcached"),),
|
|
20
21
|
"meilisearch": (("meilisearch", "meilisearch-python-sdk", "httpx", "requests"),),
|
|
@@ -112,6 +112,43 @@ class MySqlService:
|
|
|
112
112
|
return ["sh", "-c", 'exec mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"']
|
|
113
113
|
|
|
114
114
|
|
|
115
|
+
class ClickHouseService:
|
|
116
|
+
key = "clickhouse"
|
|
117
|
+
group = "database"
|
|
118
|
+
label = "ClickHouse"
|
|
119
|
+
CLIENT = ('exec clickhouse-client --host 127.0.0.1 --database "$CLICKHOUSE_DB" '
|
|
120
|
+
'--user "$CLICKHOUSE_USER" --password "$CLICKHOUSE_PASSWORD"')
|
|
121
|
+
|
|
122
|
+
def compose_fragment(self, context: ServiceContext) -> dict[str, dict[str, Any]]:
|
|
123
|
+
connection = self.app_environment(context)
|
|
124
|
+
prefix = context.env_prefix
|
|
125
|
+
return {context.service_name: {
|
|
126
|
+
"image": "clickhouse/clickhouse-server:26.8",
|
|
127
|
+
"expose": [8123, 9000],
|
|
128
|
+
"environment": {key: connection[prefix + key] for key in ("CLICKHOUSE_DB", "CLICKHOUSE_USER", "CLICKHOUSE_PASSWORD")},
|
|
129
|
+
"volumes": [f"{context.resource_name}_data:/var/lib/clickhouse"],
|
|
130
|
+
"ulimits": {"nofile": {"soft": 262144, "hard": 262144}},
|
|
131
|
+
"healthcheck": _healthcheck(
|
|
132
|
+
["CMD-SHELL", self.CLIENT.replace("$", "$$") + " --query 'SELECT 1'"],
|
|
133
|
+
timeout="5s", retries=20, start_period="20s",
|
|
134
|
+
),
|
|
135
|
+
}}
|
|
136
|
+
|
|
137
|
+
def app_environment(self, context: ServiceContext) -> dict[str, str]:
|
|
138
|
+
prefix = context.env_prefix
|
|
139
|
+
return {
|
|
140
|
+
f"{prefix}CLICKHOUSE_DB": context.setting("CLICKHOUSE_DB", "analytics"),
|
|
141
|
+
f"{prefix}CLICKHOUSE_HOST": context.service_name,
|
|
142
|
+
f"{prefix}CLICKHOUSE_PORT": "9000",
|
|
143
|
+
f"{prefix}CLICKHOUSE_HTTP_URL": f"http://{context.service_name}:8123",
|
|
144
|
+
f"{prefix}CLICKHOUSE_USER": context.setting("CLICKHOUSE_USER", "ship"),
|
|
145
|
+
f"{prefix}CLICKHOUSE_PASSWORD": context.credential("CLICKHOUSE_PASSWORD", "ship"),
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
def database_shell(self, context: ServiceContext) -> list[str]:
|
|
149
|
+
return ["sh", "-c", self.CLIENT]
|
|
150
|
+
|
|
151
|
+
|
|
115
152
|
class RedisService:
|
|
116
153
|
key = "redis"
|
|
117
154
|
group = "cache"
|
|
@@ -192,7 +229,10 @@ class RabbitMQService:
|
|
|
192
229
|
"environment": {
|
|
193
230
|
"RABBITMQ_DEFAULT_USER": context.setting("RABBITMQ_USER", "app"),
|
|
194
231
|
"RABBITMQ_DEFAULT_PASS": context.credential("RABBITMQ_PASSWORD", "ship"),
|
|
195
|
-
"RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS":
|
|
232
|
+
"RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS": (
|
|
233
|
+
"-rabbitmq_management_agent disable_metrics_collector true"
|
|
234
|
+
" -rabbitmq_management disable_stats true enable_queue_totals true"
|
|
235
|
+
),
|
|
196
236
|
},
|
|
197
237
|
"volumes": [f"{context.resource_name}_data:/var/lib/rabbitmq"],
|
|
198
238
|
"healthcheck": _healthcheck(["CMD", "rabbitmq-diagnostics", "-q", "ping"],
|
|
@@ -428,7 +468,7 @@ class NodeService:
|
|
|
428
468
|
|
|
429
469
|
|
|
430
470
|
_BUILTINS: list[ServiceDefinition] = [
|
|
431
|
-
PostgresService(), MySqlService(), RedisService(), RabbitMQService(), CeleryService(), MailpitService(),
|
|
471
|
+
PostgresService(), MySqlService(), ClickHouseService(), RedisService(), RabbitMQService(), CeleryService(), MailpitService(),
|
|
432
472
|
MeilisearchService(), MercureService(), SeleniumService(), PlaywrightService(), NodeService(), *BUILTIN_STORAGE, *BUILTIN_PORTABLE,
|
|
433
473
|
]
|
|
434
474
|
BUILTIN_SERVICES: dict[str, ServiceDefinition] = {service.key: service for service in _BUILTINS}
|
|
@@ -23,10 +23,6 @@ def use_color(*, err: bool = False) -> bool:
|
|
|
23
23
|
return stream.isatty() and os.environ.get("TERM") != "dumb" and "NO_COLOR" not in os.environ
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def command_name(name: str) -> str:
|
|
27
|
-
return typer.style(name, fg=typer.colors.CYAN, bold=True) if use_color() else name
|
|
28
|
-
|
|
29
|
-
|
|
30
26
|
def heading(title: str) -> None:
|
|
31
27
|
typer.secho(f"\n{title}", fg=typer.colors.CYAN, bold=True, color=use_color())
|
|
32
28
|
|
|
@@ -47,11 +43,13 @@ def success(message: str) -> None:
|
|
|
47
43
|
typer.secho(f"[OK] {message}", fg=typer.colors.GREEN, bold=True, color=use_color())
|
|
48
44
|
|
|
49
45
|
|
|
50
|
-
def diagnostics(title: str, messages: Sequence[str], *, color: str = typer.colors.
|
|
46
|
+
def diagnostics(title: str, messages: Sequence[str], *, color: str = typer.colors.BRIGHT_RED) -> None:
|
|
51
47
|
if messages:
|
|
52
|
-
|
|
48
|
+
colored = use_color(err=True)
|
|
49
|
+
typer.secho(f"\n{title}", fg=color, bold=True, err=True, color=colored)
|
|
50
|
+
bullet = typer.style("-", fg=color) if colored else "-"
|
|
53
51
|
for message in messages:
|
|
54
|
-
typer.echo(f"
|
|
52
|
+
typer.echo(f" {bullet} {message}", err=True, color=colored)
|
|
55
53
|
|
|
56
54
|
|
|
57
55
|
def table(title: str, headers: tuple[str, ...], rows: Sequence[tuple[str, ...]]) -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-ship
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Framework-agnostic, cross-platform Docker development environment and portable releases for Python web apps.
|
|
5
5
|
Author: python-ship
|
|
6
6
|
License-Expression: MIT
|
|
@@ -212,7 +212,7 @@ options and examples.
|
|
|
212
212
|
| `ship shell [service]` | Opens a shell (`sh`) in a service; defaults to the app. |
|
|
213
213
|
| `ship logs [service] [-f]` | Shows logs for one service, or all of them. `-f`/`--follow` streams. |
|
|
214
214
|
| `ship db [instance]` | Opens the database's client (`psql`/`mysql`/`mariadb`/`mongosh`/`sqlcmd`) with credentials from its own container. Name one of `additionalServices`' databases to open that instance instead. |
|
|
215
|
-
| `ship check` | Validates `ship.json`, published files, both Compose models, and required production settings without Docker. Groups errors and warnings.
|
|
215
|
+
| `ship check` | Validates `ship.json`, published files, both Compose models, and required production settings without Docker. Groups errors and warnings. |
|
|
216
216
|
| `ship doctor` | Shows project and runtime versions, published templates, and a color-coded table of development service states, health, images, and ports. Lists problems with recovery commands. |
|
|
217
217
|
| `ship uv <args...>` | Runs uv dependency commands (`add`, `remove`, `lock`, `tree`, ...) in a temporary container with the project's Python. See [Dependencies](#dependencies-and-ship-uv). |
|
|
218
218
|
| `ship npm/pnpm/yarn <args...>` | Runs the selected, exactly pinned tool in the Node frontend service. The manifest and lockfile remain authoritative. |
|
|
@@ -284,6 +284,22 @@ client dependencies and connects using those settings.
|
|
|
284
284
|
| MariaDB (`mariadb`) | The `DB_*` settings, a separate root credential, and `ship db` | A MySQL/MariaDB driver |
|
|
285
285
|
| MongoDB (`mongodb`) | Separate app and admin users, `MONGODB_DATABASE`, and an encoded `MONGODB_URI` at app startup | A client such as `pymongo` and your framework's MongoDB backend, if needed |
|
|
286
286
|
| SQL Server (`sqlserver`) | An application database and login, `DB_*` settings, and `ship db`. The image uses linux/amd64 and defaults to Developer edition. | A driver such as `pymssql` or `pyodbc` with its native driver. Set `MSSQL_PID` in `.env.production` to select the edition for deployment. |
|
|
287
|
+
| ClickHouse (`clickhouse`) | `CLICKHOUSE_*` settings, an authenticated `ship db` console, and a persistent volume | A driver such as `clickhouse-connect` over HTTP or `clickhouse-driver` for the native protocol. Set `CLICKHOUSE_PASSWORD` in `.env.production` |
|
|
288
|
+
|
|
289
|
+
ClickHouse uses HTTP on `CLICKHOUSE_HTTP_URL` (8123) and the native protocol
|
|
290
|
+
on `CLICKHOUSE_HOST` and `CLICKHOUSE_PORT` (9000). Pass `CLICKHOUSE_DB`,
|
|
291
|
+
`CLICKHOUSE_USER`, and `CLICKHOUSE_PASSWORD` to the client. Add a named
|
|
292
|
+
instance to keep another primary database. [ClickHouse Python integration](https://clickhouse.com/integrations/python)
|
|
293
|
+
|
|
294
|
+
```sh
|
|
295
|
+
ship init --no-interaction --database postgres --additional-service database=clickhouse:warehouse
|
|
296
|
+
ship up
|
|
297
|
+
ship db warehouse
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
The named instance uses `WAREHOUSE_CLICKHOUSE_*` variables, including the
|
|
301
|
+
required `WAREHOUSE_CLICKHOUSE_PASSWORD` in `.env.production`. Select the
|
|
302
|
+
HTTP or native port in port publishing when a host client needs access.
|
|
287
303
|
|
|
288
304
|
For example, Django can configure PostgreSQL and Redis from the container's
|
|
289
305
|
environment in `settings.py`.
|
|
@@ -623,7 +639,7 @@ manifest for the services you selected.
|
|
|
623
639
|
Re-running `ship init` keeps your `docker/ship/Dockerfile`. Use `ship init --force`
|
|
624
640
|
to replace it with the version matching the installed package. Ship records the
|
|
625
641
|
version that published the Dockerfile in `docker/ship/.ship-version`, and `ship up`,
|
|
626
|
-
`ship init` and `ship
|
|
642
|
+
`ship init` and `ship check` warn when it differs from what's installed.
|
|
627
643
|
|
|
628
644
|
### Multiple instances of a service
|
|
629
645
|
|
|
@@ -790,7 +806,7 @@ Ship enforces the following minimum Python versions for application images.
|
|
|
790
806
|
|
|
791
807
|
It is enforced at three points:
|
|
792
808
|
|
|
793
|
-
- **`ship init`, `ship
|
|
809
|
+
- **`ship init`, `ship check` and every command that generates a
|
|
794
810
|
Compose file** reject an end-of-life `python` branch, or a pinned patch
|
|
795
811
|
release below the floor (`"3.13.4"`).
|
|
796
812
|
- **The Dockerfile's `base` stage** runs `docker/ship/check-python-security-floor.py`
|
|
@@ -808,7 +824,7 @@ ships a security release.
|
|
|
808
824
|
`ship init` appends required production setting names to `.env.production`
|
|
809
825
|
with empty values, preserving existing values and comments. Fill them before
|
|
810
826
|
building. It also merges development settings into `.env.example` and `.env`.
|
|
811
|
-
`ship
|
|
827
|
+
`ship check`, `build` and `release` reject missing required credentials
|
|
812
828
|
and known development defaults. The release copies the file privately unless
|
|
813
829
|
`--no-env` is requested. With no required settings, an absent file is allowed.
|
|
814
830
|
|
|
@@ -816,7 +832,7 @@ Selected services' secrets (`DB_PASSWORD`, `DB_ROOT_PASSWORD`,
|
|
|
816
832
|
`MEILISEARCH_KEY`, `AWS_SECRET_ACCESS_KEY`, `GARAGE_RPC_SECRET`,
|
|
817
833
|
`GARAGE_ADMIN_TOKEN`, each with its instance prefix where one applies) are
|
|
818
834
|
*required* in production: Compose itself refuses to start without them, and
|
|
819
|
-
`ship
|
|
835
|
+
`ship check`/`ship build`/`ship release` check before Docker is invoked
|
|
820
836
|
— reporting a missing value, or one still set to a development default such
|
|
821
837
|
as `ship`. Non-secret settings (`DB_DATABASE`, `DB_USERNAME`, `AWS_BUCKET`, ...) keep
|
|
822
838
|
their defaults unless you set them.
|
|
@@ -24,9 +24,10 @@ class GlobalOptionTests(ProjectTestCase):
|
|
|
24
24
|
def test_help_lists_php_ship_commands(self):
|
|
25
25
|
with captured() as output:
|
|
26
26
|
self.assertEqual(0, main(["--help"]))
|
|
27
|
-
for command in ("init", "up", "down", "exec", "shell", "logs", "db", "
|
|
27
|
+
for command in ("init", "up", "down", "exec", "shell", "logs", "db", "check", "build", "release",
|
|
28
28
|
"npm", "uv", "doctor"):
|
|
29
29
|
self.assertIn(command, output.stdout)
|
|
30
|
+
self.assertNotIn("config:test", output.stdout)
|
|
30
31
|
with captured() as output:
|
|
31
32
|
self.assertEqual(0, main([]))
|
|
32
33
|
self.assertIn("Usage", output.stdout + output.stderr)
|
|
@@ -44,6 +45,9 @@ class GlobalOptionTests(ProjectTestCase):
|
|
|
44
45
|
with captured() as output:
|
|
45
46
|
self.assertEqual(2, main(["not-a-command"]))
|
|
46
47
|
self.assertIn("No such command", output.stderr)
|
|
48
|
+
with captured() as output:
|
|
49
|
+
self.assertEqual(2, main(["config:test"]))
|
|
50
|
+
self.assertIn("No such command", output.stderr)
|
|
47
51
|
with captured():
|
|
48
52
|
self.assertEqual(2, main(["down", "--nope"]))
|
|
49
53
|
|
|
@@ -254,7 +258,7 @@ class ConfigTestCommandTests(ProjectTestCase):
|
|
|
254
258
|
def test_valid_project(self):
|
|
255
259
|
self.assertEqual(0, self.init("--app", "main:app"))
|
|
256
260
|
with captured() as output:
|
|
257
|
-
self.assertEqual(0, self.ship("
|
|
261
|
+
self.assertEqual(0, self.ship("check"))
|
|
258
262
|
self.assertIn("Ship configuration check", output.stdout)
|
|
259
263
|
self.assertIn("both Compose models are valid", output.stdout)
|
|
260
264
|
|
|
@@ -269,14 +273,14 @@ class ConfigTestCommandTests(ProjectTestCase):
|
|
|
269
273
|
def test_reports_schema_stub_adapter_service_and_credential_problems_together(self):
|
|
270
274
|
(self.root / "ship.json").write_text(json.dumps({"framework": "", "app": "", "python": "bad", "services": [], "extra": True}))
|
|
271
275
|
with captured() as output:
|
|
272
|
-
self.assertEqual(1, self.ship("
|
|
276
|
+
self.assertEqual(1, self.ship("check"))
|
|
273
277
|
for marker in ("unknown fields", '"framework"', '"app"', '"python"', '"services"', "docker/ship/Dockerfile is missing", "problems found"):
|
|
274
278
|
self.assertIn(marker, output.stderr)
|
|
275
279
|
|
|
276
280
|
self.assertEqual(0, self.init("--app", "main:app"))
|
|
277
281
|
self.write_config(app="missing:app", services={"database": "nope", "storage": "silo"}, processes={"silo": "x"})
|
|
278
282
|
with captured() as output:
|
|
279
|
-
self.assertEqual(1, self.ship("
|
|
283
|
+
self.assertEqual(1, self.ship("check"))
|
|
280
284
|
self.assertIn("does not exist", output.stderr)
|
|
281
285
|
self.assertIn("Unknown service 'nope'", output.stderr)
|
|
282
286
|
self.assertIn("Process 'silo' conflicts", output.stderr)
|
|
@@ -284,14 +288,14 @@ class ConfigTestCommandTests(ProjectTestCase):
|
|
|
284
288
|
self.write_config(app="main:app", services={"database": "postgres", "storage": "silo"})
|
|
285
289
|
(self.root / ".env.production").write_text("DB_PASSWORD=ship\n")
|
|
286
290
|
with captured() as output:
|
|
287
|
-
self.assertEqual(1, self.ship("
|
|
291
|
+
self.assertEqual(1, self.ship("check"))
|
|
288
292
|
self.assertIn("missing from .env.production: AWS_SECRET_ACCESS_KEY", output.stderr)
|
|
289
293
|
self.assertIn("development default: DB_PASSWORD", output.stderr)
|
|
290
294
|
|
|
291
295
|
def test_never_invokes_docker(self):
|
|
292
296
|
self.assertEqual(0, self.init("--app", "main:app"))
|
|
293
297
|
with patch("python_ship.cli.subprocess.run") as run, captured():
|
|
294
|
-
self.ship("
|
|
298
|
+
self.ship("check")
|
|
295
299
|
run.assert_not_called()
|
|
296
300
|
|
|
297
301
|
|
|
@@ -35,7 +35,7 @@ class FrameworkDevelopmentTests(DockerProjectTestCase):
|
|
|
35
35
|
self.assertEqual(0, self.init(*init_arguments), self.init_output.stderr)
|
|
36
36
|
with captured() as output:
|
|
37
37
|
if has_production_settings:
|
|
38
|
-
self.assertEqual(0, self.ship("
|
|
38
|
+
self.assertEqual(0, self.ship("check"), output.stderr + output.stdout)
|
|
39
39
|
code = self.ship("up")
|
|
40
40
|
self.assertEqual(0, code, output.stderr + output.stdout[-3000:])
|
|
41
41
|
self.assertIn(f"http://127.0.0.1:{self.port}", output.stdout)
|
|
@@ -32,7 +32,7 @@ class ProductionDockerTests(DockerProjectTestCase):
|
|
|
32
32
|
config = ShipConfig.read(self.root)
|
|
33
33
|
ShipConfig(**{**config.__dict__, "publish_ports": True, **fields}).write(self.root)
|
|
34
34
|
with captured() as output:
|
|
35
|
-
self.assertEqual(0, self.ship("
|
|
35
|
+
self.assertEqual(0, self.ship("check"), output.stderr)
|
|
36
36
|
code = self.ship("build")
|
|
37
37
|
self.assertEqual(0, code, output.stderr + output.stdout[-3000:])
|
|
38
38
|
started = self.compose("up", "-d", "--wait", production=True)
|
|
@@ -82,6 +82,16 @@ class ServiceCatalogDockerTests(DockerProjectTestCase):
|
|
|
82
82
|
self.assertLess(time.monotonic(), deadline, "Mailpit did not capture the message")
|
|
83
83
|
time.sleep(0.5)
|
|
84
84
|
|
|
85
|
+
def test_clickhouse_accepts_a_query_from_the_app(self):
|
|
86
|
+
self.up("--database", "clickhouse")
|
|
87
|
+
query = (
|
|
88
|
+
"import os,urllib.request; e=os.environ; "
|
|
89
|
+
"headers={'X-ClickHouse-User': e['CLICKHOUSE_USER'], 'X-ClickHouse-Key': e['CLICKHOUSE_PASSWORD']}; "
|
|
90
|
+
"request=urllib.request.Request(e['CLICKHOUSE_HTTP_URL']+'/?query=SELECT%2042', headers=headers); "
|
|
91
|
+
"assert urllib.request.urlopen(request, timeout=5).read().strip()==b'42'"
|
|
92
|
+
)
|
|
93
|
+
self.run_in("app", "python", "-c", query)
|
|
94
|
+
|
|
85
95
|
def test_meilisearch_is_healthy_and_requires_its_key(self):
|
|
86
96
|
self.up("--search", "meilisearch")
|
|
87
97
|
check = ("import os,json,urllib.request,urllib.error; base=os.environ['MEILISEARCH_URL']; "
|
|
@@ -70,7 +70,7 @@ class InstalledExampleDockerTests(DockerProjectTestCase):
|
|
|
70
70
|
config.write(self.root)
|
|
71
71
|
self.assertEqual(0, self.init(), self.init_output.stderr)
|
|
72
72
|
with captured() as output:
|
|
73
|
-
self.assertEqual(0, self.ship("
|
|
73
|
+
self.assertEqual(0, self.ship("check"), output.stderr)
|
|
74
74
|
self.assertEqual(0, self.ship("up"), output.stderr)
|
|
75
75
|
wait_http(port, expected=expected)
|
|
76
76
|
with captured() as output:
|
|
@@ -202,7 +202,7 @@ class AdapterCommandRegistrationTests(ProjectTestCase):
|
|
|
202
202
|
(self.root / "ship.json").write_text("{broken")
|
|
203
203
|
with captured() as output:
|
|
204
204
|
self.assertEqual(0, self.ship("--help"))
|
|
205
|
-
self.assertIn("
|
|
205
|
+
self.assertIn("check", output.stdout)
|
|
206
206
|
|
|
207
207
|
|
|
208
208
|
if __name__ == "__main__":
|
|
@@ -7,7 +7,7 @@ from tests.helpers import ProjectTestCase
|
|
|
7
7
|
|
|
8
8
|
class PortableCatalogTests(ProjectTestCase):
|
|
9
9
|
def test_complete_catalog_without_flower(self):
|
|
10
|
-
self.assertEqual(
|
|
10
|
+
self.assertEqual(25, len(BUILTIN_SERVICES))
|
|
11
11
|
self.assertNotIn("flower", BUILTIN_SERVICES)
|
|
12
12
|
for key in ("mariadb", "mongodb", "sqlserver", "valkey", "memcached", "elasticsearch", "typesense", "centrifugo", "cypress"):
|
|
13
13
|
service = BUILTIN_SERVICES[key]
|
|
@@ -141,7 +141,7 @@ class StubCheckTests(ProjectTestCase):
|
|
|
141
141
|
self.assertEqual(0, self.init("--app", "main:app", "--node-assets"))
|
|
142
142
|
(self.root / "package.json").unlink()
|
|
143
143
|
with captured() as output:
|
|
144
|
-
self.assertEqual(1, self.ship("
|
|
144
|
+
self.assertEqual(1, self.ship("check"))
|
|
145
145
|
self.assertIn("package.json", output.stderr)
|
|
146
146
|
|
|
147
147
|
def test_node_assets_stage_is_rendered(self):
|
|
@@ -88,7 +88,7 @@ class InterfaceDetectionTests(ProjectTestCase):
|
|
|
88
88
|
self.assertEqual(0, self.init("--app", "main:app"))
|
|
89
89
|
self.write_config(app="main:app", server="gunicorn")
|
|
90
90
|
with captured() as output:
|
|
91
|
-
self.assertEqual(1, self.ship("
|
|
91
|
+
self.assertEqual(1, self.ship("check"))
|
|
92
92
|
self.assertIn("can't serve a ASGI app", output.stderr)
|
|
93
93
|
|
|
94
94
|
|
|
@@ -13,7 +13,7 @@ from python_ship.services import BUILTIN_SERVICES
|
|
|
13
13
|
from tests.helpers import ProjectTestCase
|
|
14
14
|
|
|
15
15
|
GROUPS = {
|
|
16
|
-
"mariadb": "database", "mongodb": "database", "sqlserver": "database",
|
|
16
|
+
"mariadb": "database", "mongodb": "database", "sqlserver": "database", "clickhouse": "database",
|
|
17
17
|
"valkey": "cache", "memcached": "cache", "elasticsearch": "search", "typesense": "search",
|
|
18
18
|
"centrifugo": "broadcasting", "cypress": "testing", "postgres": "database", "mysql": "database", "redis": "cache", "rabbitmq": "broker", "celery": "tasks",
|
|
19
19
|
"mailpit": "mail", "meilisearch": "search", "mercure": "broadcasting",
|
|
@@ -51,7 +51,24 @@ class CatalogTests(ProjectTestCase):
|
|
|
51
51
|
with self.subTest(key=key):
|
|
52
52
|
self.assertIsInstance(service, ServiceDefinition)
|
|
53
53
|
self.assertTrue(service.label)
|
|
54
|
-
self.assertEqual({"postgres", "mysql", "mariadb", "mongodb", "sqlserver"
|
|
54
|
+
self.assertEqual({"postgres", "mysql", "mariadb", "mongodb", "sqlserver", "clickhouse"},
|
|
55
|
+
{key for key, item in BUILTIN_SERVICES.items() if isinstance(item, ProvidesDatabaseShell)})
|
|
56
|
+
|
|
57
|
+
def test_named_clickhouse_uses_its_renamed_endpoint_and_separate_production_credentials(self):
|
|
58
|
+
config = ShipConfig(app="main:app", services={"database": "postgres"},
|
|
59
|
+
additional_services=[AdditionalService("database", "clickhouse", "warehouse")],
|
|
60
|
+
service_names={"clickhouse-warehouse": "reporting-db"})
|
|
61
|
+
model = self.model(config, production=True)
|
|
62
|
+
clickhouse = model["services"]["reporting-db"]
|
|
63
|
+
app_environment = model["services"]["app"]["environment"]
|
|
64
|
+
self.assertEqual("postgres", app_environment["DB_HOST"])
|
|
65
|
+
self.assertEqual("http://reporting-db:8123", app_environment["WAREHOUSE_CLICKHOUSE_HTTP_URL"])
|
|
66
|
+
self.assertEqual("9000", app_environment["WAREHOUSE_CLICKHOUSE_PORT"])
|
|
67
|
+
self.assertEqual(["clickhouse-warehouse_data:/var/lib/clickhouse"], clickhouse["volumes"])
|
|
68
|
+
self.assertEqual([8123, 9000], clickhouse["expose"])
|
|
69
|
+
self.assertFalse(clickhouse.get("ports"))
|
|
70
|
+
self.assertEqual(clickhouse["environment"]["CLICKHOUSE_PASSWORD"], app_environment["WAREHOUSE_CLICKHOUSE_PASSWORD"])
|
|
71
|
+
self.assertIn("WAREHOUSE_CLICKHOUSE_PASSWORD", required_variables(model))
|
|
55
72
|
|
|
56
73
|
def test_shared_service_environment_contract(self):
|
|
57
74
|
contract = json.loads((Path(__file__).resolve().parents[1] / "schema/service-environment.json").read_text())
|
|
@@ -171,6 +188,10 @@ class CatalogTests(ProjectTestCase):
|
|
|
171
188
|
service.app_environment(context)["AMQP_URL"])
|
|
172
189
|
_, production = self.context("rabbitmq", production=True)
|
|
173
190
|
self.assertNotIn("ports", service.compose_fragment(production)["rabbitmq"])
|
|
191
|
+
for current in (context, production):
|
|
192
|
+
arguments = service.compose_fragment(current)["rabbitmq"]["environment"]["RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS"]
|
|
193
|
+
self.assertIn("-rabbitmq_management_agent disable_metrics_collector true", arguments)
|
|
194
|
+
self.assertIn("-rabbitmq_management disable_stats true enable_queue_totals true", arguments)
|
|
174
195
|
|
|
175
196
|
def test_celery_brokers_and_result_backends(self):
|
|
176
197
|
amqp = "amqp://${RABBITMQ_USER:-app}:${RABBITMQ_PASSWORD:-ship}@rabbitmq:5672//"
|
|
@@ -37,8 +37,11 @@ class WizardTerminalTests(ProjectTestCase):
|
|
|
37
37
|
if not chunk:
|
|
38
38
|
break
|
|
39
39
|
output.extend(chunk)
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
self.assertIn(b"check", output)
|
|
41
|
+
if no_color:
|
|
42
|
+
self.assertNotIn(b"\x1b[", output)
|
|
43
|
+
else:
|
|
44
|
+
self.assertRegex(output, rb"\x1b\[1;36mcheck +\x1b\[0m")
|
|
42
45
|
finally:
|
|
43
46
|
os.close(master)
|
|
44
47
|
if slave != -1:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_ship-0.3.0 → python_ship-0.4.0}/src/python_ship/templates/check-python-security-floor.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|