Giter Club home page Giter Club logo

Comments (5)

edmorley avatar edmorley commented on May 18, 2024

Hi!

I agree it would be helpful if there was a better story for this. Longer term Cloud Native Buildpacks are going to be the solution for this, since with them, one can run virtually an identical build locally as is run in production.

In the meantime I'd check out the Dockerflles in #56 - particularly the more recent comments - there's an example of using the Ruby buildpack to install Ruby.

Alternatively a pretty string option is to just use the official Docker Ruby images (much lighter-weight than the Heroku stack images for local development) and instead rely on Heroku CI/Review Apps/staging app to ensure correctness before production deployment. After all, there are many many differences running locally compared to production (the docker image is likely the least of it; differences in DB configuration/version, RAILS_ENV, ...) so there still needs to be validation performed on Heroku and not just locally.

When attempting to update Ruby from a heroku buildpack, what USED to work (in heroku:18-build) is:

Yeah I wouldn't do that. Use the whole Ruby buildpack and not just the Ruby binary archive. The archive is not meant to be extracted over the system packages. The Ruby buildpack installs the files into the app directory and adds them to PATH, GEM_PATH etc.

from base-images.

edmorley avatar edmorley commented on May 18, 2024

In the meantime I've pinned #56 to improve visibility.

from base-images.

jpwynn avatar jpwynn commented on May 18, 2024

Thank you Ed. Can you offer a specific suggestion re "official Docker Ruby images" for Rails apps that will end up on Heroku? In https://hub.docker.com/_/ruby for example there are a lot of options: 2.7.3-buster, 2.7.3-slim-buster, 2.7.3-alpine3.13, 2.7.3-alpine3.12 which is Alpine and Debian, but Heroku uses Ubuntu, yes? and none of the options in that docker hub seem to be Ubuntu.

And of course then there is the issue of all the many apt-get packages to include. Any suggestions for figuring that out?

I suspect I'm not the only Heroku user who uses Heroku precisely so I can focus on my app instead of hundreds of pieces of underlying stack-related minutiae (well, plus the excellent devops of course). So it's unfortunate to discover that no, the Heroku stack images are not a way to quickly configure Docker so we can get back to app development.

It seems like "Sample Dockerfile for a Rails 6 app destined for Heroku-20" would be something Heroku could/should/would publish.

from base-images.

edmorley avatar edmorley commented on May 18, 2024

Many of our internal Ruby projects don't use docker for local development and instead run on the local machine. We then use Heroku CI/Review Apps/staging apps to catch any dev-prod parity issues. If you would prefer to use Docker locally, then I don't think it matters too much which base image you use. In terms of apt packages, just install the absolute minimum so that gems install (eg libpq if using the pg gem).

A local testing environment is never going to fully match a remote production environment, and of the things that differ, the fact that the Docker image OS is Debian vs Ubuntu is much less frequently going to be the cause compared to other factors (eg different env vars, different DB configuration/version/not full prod data, framework debug mode, different load balancer, not real production user load etc). And for the cases where it does matter - there's still Review Apps, staging apps etc.

There are obviously tradeoffs of all approaches, however I think usability locally can often be more important than trying to have still only partial prod-parity.

from base-images.

jpwynn avatar jpwynn commented on May 18, 2024

You are more experienced and probably correct re the tradeoffs of local stack simplicity vs dev/prod parity. However (and maybe because I'm an old guy) I've always leaned pretty hard towards "try to catch at least some of the 'big' gotchas as early as possible right on the dev machine."

That said, review apps and staging apps have been awesomely helpful (we use both). And even wrote up a small blog post favorably comparing the speed of Heroku CI vs rspec locally: https://blog.pardner.com/2019/01/making-heroku-ci-almost-as-fast-as-running-rspec-locally/

from base-images.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.