98 points · by ssemmaprise · 9y ago · 72 comments
I have an open source Rails app <https://github.com/coreinfrastructure/best-practices-badge> that self-certifies that open source projects are following best practices. It currently uses CircleCI 1.0 and then deploys to Heroku <https://circleci.com/gh/coreinfrastructure/best-practices-ba....
If I configure it for development and test, it will contain all the test and development gems in addition to the production ones <https://github.com/coreinfrastructure/best-practices-badge/b.... I would also need to include gcc and other build tools. But I would have immutability in that my dev, test and production images would be identical.
Or, should I use one image for dev and test, and then build a different image for production, in order to have the smallest possible size? CircleCI supports building <https://circleci.com/docs/2.0/building-docker-images/> further Docker images, but then there's a chance of losing dev/prod parity if, for example, a software dependency gets updated in the meantime.
https://docs.docker.com/engine/userguide/eng-image/multistag...
However, that doesn't fix the problem of having lots of development and test gems installed in test that I don't want for production. I don't know of a way of copying just my production gems to a production image.
Or maybe have more than one path for gems and change load paths between environments?
Or keep tests in a separate image from the production image under test? Similarly, build tools could live in a different image/layer.
- base image that installs OS Updates + OS package requirements + production dependencies
- dev image inherits from base image, installs dev dependencies + source code volume mounted on '/app/src'
- test image inherits from base image, installs test dependencies + source code volume mounted on '/app/src' (image used both for local tests and CI)
- prod image inherits from base image, adds source code to '/app/src' (this image will eventually be tagged and pushed to a production registry after builds)
Only adding source code to the image in prod image for not breaking cache during development.
On one hand, having dev/test gems in the image should be innocuous, if I recall correctly bundler will not activate them when the environment is production. So other than some additional image size (is this really a problem?) it doesn't have any material effect. But I empathize with wanting to have a completely minimalist prod image, regardless of whether it has measurable benefit.
iron.io has for quite some time advocated having two parallel base images, one dev which has the build tools, and then copying the built production gems to a prod image. [1] If you do this, then the build tools (gcc and the like) are never in the docker image which is used for test or prod. But yes you still need test gems in an image that runs rspec/capybara/etc.
Maybe the real solution then is to take your prod image, and deploy it to some staging environment which then gets treated to a functional test suite. The approach would necessitate running the suite in one container, targeting the application running in another container however. (This is naturally how you would do it if you were using webdriver/selenium-based testing tools.)
You could install all the dev gems, build tools, etc in the CircleCI build container and run unit testing. Once everything looks good and you can build your file app that passes, then take the app and throw it in a new Docker image. Then, integration test that Docker image itself.
That final piece could be done on some sort of staging server of in a new build environment using CircleCI 2.0 Workflows.
My question is when switching to a Docker workflow, does it make sense to use the same image for test on CircleCI as for deployment on staging and production.
I hope this helps.
When I've needed support (mainly around installing custom versions of various apps) the staff have been very responsive.
Circle folk: for me it still displays 'Leave 2.0 beta' and 'Join 2.0 beta' - do I need to anything to get 2.0 final?
Thanks for pointing that out, let me see if we can make that less head-scratchy.
You should also see a little icon in your dashboard that says 1.0 or 2.0 to the right of each of your builds - that will tell you what version you're on :)
- go unanswered
- get answered by the community with "here is how you do it," without the "here is why" part.
- the question can't be answered by the community and all you see are messages along the lines of "same issue here."
Rarely do I see the "here is how you do it and here is why" answer I am looking for.
You can choose a base image (or machine, a VM), and then go from there. No custom Docker image.
Also, what's wrong with Discourse? It's not perfect but surely the best forum system around I think.
Aside from CircleCI Discuss, we also have actual Support and Docs.
Not great, but works.
Like isn't the point of docker to not be able to install a bunch of stuff after the image is built?
We use it a ton and you might like it too.
Rather than have every customer repeat these steps to transform their file, why don't you do it for them, and make a circle.yml to .circleci/config.yml converter?
I'm currently trying to work out what
dependencies:
pre:
Turns into for 2.0. There's instructions for dependencies:
override:
But I'm not sure if the same logic applies to pre, and the replacement shown there is indented in such a way that it looks like there's some missing information about what the parent container should be. All I can do is guess what the replacement for dependencies:
pre:
should be.For the 'dependencies: pre' step, you would replace that with a 'run' step, the same as outlined for 'dependencies: override'. We'll update the docs - thanks for pointing it out.
Edit: looking at another doc, https://circleci.com/docs/2.0/configuration-reference/#deplo..., the missing parent key is 'jobs:'
Also shouldn't "Search and Replace Deprecated 2.0 Keys" be "Search and Replace Deprecated 1.0 Keys" (or better "Search and Replace Deprecated Keys")?
https://circleci.com/docs/2.0/configuration-reference/#table...
Implies 'steps' is directly under 'jobs', whereas:
https://circleci.com/docs/2.0/configuration-reference/#full-...
shows that 'steps' is under 'jobs > build'
In CircleCI 2.0, there is no longer inferred commands. You just run the commands you want.
I use it almost everywhere.
Unfortunately here in Berlin mostly everyone switches to self-hosted version of Jenkins at one point.
(In case it's not super obvious, I work at CircleCI)
- Privacy issues - Owning critical service component
Unfortunately I've never heard the reason that I think is the right one ( at least from what I can see is happening here ), which sounds like :
"Hey, we don't need this, because at Zalando / Nokia Maps, etc. we used Jenkins, so I don't wanna spend time maintaining a new tool ( CircleCI )."
Same stuff happens with project management ( dominated by JIRA around Berlin ).
At one point a company trashed all my CD-setup ( which was with the free plan anyway ) to run Jenkins with Docker ( I don't know how well supported docker is with CircleCI, but I doubt that is so much different than Jenkins ).
EDIT: I'm freelancing in Berlin, so I usually do a hand-over when the team of devs is hired.
CircleCI 2.0 was built with first-class Docker support, so if that's something you're interested in, definitely take a look.
We're looking for something with security, control, support etc that we didn't see when we looked at 1.0.
All the security and control of an on-premises solution with all the benefits of SaaS.