arcsecond 4.4.3__tar.gz → 4.5.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.
Files changed (138) hide show
  1. {arcsecond-4.4.3 → arcsecond-4.5.0}/PKG-INFO +1 -1
  2. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/composedoc.py +24 -0
  3. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/docker/docker-compose.yml +26 -5
  4. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/doctor.py +15 -1
  5. arcsecond-4.5.0/arcsecond/hosting/forecast.py +71 -0
  6. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/lifecycle.py +4 -1
  7. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/local.py +27 -2
  8. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/network/manifest.toml +3 -3
  9. {arcsecond-4.4.3 → arcsecond-4.5.0}/pyproject.toml +1 -1
  10. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_composedoc.py +26 -1
  11. arcsecond-4.5.0/tests/test_hosting_forecast.py +77 -0
  12. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_local.py +42 -1
  13. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_token.py +1 -0
  14. {arcsecond-4.4.3 → arcsecond-4.5.0}/uv.lock +1 -1
  15. {arcsecond-4.4.3 → arcsecond-4.5.0}/.docker/Dockerfile_postgres +0 -0
  16. {arcsecond-4.4.3 → arcsecond-4.5.0}/.docker/Dockerfile_redis +0 -0
  17. {arcsecond-4.4.3 → arcsecond-4.5.0}/.flake8 +0 -0
  18. {arcsecond-4.4.3 → arcsecond-4.5.0}/.gitattributes +0 -0
  19. {arcsecond-4.4.3 → arcsecond-4.5.0}/.github/dependabot.yml +0 -0
  20. {arcsecond-4.4.3 → arcsecond-4.5.0}/.github/workflows/pythonpublish.yml +0 -0
  21. {arcsecond-4.4.3 → arcsecond-4.5.0}/.github/workflows/tests.yml +0 -0
  22. {arcsecond-4.4.3 → arcsecond-4.5.0}/.gitignore +0 -0
  23. {arcsecond-4.4.3 → arcsecond-4.5.0}/LICENSE +0 -0
  24. {arcsecond-4.4.3 → arcsecond-4.5.0}/Makefile +0 -0
  25. {arcsecond-4.4.3 → arcsecond-4.5.0}/README.md +0 -0
  26. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/__init__.py +0 -0
  27. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/__version__.py +0 -0
  28. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/alpaca/__init__.py +0 -0
  29. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/alpaca/commands.py +0 -0
  30. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/alpaca/dome_probe.py +0 -0
  31. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/alpaca/probe.py +0 -0
  32. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/alpaca/telescope_probe.py +0 -0
  33. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/api/__init__.py +0 -0
  34. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/api/config.py +0 -0
  35. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/api/constants.py +0 -0
  36. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/api/endpoint.py +0 -0
  37. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/api/main.py +0 -0
  38. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/api/resources.py +0 -0
  39. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cli.py +0 -0
  40. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/__init__.py +0 -0
  41. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/auth.py +0 -0
  42. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/resources.py +0 -0
  43. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/__init__.py +0 -0
  44. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/constants.py +0 -0
  45. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/context.py +0 -0
  46. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/datafiles/__init__.py +0 -0
  47. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/datafiles/context.py +0 -0
  48. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/datafiles/errors.py +0 -0
  49. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/datafiles/uploader.py +0 -0
  50. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/datafiles/utils.py +0 -0
  51. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/errors.py +0 -0
  52. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/logger.py +0 -0
  53. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/uploader.py +0 -0
  54. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/utils.py +0 -0
  55. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploader/walker.py +0 -0
  56. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/cloud/uploads.py +0 -0
  57. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/docgen.py +0 -0
  58. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/errors.py +0 -0
  59. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/__init__.py +0 -0
  60. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/backups.py +0 -0
  61. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/database.py +0 -0
  62. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/docker/__init__.py +0 -0
  63. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/network/__init__.py +0 -0
  64. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/network/guard.py +0 -0
  65. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/network/outbound.py +0 -0
  66. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/network/probe.py +0 -0
  67. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/network/sheet.py +0 -0
  68. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/skybrightness.py +0 -0
  69. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/stack.py +0 -0
  70. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/token.py +0 -0
  71. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/hosting/utils.py +0 -0
  72. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/__init__.py +0 -0
  73. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/autostart.py +0 -0
  74. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/commands.py +0 -0
  75. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/detection.py +0 -0
  76. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/proxy.py +0 -0
  77. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/registry.py +0 -0
  78. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/runtime.py +0 -0
  79. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/sources/__init__.py +0 -0
  80. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/sources/base.py +0 -0
  81. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/sources/filewatch.py +0 -0
  82. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/sources/mdns.py +0 -0
  83. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/sources/network.py +0 -0
  84. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/sources/opencv.py +0 -0
  85. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/imagesources/store.py +0 -0
  86. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/options.py +0 -0
  87. {arcsecond-4.4.3 → arcsecond-4.5.0}/arcsecond/targets.py +0 -0
  88. {arcsecond-4.4.3 → arcsecond-4.5.0}/examples/example_upload_files.py +0 -0
  89. {arcsecond-4.4.3 → arcsecond-4.5.0}/requirements.txt +0 -0
  90. {arcsecond-4.4.3 → arcsecond-4.5.0}/setup.cfg +0 -0
  91. {arcsecond-4.4.3 → arcsecond-4.5.0}/setup.py +0 -0
  92. {arcsecond-4.4.3 → arcsecond-4.5.0}/sonar-project.properties +0 -0
  93. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/__init__.py +0 -0
  94. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/api/__init__.py +0 -0
  95. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/api/test_api.py +0 -0
  96. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/api/test_api_endpoint.py +0 -0
  97. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/api/test_config.py +0 -0
  98. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/api/test_config_pointer.py +0 -0
  99. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/api/test_targets.py +0 -0
  100. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/cloud/__init__.py +0 -0
  101. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/cloud/uploader/__init__.py +0 -0
  102. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/cloud/uploader/datafiles/__init__.py +0 -0
  103. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/cloud/uploader/datafiles/test_uploader_errors.py +0 -0
  104. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/cloud/uploader/datafiles/test_uploader_full_process.py +0 -0
  105. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/cloud/uploader/datafiles/test_uploader_init.py +0 -0
  106. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/cloud/uploader/datafiles/test_uploader_prepare.py +0 -0
  107. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/cloud/uploader/datafiles/test_uploader_upload.py +0 -0
  108. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/conftest.py +0 -0
  109. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/fixtures/docker-compose-6.2.yml +0 -0
  110. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/fixtures/docker-compose-6.4.yml +0 -0
  111. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/fixtures/file1.fits +0 -0
  112. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_alpaca_probe.py +0 -0
  113. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_cli.py +0 -0
  114. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_cli_api_commands.py +0 -0
  115. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_docgen.py +0 -0
  116. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_backups_install_dir.py +0 -0
  117. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_backups_restore.py +0 -0
  118. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_database.py +0 -0
  119. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_doctor.py +0 -0
  120. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_lifecycle.py +0 -0
  121. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_network_guard.py +0 -0
  122. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_network_manifest.py +0 -0
  123. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_network_outbound.py +0 -0
  124. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_network_probe.py +0 -0
  125. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_network_sheet.py +0 -0
  126. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_skybrightness.py +0 -0
  127. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_stack.py +0 -0
  128. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_hosting_utils_secret_key.py +0 -0
  129. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_imagesources_autostart.py +0 -0
  130. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_imagesources_commands.py +0 -0
  131. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_imagesources_detection.py +0 -0
  132. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_imagesources_mdns.py +0 -0
  133. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_imagesources_network.py +0 -0
  134. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_imagesources_proxy.py +0 -0
  135. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_imagesources_store.py +0 -0
  136. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_imagesources_webcam.py +0 -0
  137. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/test_targets_planning.py +0 -0
  138. {arcsecond-4.4.3 → arcsecond-4.5.0}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: arcsecond
