Clean up container tooling to split API & collector #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all this PR is not strictly necessary. The reasoning behind it is to split the API & collector processes into separate docker images which will allow us to scale them individually in a manner that will not break the old docker setup which means we maintain the legacy image to act as a baseline for the two new images.
In addition the new docker-compose tooling & scripts that have been added will allow us to launch the "fcd application stack" using docker-compose and a few commands like so:
./scripts/docker_compose_build.sh
docker-compose up database -d
sleep 60
docker-compose up indexer-api indexer-collector
Note: The sleep command is to wait for postgres to boot up as containers have no way of knowing if the internal process is ready to receive connects, all it knows is that it has started with an exit code at which point it doesnt care much about anything else. We could replace this by using wait-for-it @ https://github.com/vishnubob/wait-for-it allowing us to just do "docker-compose up" in one-line, with no sleep, but this will require some funky exec logic in the docker-compose tooling that I would rather avoid, because we cant use wait for it inside the image as this will end up blowing up k8s health probes.
Overall this approach lets you spin up the three containers processes (postgres, api, collector) that make up the physical
architecture of the FCD easily, without to much internal understanding of how it all works, while allowing us to map it into the terra-operator concept (terrad, oracle-feeder, fcd k8s operator), hence the change in env variable and dockerfile naming schemes.
Feel free to break my heart @faddat <3