My question relates to the first factor of 12 factor apps manifesto: the codebase. (see http://12factor.net/codebase).
TL;DR:
this factor states there's a one to one relationship between codebases and deploys, so in this case, you're not supposed to use the same codebase (repository) for both applications
My requirement: I have an website Spring application and a batch Spring application both sharing a common code i.e. the domain model (JPA entity classes). I need to be able to share this common code. And both applications need to use the same version of the common code at any one time.
My current setup: I have currently three "top-level" repositories on github:
- Domain model (JPA entity classes) repo
- Website application repo
- Domain model directory/gradle project (included with
git subtree pull/push
)
- Domain model directory/gradle project (included with
- Batch application repo
- Domain model directory/gradle project (included with
git subtree pull/push
)
- Domain model directory/gradle project (included with
Please also note that the Domain model repo lives separately (as noted above) but is also nested within both the website and the batch application repos. I use a git subtree pull/push
in order to include this Domain model repo as a directory and a gradle project within the other two repos. The reason for this is that Heroku builds the code itself from the repos.
All this is very tedious and error-prone.
Can someone please advise a better solution?