3
- Version: 4.4.3
3
+ Version: 4.5.0
4
4
  Summary: CLI for arcsecond.io
5
5
  Project-URL: Homepage, https://github.com/arcsecond-io/cli
6
6
  Project-URL: Issues, https://github.com/arcsecond-io/cli/issues
@@ -51,6 +51,7 @@ class Service:
51
51
  volumes: List[str] = field(default_factory=list)
52
52
  healthcheck: bool = False
53
53
  stop_grace_period: Optional[str] = None
54
+ logging: Optional[str] = None # e.g. "*default-logging", the shared anchor
54
55
  env_vars: List[str] = field(default_factory=list)
55
56
  optional: Optional[str] = None # the marker name, e.g. "alerts"
56
57
 
@@ -139,6 +140,7 @@ class _Reader:
139
140
  "restart": "restart",
140
141
  "entrypoint": "entrypoint",
141
142
  "stop_grace_period": "stop_grace_period",
143
+ "logging": "logging",
142
144
  }
143
145
  if key in scalar:
144
146
  setattr(self.current, scalar[key], _as_shipped(value))
@@ -229,6 +231,28 @@ ENV_KEYS: Dict[str, tuple] = {
229
231
  "NASA GCN client credentials for the optional transient-alerts service. Empty until you paste yours.",
230
232
  ),
231
233
  "GCN_CONSUMER_CLIENT_SECRET": (OPERATOR, "See GCN_CONSUMER_CLIENT_ID."),
