Commit 2388142
JCU/fix(deploy): run DB migration in one-shot container (fix exit 137) (#1345)
* JCU/fix(deploy): run DB migration in one-shot container (fix exit 137)
Replaces the debug instrumentation added in #1344 with the actual fix.
Problem
-------
On import (ERASE_DB + IMPORT of a DSpace-6 dump) the "run database
migration" step failed with exit code 137 (SIGKILL). It was NOT a
memory/OOM issue (MemLimit=0, no dmesg OOM, no OutOfMemoryError, JVM
peaked ~1GB with 7GB+ free) and NOT a broken migration (Flyway applied
migrations cleanly up to 9.0.x when run in isolation).
Root cause
----------
The dspace container entrypoint auto-runs `dspace database migrate`
(WITHOUT `ignored`) and then starts the REST webapp. On a freshly
imported DSpace-6 dump the "Ignored" XMLWorkflow migrations
(5.0.2014.11.04, 6.0.2015.09.01) are not applied, so the webapp boots
against an un-migrated DB, crashes, and the restart policy restarts the
container. That restart SIGKILLs the `docker exec ... migrate ignored`
running inside it -> exit 137. (It only "worked" manually because the DB
was already near-current, so migrate finished in <1s before any restart.)
Fix
---
Run the migration in a separate one-shot container instead of exec-ing
into the live app container:
1. docker stop the app -> nothing can crash/restart under us
2. docker run --rm a throwaway container (PID 1 = migrate, no webapp,
no restart policy) reusing the app container's image / network /
volumes / env (via docker inspect) so it hits the same DB
3. docker start the app -> its entrypoint migrate is now a no-op
Verified on dev-6/8593: one-shot migration completed, `dspace database
info` shows schema fully up to date (all Success through 9.0.2025.03.12).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* JCU/refactor(deploy): run one-off migration via docker compose, not docker run
Rewrites the migration step to use `docker compose run` (consistent with
the deploy step's tooling) instead of `docker run` + `docker inspect`.
- add `actions/checkout` to import-3 so the docker/ compose files are
available (the job previously had no checkout).
- run the migration as a one-off compose container of the `dspace`
service with an overridden entrypoint (migrate only, no webapp), using
the same compose files/env-file as the deploy step.
Same behaviour as before (app stopped first, no restart loop to SIGKILL
the migration), just compose-native.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 00497a0 commit 2388142
1 file changed
Lines changed: 23 additions & 50 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 127 | + | |
| 128 | + | |
145 | 129 | | |
146 | 130 | | |
147 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
148 | 140 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | 141 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
| 142 | + | |
| 143 | + | |
162 | 144 | | |
163 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
164 | 151 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
| 152 | + | |
| 153 | + | |
181 | 154 | | |
182 | 155 | | |
183 | 156 | | |
| |||
0 commit comments