Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a background process in CI #15

Closed
th0mas opened this issue Aug 6, 2020 · 3 comments
Closed

Running a background process in CI #15

th0mas opened this issue Aug 6, 2020 · 3 comments
Labels
blocker Blocking future work chore a tedious but necessary task often paying technical debt T2h Time Estimate 2 Hours

Comments

@th0mas
Copy link
Collaborator

th0mas commented Aug 6, 2020

For our integration tests, we need to run a background process in our CI provider - currently Travis.

We're currently doing this through

mix phx.server&
SERVER_PID=$!

Which starts the server process and assigns an environment variable to the PID.

However, we can't view logs with this method which is tripping us up in #13.

We need to figure out a way of running a background process on a CI provider that allows us to test against our hub server.

@th0mas th0mas added blocker Blocking future work T2h Time Estimate 2 Hours chore a tedious but necessary task often paying technical debt labels Aug 6, 2020
@th0mas
Copy link
Collaborator Author

th0mas commented Aug 6, 2020

Circle CI seems to let you run multiple containers to test against: https://circleci.com/blog/setting-up-tricky-containers-in-circle-2-0-multi-image/

@nelsonic
Copy link
Member

nelsonic commented Aug 6, 2020

@th0mas yeah, just because you can use multiple Docker Containers, doesn't mean you want to. 😉
We have used Docker in the past and it can become another maintenance chore. ⏳
If we do not plan to deploy our App(s) using Docker, we should not be using it in our build phase.

As discussed on our Standup call I think we could independently deploy the Hub App to Heroku and use that in testing the firmware. Though it might incur some network latency, that may result in slower test execution. 💭
Given that Elixir executes tests in parallel, the "cost" of doing this will be the slowest test i.e. max 2 seconds.
While it might sound like more work to deploy the Hub App to Heroku and then use the deployed app for testing the firmware, it will end up being less of a headache and it will cut down on the build times in both the short and long-run
because there won't be any extra git clone or mix deps.get to run.

I can set-up a separate Heroku account to run the Hub app to ensure that we never run out of "free" dyno hours
then "ping" the app to wake it at the start of the tests so the dyno is primed.
That way we have full Application logs for the Hub and can debug anything.

This is what I've done to test https://github.com/dwyl/auth which calls out to https://dwylmail.herokuapp.com/ in CI.
Some people may consider this to be "coupling" and even an "anti-pattern". I respectfully disagree with those idealists,
this is how Apps work in the "real world", they call other microservices/APIs and if something fails we need to know.

LMK what you think/decide. I'm happy to do the Heroku work so you don't have to.
(obvs I will share the access with you so can debug it if you need to ...)

@th0mas
Copy link
Collaborator Author

th0mas commented Aug 19, 2020

Closing for now as we have technically cheated and run our testing hub server on heroku, see dwyl/smart-home-auth-server#14

@th0mas th0mas closed this as completed Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Blocking future work chore a tedious but necessary task often paying technical debt T2h Time Estimate 2 Hours
Projects
None yet
Development

No branches or pull requests

2 participants