Repository navigation
Conversation
… starting docker.
ohaiwalt
left a comment
There was a problem hiding this comment.
So I believe this would result in lib/docker-entrypoint.sh bundle exec puma -C config/puma.rb being the command run in the container, from here.
That doesn't seem to be desirable. A possible solution for this would be to include the bundle exec puma command into the entrypoint script, and removing the command line.
|
Well, you certainly could do it that way. The ticket said "Run migrations on container start". This project has several ways to build and run the docker container. So it isn't clear how you are doing it in production. This solution assumes you are using |
|
@PSkaggs Perhaps I'm missing something here? I've made a new clone of the backend repository, and pulled your changes in, and this is the result of the The database doesn't exist on initial startup. Even after the database exists, based on the combination of Can you expand a bit on your thought process here? It's worth mentioning that database migrations and |
…CMD' from the Dockerfile and changed the syntax of the 'command' in docker-compose.yml
|
@ohaiwalt It does work if the database is present. I used I guess still don't have much clarity on what happens with the production environment. The README instructs users to use the Makefile to run the backend. Or if running the entire project use I've removed the |
|
@PSkaggs Leaving the Production is running in Kubernetes using manifests in the https://github.com/OperationCode/operationcode_infra repository, which are slightly in flux as we do some moving around of cluster-up tools, and then change the manifests over to Helm charts, or similar. I appreciate you taking the time to address this. Once we can get a set of passing tests, it LGTM. |
Ah, that makes more sense.
No problem. If this one doesn't do it, I'll tinker with a fresh install. |
|
Am I wrong or is the TravisCI error due to a configuration issue? |
…s already built into 'make test'. Also, removed the explicit RAILS_ENV setting from the .env file becuase order of ENV variables in Docker is shell->env_file->Dockerfile. Hence setting the RAILS_ENV in the shell was getting overridden by the .env.
|
Down the rabbit hole we go... I managed to get a successful build by removing the postgres timeout in the travis.yml. There is already a timeout in the However, there was still an issue that I think might be a problem and maybe my successful build was a fluke of timing. Compared to the last passing build on master: So the .env file was setting the RAILS_ENV to develop and I found in the docker documentation that the order of precedence is shell->env_file->Dockerfile. So I commented out the RAILS_ENV setting in the .env file. I managed to get passing builds on a tester branch that I ran this on. However, it seems to be failing here. Not exactly sure what is different at this point. |
…t database. Added some explicit environment settings in the Makfile test to ensure the test database is used
|
@ohaiwalt Well, this one took a little digging but I think I finally figured it out. It turns out Rails 5.0 had a little bug that defaulted to the 'development' database when running tests unless you explicitly set it before hand. Which you can see I've done in the Makefile test. The bug is reported here and fixed here. I believe they backported the fix to Rails 5.0.6. So if and when Rails is upgraded you can remove those explicit environment settings in the Makefile test. Also, I added a test to check the database is correct. |
|
@ohaiwalt - How are we feeling about this PR? |
ohaiwalt
left a comment
There was a problem hiding this comment.
Took me a bit to get back around to this, but I gave it a run through and everything looks good!
… starting docker.
Description of changes
Adds an entrypoint script for docker-compose to run database migrations when starting the container.
Issue Resolved
Fixes Issue Number: 61