234
+ "TOMORROW_IO_API_KEY": (
235
+ OPERATOR,
236
+ "Your own Tomorrow.io API key: the weather forecast, and the safety conditions only a forecast can feed "
237
+ "(cloud cover, humidity) where no station of yours measures them. A free key from "
238
+ "https://www.tomorrow.io/weather-api/ is enough; the backend asks once an hour per observing site. "
239
+ "Arcsecond's key is not shipped. Empty: no forecast, and the Safety strip says so. Asked at setup, or "
240
+ "`arcsecond setup --tomorrow-io-key KEY`.",
241
+ ),
242
+ "FINK_ENABLED": (
243
+ BACKEND,
244
+ "`false` turns off the survey alerts from Fink in the optional transient-alerts service; GCN keeps "
245
+ "running. Fink needs no credentials, so it is on wherever the service runs.",
246
+ ),
247
+ "FINK_KAFKA_GROUP_ID": (
248
+ BACKEND,
249
+ "The installation's consumer group at Fink. Empty: `arcsecond-local-` and this machine's fingerprint, "
250
+ "which no other installation shares. Two installations sharing a group split the alerts between them.",
251
+ ),
252
+ "FINK_TOPICS": (
253
+ BACKEND,
254
+ "Comma-separated Fink topics, each ending in its survey (`_ztf`). Empty: the topics Arcsecond chose.",
255
+ ),
232
256
  FRONTEND_HOST_ENV_KEY: (
233
257
  OPERATOR,
234
258
  "The address other computers reach the installation at, port included (e.g. 192.168.1.42:5555). The backend "
@@ -1,6 +1,15 @@
1
1
  # === Arcsecond.local config. ===
2
2
  # *** DO NOT change any name or port number. ***
3
- # Version 7.5
3
+ # Version 7.7
4
+
5
+ # One log setting for every service, so no service can fill the disk with
6
+ # its log: five files of 20 MB each, the oldest dropped first. A full disk
7
+ # stops the database and the broker from saving, and the whole stack with them.
8
+ x-logging: &default-logging
9
+ driver: json-file
10
+ options:
11
+ max-size: "20m"
12
+ max-file: "5"
4
13
 
5
14
  services:
6
15
  # Database (PostgresQL)
@@ -8,6 +17,7 @@ services:
8
17
  image: postgres:16
9
18
  container_name: arcsecond-db
10
19
  restart: unless-stopped
20
+ logging: *default-logging
11
21
  # No host port. The backend reaches the DB over the internal Docker
12
22
  # network (hostname `arcsecond-db`), and every CLI command that needs
13
23
  # the DB (backups, restore, password rotation) goes through `docker exec`
@@ -24,6 +34,7 @@ services:
24
34
  image: redis:7.4
25
35
  container_name: arcsecond-broker
26
36
  restart: unless-stopped
37
+ logging: *default-logging
27
38
  # No host port either: Redis with no auth must never be reachable from
28
39
  # outside the stack, and the backend reaches it over the Docker network.
29
40
 
@@ -37,6 +48,7 @@ services:
37
48
  pull_policy: ${ARCSECOND_API_PULL_POLICY:-missing}
38
49
  container_name: arcsecond-api
39
50
  restart: unless-stopped
51
+ logging: *default-logging
40
52
  entrypoint: /home/app/entrypoint-server.sh
41
53
  # This machine only. Browsers and other computers go through the webapp's
42
54
  # port, which serves the very same API under /api/; 8800 is for the
@@ -81,6 +93,7 @@ services:
81
93
  pull_policy: ${ARCSECOND_API_PULL_POLICY:-missing}
82
94
  container_name: arcsecond-worker
83
95
  restart: unless-stopped
96
+ logging: *default-logging
84
97
  entrypoint: /home/app/entrypoint-worker.sh
85
98
  depends_on:
86
99
  backend:
@@ -110,6 +123,7 @@ services:
110
123
  pull_policy: ${ARCSECOND_API_PULL_POLICY:-missing}
111
124
  container_name: arcsecond-dataworker
112
125
  restart: unless-stopped
126
+ logging: *default-logging
113
127
  entrypoint: /home/app/entrypoint-worker.sh
114
128
  depends_on:
115
129
  backend:
@@ -137,6 +151,7 @@ services:
137
151
  pull_policy: ${ARCSECOND_API_PULL_POLICY:-missing}
138
152
  container_name: arcsecond-beat
139
153
  restart: unless-stopped
154
+ logging: *default-logging
140
155
  entrypoint: /home/app/entrypoint-beat.sh
141
156
  depends_on:
142
157
  backend:
@@ -150,6 +165,7 @@ services:
150
165
  image: ghcr.io/arcsecond-io/arcsecond-service-platesolver-astrometry:latest
151
166
  container_name: arcsecond-platesolver
152
167
  restart: unless-stopped
168
+ logging: *default-logging
153
169
  # No host port. Only the backend calls the solver, over the internal Docker
154
170
  # network; it has no authentication and nothing outside the stack needs it.
155
171
 
@@ -163,6 +179,7 @@ services:
163
179
  pull_policy: ${ARCSECOND_WEB_PULL_POLICY:-missing}
164
180
  container_name: arcsecond-web
165
181
  restart: unless-stopped
182
+ logging: *default-logging
166
183
  depends_on:
167
184
  backend:
168
185
  condition: service_started
@@ -188,16 +205,20 @@ services:
188
205
 
189
206
  # >>> arcsecond:alerts
190
207
  # Arcsecond transient-alerts consumer (optional).
191
- # Long-lived Kafka client for NASA GCN. Outbound TLS only — nothing listens:
192
- # auth.gcn.nasa.gov on 443, then kafka, kafka1, kafka2 and
193
- # kafka3.gcn.nasa.gov on 9092. Requires GCN_CONSUMER_CLIENT_ID /
194
- # GCN_CONSUMER_CLIENT_SECRET in .env; idles harmlessly when they are absent.
208
+ # Long-lived Kafka clients, outbound only — nothing listens.
209
+ # NASA GCN, over TLS: auth.gcn.nasa.gov on 443, then kafka, kafka1, kafka2
210
+ # and kafka3.gcn.nasa.gov on 9092. Requires GCN_CONSUMER_CLIENT_ID /
211
+ # GCN_CONSUMER_CLIENT_SECRET in .env; idles harmlessly without them.
212
+ # Fink survey alerts, unencrypted (public data): kafka-ztf.fink-broker.org
213
+ # and the brokers it hands out, all on 24499. Needs nothing in .env;
214
+ # FINK_ENABLED=false turns it off.
195
215
  # Single instance only — do not scale it.
196
216
  alerts:
197
217
  image: ${ARCSECOND_API_IMAGE:-ghcr.io/arcsecond-io/arcsecond-api:latest}
198
218
  pull_policy: ${ARCSECOND_API_PULL_POLICY:-missing}
199
219
  container_name: arcsecond-alerts
200
220
  restart: unless-stopped
221
+ logging: *default-logging
201
222
  entrypoint: /home/app/entrypoint-alerts.sh
202
223
  depends_on:
203
224
  backend:
@@ -50,7 +50,7 @@ from arcsecond.api.config import ArcsecondConfig
50
50
  from arcsecond.errors import ArcsecondError
51
51
  from arcsecond.options import basic_options
52
52
 
53
- from . import stack
53
+ from . import forecast, stack
54
54
  from .lifecycle import dir_option
55
55
  from .local import (
56
56
  FRONTEND_HOST_ENV_KEY,
@@ -335,6 +335,19 @@ def check_env_file(install) -> List[Finding]:
335
335
  return findings
336
336
 
337
337
 
338
+ def check_forecast_key(install) -> Finding:
339
+ """Present or not: whether the key works would cost a metered call."""
340
+ if (install.read_env(forecast.ENV_KEY) or "").strip():
341
+ return Finding("forecast.key", "Weather forecast key", OK, "a Tomorrow.io key is set")
342
+ return Finding(
343
+ "forecast.key",
344
+ "Weather forecast key",
345
+ WARN,
346
+ "no Tomorrow.io key: no weather forecast, and no safety condition fed by it",
347
+ fix=forecast.LATER,
348
+ )
349
+
350
+
338
351
  def check_lan_host(install, host: Host) -> Finding:
339
352
  declared = (install.read_env(FRONTEND_HOST_ENV_KEY) or "").strip()
340
353
  lan = host.lan_ipv4()
@@ -788,6 +801,7 @@ def run_checks(
788
801
  findings.append(docker)
789
802
  findings.append(check_template(install))
790
803
  findings += check_env_file(install)
804
+ findings.append(check_forecast_key(install))
791
805
  findings.append(check_lan_host(install, host))
792
806
 
793
807
  running = False
@@ -0,0 +1,71 @@
1
+ """The installation's own Tomorrow.io key.
2
+
3
+ The backend asks Tomorrow.io for each observing site's current conditions
4
+ once an hour, and for the forecast the web app shows. The key is the
5
+ observatory's own: Arcsecond's is not shipped with the images, and an
6
+ installation without one simply has no forecast (the safety strip says so
7
+ for any condition only the forecast could have fed). A free key carries
8
+ about twenty sites at the hourly beat.
9
+
10
+ `arcsecond setup` asks for it while the TOMORROW_IO_API_KEY line of .env is
11
+ empty, the way it asks for the access token: an empty answer is "later", not
12
+ "never", since nothing is lost by asking again.
13
+ """
14
+
15
+ import click
16
+
17
+ from .utils import _read_env_value, _set_env_value
18
+
19
+ ENV_KEY = "TOMORROW_IO_API_KEY"
20
+ SIGN_UP_URL = "https://www.tomorrow.io/weather-api/"
21
+
22
+ ENV_COMMENT = (
23
+ "# Your own Tomorrow.io API key (optional — the weather forecast and the"
24
+ f" safety conditions it feeds). A free key is enough: {SIGN_UP_URL}"
25
+ )
26
+
27
+ LATER = "arcsecond setup --tomorrow-io-key <your key> && arcsecond restart"
28
+
29
+
30
+ def has_key(env_path) -> bool:
31
+ return bool((_read_env_value(ENV_KEY, env_path) or "").strip())
32
+
33
+
34
+ def offer(env_path, key=None, interactive=True) -> None:
35
+ """Record ``key`` (--tomorrow-io-key) when given; otherwise ask while
36
+ none is recorded and there is a terminal to ask on."""
37
+ if key is not None:
38
+ key = key.strip()
39
+ _set_env_value(env_path, ENV_KEY, key)
40
+ if key:
41
+ click.echo("Tomorrow.io key recorded. The weather forecast starts with the next arcsecond restart.")
42
+ else:
43
+ click.echo("Tomorrow.io key removed: this installation has no weather forecast.")
44
+ return
45
+
46
+ if has_key(env_path) or not interactive:
47
+ return
48
+
49
+ click.echo(
50
+ "\nThe weather forecast comes from Tomorrow.io, with a key of your own "
51
+ f"(a free one is enough: {SIGN_UP_URL})."
52
+ )
53
+ entered = click.prompt(
54
+ "Tomorrow.io API key (nothing is shown while you type; leave it empty to do this later)",
55
+ hide_input=True,
56
+ default="",
57
+ show_default=False,
58
+ ).strip()
59
+ if entered:
60
+ _set_env_value(env_path, ENV_KEY, entered)
61
+ click.echo(click.style("Tomorrow.io key recorded.", fg="green"))
62
+
63
+
64
+ def next_step(env_path):
65
+ """The line `setup` ends with when there is still no key, or None."""
66
+ if has_key(env_path):
67
+ return None
68
+ return (
69
+ "No Tomorrow.io key yet, so no weather forecast. With a key of your own "
70
+ f"({SIGN_UP_URL}): {LATER}"
71
+ )
@@ -272,7 +272,10 @@ def status(directory):
272
272
  @basic_options
273
273
  def logs(directory, service, follow, tail):
274
274
  """Show recent logs. Services are named as in `arcsecond status`:
275
- backend, worker, dataworker, beat, web, db, broker, platesolver, alerts."""
275
+ backend, worker, dataworker, beat, web, db, broker, platesolver, alerts.
276
+
277
+ Each service keeps the last 100 MB of its log, so a busy one cannot fill
278
+ the disk; older lines are dropped."""
276
279
  install = stack.resolve_install_dir(directory)
277
280
  stack.ensure_docker()
278
281
  args = ["logs", "--tail", str(tail)]
@@ -11,6 +11,7 @@ from arcsecond.api.config import ArcsecondConfig
11
11
  from arcsecond.errors import ArcsecondError
12
12
  from arcsecond.options import basic_options
13
13
 
14
+ from . import forecast
14
15
  from .utils import (
15
16
  _get_encryption_key,
16
17
  _get_random_postgres_password,
@@ -115,6 +116,9 @@ REQUIRED_ENV_PROVIDERS = {
115
116
  # Empty placeholders: the operator pastes their own GCN credentials here.
116
117
  "GCN_CONSUMER_CLIENT_ID": lambda: "",
117
118
  "GCN_CONSUMER_CLIENT_SECRET": lambda: "",
119
+ # Empty placeholder: the operator's own Tomorrow.io key, asked for by
120
+ # `setup` while it is empty (forecast.offer). Arcsecond's is not shipped.
121
+ "TOMORROW_IO_API_KEY": lambda: "",
118
122
  # Empty placeholder: filled in by `setup` with this machine's LAN address
119
123
  # (_fill_in_lan_host), or set by `arcsecond setup --lan-host`, or by hand.
120
124
  FRONTEND_HOST_ENV_KEY: lambda: "",
@@ -151,6 +155,7 @@ def write_env_file(directory=None):
151
155
  "POSTGRES_DB",
152
156
  "GCN_CONSUMER_CLIENT_ID",
153
157
  "GCN_CONSUMER_CLIENT_SECRET",
158
+ "TOMORROW_IO_API_KEY",
154
159
  FRONTEND_HOST_ENV_KEY,
155
160
  ]
156
161
 
@@ -163,6 +168,8 @@ def write_env_file(directory=None):
163
168
  # have hand-added one of the two already.
164
169
  lines.append(GCN_ENV_COMMENT)
165
170
  gcn_comment_pending = False
171
+ if key == "TOMORROW_IO_API_KEY":
172
+ lines.append(forecast.ENV_COMMENT)
166
173
  if key == FRONTEND_HOST_ENV_KEY:
167
174
  lines.append(FRONTEND_HOST_ENV_COMMENT)
168
175
  lines.append(_format_env_line(key, REQUIRED_ENV_PROVIDERS[key]()))
@@ -488,6 +495,10 @@ def _offer_sky_map(env_path, flag):
488
495
  skybrightness.offer(env_path, flag=flag, interactive=_stdin_is_interactive())
489
496
 
490
497
 
498
+ def _offer_forecast_key(env_path, key):
499
+ forecast.offer(env_path, key=key, interactive=_stdin_is_interactive())
500
+
501
+
491
502
  def _normalise_lan_host(value):
492
503
  """`192.168.1.42` → `192.168.1.42:5555`; a scheme or a path is refused."""
493
504
  value = (value or "").strip()
@@ -553,8 +564,16 @@ def _fill_in_lan_host(env_path):
553
564
  help="Keep (or not) a copy of the sky-brightness map on this machine, "
554
565
  "without prompting. With a copy, no outside lookup is made for it.",
555
566
  )
567
+ @click.option(
568
+ "--tomorrow-io-key",
569
+ "tomorrow_io_key",
570
+ default=None,
571
+ metavar="KEY",
572
+ help="Your own Tomorrow.io API key, for the weather forecast, without "
573
+ "prompting (a free key is enough). An empty value removes it.",
574
+ )
556
575
  @basic_options
557
- def setup(with_alerts, lan_host, with_sky_map):
576
+ def setup(with_alerts, lan_host, with_sky_map, tomorrow_io_key):
558
577
  """Write (or update) the two files an installation is made of, in the
559
578
  current folder: .env, with this installation's secrets, and
560
579
  docker-compose.yml — and ask for the access token Arcsecond gave your
@@ -599,13 +618,19 @@ def setup(with_alerts, lan_host, with_sky_map):
599
618
  _register_local_api()
600
619
  _offer_token()
601
620
  _offer_sky_map(env_path, with_sky_map)
621
+ _offer_forecast_key(env_path, tomorrow_io_key)
602
622
 
603
623
  if "alerts" in enabled:
604
624
  click.echo(
605
625
  "\nTransient alerts next steps: create GCN credentials (see "
606
626
  "https://docs.arcsecond.io/guides/operating/transient-alerts), paste them into "
607
627
  ".env as GCN_CONSUMER_CLIENT_ID / GCN_CONSUMER_CLIENT_SECRET, then "
608
- "run: arcsecond restart alerts"
628
+ "run: arcsecond restart alerts. Survey alerts from Fink need nothing: "
629
+ "they start with the service."
609
630
  )
610
631
 
632
+ forecast_step = forecast.next_step(env_path)
633
+ if forecast_step:
634
+ click.echo("\n" + forecast_step)
635
+
611
636
  click.echo("\nNext: " + click.style("arcsecond start", bold=True))
@@ -382,10 +382,10 @@ port = 443
382
382
  transport = "tcp"
383
383
  encrypted = true
384
384
  need = "optional"
385
- enabled_by = "a Tomorrow.io key in the configuration file"
385
+ enabled_by = "your own Tomorrow.io key in the configuration file (asked by arcsecond setup)"
386
386
  purpose = "Weather forecast for each observing site."
387
- feature = "Forecast panels."
388
- frequency = "Every 5 minutes per site."
387
+ feature = "Forecast panels, and the safety conditions only a forecast can feed."
388
+ frequency = "Hourly per site, and when someone opens a forecast."
389
389
  data_sent = ["the observing site's position and time zone", "the key"]
390
390
  without_it = "No forecast. Weather read from the observatory's own station is unaffected."
391
391
  proxy = "yes"
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "arcsecond"
7
- version = "4.4.3"
7
+ version = "4.5.0"
8
8
  authors = [
9
9
  { name = "Cedric Foellmi", email = "cedric@arcsecond.io" },
10
10
  ]
@@ -1,9 +1,11 @@
1
1
  """The services and environment reference, read from the packaged template."""
2
2
 
3
+ import re
4
+
3
5
  from click.testing import CliRunner
4
6
 
5
7
  from arcsecond import cli
6
- from arcsecond.hosting import composedoc, local
8
+ from arcsecond.hosting import composedoc, lifecycle, local
7
9
 
8
10
 
9
11
  def _services():
@@ -44,6 +46,28 @@ def test_facts_are_read_where_the_template_states_them():
44
46
  assert any("/data" in v for v in s["backend"].volumes)
45
47
 
46
48
 
49
+ def test_every_service_keeps_a_capped_log():
50
+ """One shared setting, so no service can fill the disk with its log; a
51
+ service added without it fails here."""
52
+ text = local.packaged_compose_text()
53
+ assert (
54
+ "x-logging: &default-logging\n"
55
+ " driver: json-file\n"
56
+ " options:\n"
57
+ ' max-size: "20m"\n'
58
+ ' max-file: "5"\n'
59
+ ) in text
60
+ for service in composedoc.parse_services(text):
61
+ assert service.logging == "*default-logging", service.name
62
+
63
+
64
+ def test_the_logs_help_states_the_cap_the_template_sets():
65
+ text = local.packaged_compose_text()
66
+ size = int(re.search(r'max-size: "(\d+)m"', text).group(1))
67
+ files = int(re.search(r'max-file: "(\d+)"', text).group(1))
68
+ assert f"last {size * files} MB" in lifecycle.logs.help
69
+
70
+
47
71
  def test_the_comments_are_kept_as_documentation():
48
72
  s = _services()
49
73
  assert s["db"].description == ["Database (PostgresQL)"]
@@ -56,6 +80,7 @@ def test_optional_services_are_recognised_by_their_markers():
56
80
  assert s["alerts"].optional == "alerts"
57
81
  assert s["web"].optional is None
58
82
  assert "GCN_CONSUMER_CLIENT_ID" in " ".join(s["alerts"].description)
83
+ assert "FINK_ENABLED" in " ".join(s["alerts"].description)
59
84
 
60
85
 
61
86
  def test_every_service_on_the_backend_image_can_be_given_a_local_build():
@@ -0,0 +1,77 @@
1
+ """The installation's own Tomorrow.io key: asked while empty, never shipped."""
2
+ from types import SimpleNamespace
3
+
4
+ import pytest
5
+
6
+ from arcsecond.hosting import doctor, forecast
7
+
8
+
9
+ @pytest.fixture
10
+ def env(tmp_path):
11
+ path = tmp_path / ".env"
12
+ path.write_text(f"{forecast.ENV_COMMENT}\nTOMORROW_IO_API_KEY=\n", encoding="utf-8")
13
+ return path
14
+
15
+
16
+ def _key(path):
17
+ for line in path.read_text(encoding="utf-8").splitlines():
18
+ if line.startswith("TOMORROW_IO_API_KEY="):
19
+ return line.split("=", 1)[1]
20
+ return None
21
+
22
+
23
+ def test_the_flag_records_the_key_without_asking(env, monkeypatch):
24
+ monkeypatch.setattr(forecast.click, "prompt", lambda *a, **k: pytest.fail("asked"))
25
+ forecast.offer(env, key=" abc123 ", interactive=True)
26
+ assert _key(env) == "abc123"
27
+ assert env.read_text().count("TOMORROW_IO_API_KEY=") == 1
28
+
29
+
30
+ def test_an_empty_flag_removes_the_key(env):
31
+ forecast.offer(env, key="abc123")
32
+ forecast.offer(env, key="")
33
+ assert _key(env) == ""
34
+
35
+
36
+ def test_an_empty_key_is_asked_for_and_an_answer_recorded(env, monkeypatch):
37
+ monkeypatch.setattr(forecast.click, "prompt", lambda *a, **k: "abc123")
38
+ forecast.offer(env, interactive=True)
39
+ assert _key(env) == "abc123"
40
+
41
+
42
+ def test_an_empty_answer_leaves_it_empty_and_the_next_setup_asks_again(env, monkeypatch):
43
+ asked = []
44
+ monkeypatch.setattr(forecast.click, "prompt", lambda *a, **k: asked.append(1) or "")
45
+ forecast.offer(env, interactive=True)
46
+ forecast.offer(env, interactive=True)
47
+ assert _key(env) == ""
48
+ assert len(asked) == 2
49
+
50
+
51
+ def test_a_recorded_key_is_not_asked_for_again(env, monkeypatch):
52
+ forecast.offer(env, key="abc123")
53
+ monkeypatch.setattr(forecast.click, "prompt", lambda *a, **k: pytest.fail("asked again"))
54
+ forecast.offer(env, interactive=True)
55
+
56
+
57
+ def test_without_a_terminal_nothing_is_asked(env, monkeypatch):
58
+ monkeypatch.setattr(forecast.click, "prompt", lambda *a, **k: pytest.fail("asked"))
59
+ forecast.offer(env, interactive=False)
60
+ assert _key(env) == ""
61
+
62
+
63
+ def test_the_next_step_line_only_while_there_is_no_key(env):
64
+ assert "--tomorrow-io-key" in forecast.next_step(env)
65
+ forecast.offer(env, key="abc123")
66
+ assert forecast.next_step(env) is None
67
+
68
+
69
+ def test_doctor_warns_without_a_key_and_says_how():
70
+ finding = doctor.check_forecast_key(SimpleNamespace(read_env=lambda k: ""))
71
+ assert finding.status == doctor.WARN
72
+ assert "--tomorrow-io-key" in finding.fix
73
+
74
+
75
+ def test_doctor_is_content_with_a_key():
76
+ finding = doctor.check_forecast_key(SimpleNamespace(read_env=lambda k: "abc123"))
77
+ assert finding.status == doctor.OK
@@ -3,7 +3,7 @@ from pathlib import Path, PurePosixPath, PureWindowsPath
3
3
 
4
4
  from click.testing import CliRunner
5
5
 
6
- from arcsecond.hosting import local
6
+ from arcsecond.hosting import forecast, local
7
7
 
8
8
  FIXTURES = Path(__file__).parent / "fixtures"
9
9
 
@@ -17,6 +17,12 @@ def _stub_env_generators(monkeypatch):
17
17
  monkeypatch.setattr(local, "prompt_shared_data_path", lambda: "/tmp/shared-data")
18
18
  monkeypatch.setattr(local, "_offer_token", lambda: None)
19
19
  monkeypatch.setattr(local, "_offer_sky_map", lambda env_path, flag: None)
20
+ # The flag still applies; the prompt never fires (tests/test_hosting_forecast.py).
21
+ monkeypatch.setattr(
22
+ local,
23
+ "_offer_forecast_key",
24
+ lambda env_path, key: forecast.offer(env_path, key=key, interactive=False),
25
+ )
20
26
  # The machine running the tests has a LAN address of its own; tests that
21
27
  # want one give it.
22
28
  monkeypatch.setattr(local, "lan_ipv4", lambda: None)
@@ -600,3 +606,38 @@ def test_setup_hands_over_to_start_and_never_mentions_docker_compose(
600
606
  assert "arcsecond start" in result.output
601
607
  assert "arcsecond restart alerts" in result.output
602
608
  assert "docker compose" not in result.output
609
+
610
+
611
+ # --- the installation's own Tomorrow.io key ------------------------------------
612
+
613
+
614
+ def test_setup_writes_an_empty_forecast_key_with_its_explanation(tmp_path, monkeypatch):
615
+ result = _setup(tmp_path, monkeypatch)
616
+ assert result.exit_code == 0, result.output
617
+ env_contents = (tmp_path / ".env").read_text(encoding="utf-8")
618
+ assert "TOMORROW_IO_API_KEY=\n" in env_contents
619
+ assert "tomorrow.io/weather-api" in env_contents
620
+ assert "No Tomorrow.io key yet" in result.output
621
+
622
+
623
+ def test_setup_tomorrow_io_key_flag_fills_it_in_and_drops_the_next_step(tmp_path, monkeypatch):
624
+ result = _setup(tmp_path, monkeypatch, "--tomorrow-io-key", "abc123")
625
+ assert result.exit_code == 0, result.output
626
+ env_contents = (tmp_path / ".env").read_text(encoding="utf-8")
627
+ assert "TOMORROW_IO_API_KEY=abc123\n" in env_contents
628
+ assert env_contents.count("TOMORROW_IO_API_KEY=") == 1
629
+ assert "No Tomorrow.io key yet" not in result.output
630
+
631
+
632
+ def test_an_existing_env_gets_the_forecast_key_line_once(tmp_path, monkeypatch):
633
+ _setup(tmp_path, monkeypatch)
634
+ env_path = tmp_path / ".env"
635
+ lines = [line for line in env_path.read_text(encoding="utf-8").splitlines()
636
+ if "TOMORROW_IO_API_KEY" not in line and "Tomorrow.io" not in line]
637
+ env_path.write_text("\n".join(lines) + "\n", encoding="utf-8")
638
+
639
+ _setup(tmp_path, monkeypatch)
640
+ _setup(tmp_path, monkeypatch)
641
+ env_contents = env_path.read_text(encoding="utf-8")
642
+ assert env_contents.count("TOMORROW_IO_API_KEY=") == 1
643
+ assert env_contents.count(forecast.ENV_COMMENT) == 1
@@ -233,6 +233,7 @@ def setup_env(tmp_path, monkeypatch):
233
233
  monkeypatch.setattr(local, "prompt_shared_data_path", lambda: "/tmp/shared")
234
234
  monkeypatch.setattr(local, "_stdin_is_interactive", lambda: True)
235
235
  monkeypatch.setattr(local, "_offer_sky_map", lambda env_path, flag: None)
236
+ monkeypatch.setattr(local, "_offer_forecast_key", lambda env_path, key: None)
236
237
  monkeypatch.setattr(stack, "ensure_docker", lambda: "2.29")
237
238
  stored = []
238
239
  monkeypatch.setattr(token, "store_token", lambda t: stored.append(t))
@@ -155,7 +155,7 @@ wheels = [
155
155
 
156
156
  [[package]]
157
157
  name = "arcsecond"
158
- version = "4.4.3"
158
+ version = "4.5.0"
159
159
  source = { editable = "." }
160
160
  dependencies = [
161
161
  { name = "alpyca" },
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