Release 0.11.0 - #1294 @josegonzalez: Build images from heroku/heroku:STACK-build images and drop support for heroku-20 and heroku-22 - #1372 @dependabot: chore(deps-dev): bump test-unit from 3.6.2 to 3.6.3 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1373 @dependabot: chore(deps): bump puma from 6.4.3 to 6.5.0 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1374 @dependabot: chore(deps-dev): bump test-unit from 3.6.3 to 3.6.4 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1375 @dokku-bot: Update python to version v268 - #1376 @dokku-bot: Update python to version v269 - #1377 @dokku-bot: Update nodejs to version v274 - #1378 @dokku-bot: Update go to version v201 - #1380 @dokku-bot: Update nodejs to version v275 - #1382 @dokku-bot: Update ruby to version v286 - #1383 @dokku-bot: Update python to version v272 - #1384 @josegonzalez: chore: upgrade django app - #1385 @dependabot: chore(deps-dev): bump test-unit from 3.6.4 to 3.6.5 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1386 @dependabot: chore(deps-dev): bump test-unit from 3.6.5 to 3.6.7 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1387 @dependabot: chore(deps-dev): bump heroku/heroku-buildpack-php from 259 to 260 in /buildpacks/buildpack-php/tests/php - #1388 @dokku-bot: Update php to version v260 - #1389 @turicas: Don't try to delete dangling images if none is present - #1390 @dokku-bot: Update php to version v261 - #1391 @dependabot: chore(deps): bump jinja2 from 3.1.4 to 3.1.5 in /buildpacks/buildpack-multi/tests/multi - #1392 @dependabot: chore(deps): bump jinja2 from 3.1.4 to 3.1.5 in /buildpacks/buildpack-python/tests/python-flask - #1393 @dependabot: chore(deps-dev): bump heroku/heroku-buildpack-php from 260 to 261 in /buildpacks/buildpack-php/tests/php - #1394 @dependabot: chore(deps-dev): bump rack-test from 2.1.0 to 2.2.0 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1395 @dokku-bot: Update ruby to version v287 - #1402 @dependabot: chore(deps): bump monolog/monolog from 2.9.3 to 3.8.1 in /buildpacks/buildpack-php/tests/php - #1403 @dokku-bot: Update python to version v275 - #1404 @dokku-bot: Update php to version v262 - #1406 @dependabot: chore(deps-dev): bump heroku/heroku-buildpack-php from 261 to 262 in /buildpacks/buildpack-php/tests/php - #1407 @dokku-bot: Update go to version v202 - #1408 @dokku-bot: Update nodejs to version v278 - #1410 @dependabot: chore(deps): bump puma from 6.5.0 to 6.6.0 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1411 @dependabot: chore(deps): bump twig/twig from 3.11.2 to 3.19.0 in /buildpacks/buildpack-php/tests/php - #1412 @dependabot: chore(deps): bump rack from 3.1.8 to 3.1.9 in /buildpacks/buildpack-multi/tests/multi - #1413 @dependabot: chore(deps): bump rack from 3.1.8 to 3.1.9 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1414 @dokku-bot: Update ruby to version v291 - #1415 @dokku-bot: Update nodejs to version v279 - #1416 @dokku-bot: Update nodejs to version v280 - #1417 @dokku-bot: Update python to version v276 - #1419 @dokku-bot: Update nodejs to version v282 - #1420 @dokku-bot: Update go to version v203 - #1421 @dokku-bot: Update ruby to version v292 - #1425 @dependabot: chore(deps): bump golang from 1.23 to 1.24 - #1426 @dependabot: chore(deps): bump twig/twig from 3.19.0 to 3.20.0 in /buildpacks/buildpack-php/tests/php - #1429 @dokku-bot: Update php to version v263 - #1430 @dokku-bot: Update ruby to version v293 - #1431 @dependabot: chore(deps-dev): bump heroku/heroku-buildpack-php from 262 to 263 in /buildpacks/buildpack-php/tests/php - #1435 @dokku-bot: Update java to version v75 - #1436 @dokku-bot: Update python to version v279 - #1437 @dokku-bot: Update nodejs to version v286 - #1438 @dependabot: chore(deps): bump rack from 3.1.9 to 3.1.11 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1439 @dependabot: chore(deps): bump rack from 3.1.9 to 3.1.11 in /buildpacks/buildpack-multi/tests/multi - #1440 @dokku-bot: Update go to version v205 - #1441 @dependabot: chore(deps): bump jinja2 from 3.1.5 to 3.1.6 in /buildpacks/buildpack-multi/tests/multi - #1442 @dependabot: chore(deps): bump jinja2 from 3.1.5 to 3.1.6 in /buildpacks/buildpack-python/tests/python-flask - #1443 @dependabot: chore(deps): bump rack from 3.1.11 to 3.1.12 in /buildpacks/buildpack-multi/tests/multi - #1444 @dependabot: chore(deps): bump rack from 3.1.11 to 3.1.12 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1445 @dependabot: chore(deps-dev): bump heroku/heroku-buildpack-php from 263 to 264 in /buildpacks/buildpack-php/tests/php - #1446 @dokku-bot: Update php to version v264 - #1447 @dokku-bot: Update nodejs to version v287 - #1449 @dokku-bot: Update ruby to version v295 - #1450 @dokku-bot: Update ruby to version v296 - #1451 @dependabot: chore(deps): bump monolog/monolog from 3.8.1 to 3.9.0 in /buildpacks/buildpack-php/tests/php - #1452 @dokku-bot: Update ruby to version v297 - #1453 @dokku-bot: Update nodejs to version v288 - #1454 @dependabot: chore(deps): bump express from 4.21.2 to 5.1.0 in /buildpacks/buildpack-nodejs/tests/nodejs-express - #1455 @dependabot: chore(deps): bump express from 4.21.2 to 5.1.0 in /buildpacks/buildpack-multi/tests/multi - #1456 @dokku-bot: Update go to version v206 - #1457 @dokku-bot: Update ruby to version v298 - #1458 @dokku-bot: Update nodejs to version v289 - #1459 @dependabot: chore(deps-dev): bump test-unit from 3.6.7 to 3.6.8 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1460 @dokku-bot: Update ruby to version v299 - #1462 @dokku-bot: Update python to version v281 - #1463 @dokku-bot: Update php to version v265 - #1464 @dependabot: chore(deps): bump rack from 3.1.12 to 3.1.13 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1465 @dependabot: chore(deps-dev): bump heroku/heroku-buildpack-php from 264 to 265 in /buildpacks/buildpack-php/tests/php - #1466 @dependabot: chore(deps): bump rack from 3.1.12 to 3.1.13 in /buildpacks/buildpack-multi/tests/multi - #1467 @dokku-bot: Update ruby to version v300 - #1468 @josegonzalez: chore: bump nodejs from 8.11.2 to 22.14.x - #1469 @josegonzalez: chore: drop support for heroku-20 - #1470 @dokku-bot: Update ruby to version v301 - #1471 @dokku-bot: Update ruby to version v302 - #1472 @dokku-bot: Update ruby to version v303 - #1473 @dokku-bot: Update nodejs to version v290 - #1474 @dokku-bot: Update ruby to version v305 - #1476 @dependabot: chore(deps): bump twig/twig from 3.20.0 to 3.21.1 in /buildpacks/buildpack-php/tests/php - #1484 @dependabot: chore(deps): bump rack-session from 2.0.0 to 2.1.1 in /buildpacks/buildpack-multi/tests/multi - #1485 @dependabot: chore(deps): bump rack-session from 2.0.0 to 2.1.1 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1487 @dependabot: chore(deps): bump flask from 3.1.0 to 3.1.1 in /buildpacks/buildpack-multi/tests/multi - #1488 @dependabot: chore(deps): bump flask from 3.1.0 to 3.1.1 in /buildpacks/buildpack-python/tests/python-flask - #1492 @dokku-bot: Update go to version v207 - #1493 @dependabot: chore(deps-dev): bump heroku/heroku-buildpack-php from 265 to 267 in /buildpacks/buildpack-php/tests/php - #1495 @dokku-bot: Update php to version v267 - #1496 @dokku-bot: Update nodejs to version v294 - #1498 @dependabot: chore(deps): bump rack from 3.1.13 to 3.1.15 in /buildpacks/buildpack-multi/tests/multi - #1499 @dependabot: chore(deps): bump rack from 3.1.13 to 3.1.15 in /buildpacks/buildpack-ruby/tests/ruby-sinatra - #1500 @dokku-bot: Update ruby to version v309 - #1501 @dokku-bot: Update python to version v287
    1 день назад История
    README.md

    herokuish

    Build Status IRC Channel Docker Hub

    A command line tool for emulating Heroku build and runtime tasks in containers.

    Herokuish is made for platform authors. The project consolidates and decouples Heroku compatibility logic (running buildpacks, parsing Procfile) and supporting workflow (importing/exporting slugs) from specific platform images like those in Dokku/Buildstep, Deis, Flynn, etc.

    The goal is to be the definitive, well maintained and heavily tested Heroku emulation utility shared by all. It is based on the Heroku:24 system image. Together they form a toolkit for achieving Heroku compatibility.

    Herokuish is a community project and is in no way affiliated with Heroku.

    Getting herokuish

    Download and uncompress the latest binary tarball from releases.

    For example, you can do this directly in your Dockerfiles installing into /bin as one step:

    RUN curl --location --silent https://github.com/gliderlabs/herokuish/releases/download/v0.11.0/herokuish_0.11.0_linux_x86_64.tgz \
        | tar -xzC /bin
    

    Herokuish depends on Bash (4.0 or newer) and a handful of standard GNU utilties you probably have. It likely won’t work on Busybox, though neither will any Heroku buildpacks.

    Using herokuish

    Herokuish is meant to work behind the scenes inside a container. It tries not to force decisions about how you construct and operate containers. In fact, there’s nothing that even ties it specifically to Docker. It focuses on neatly emulating Heroku, letting you design and orchestrate containers around it.

    $ herokuish
    
    Available commands:
      buildpack                Use and install buildpacks
        build                    Build an application using installed buildpacks
        install                  Install buildpack from Git URL and optional committish
        list                     List installed buildpacks
        test                     Build and run tests for an application using installed buildpacks
      help                     Shows help information for a command
      paths                    Shows path settings
      procfile                 Use Procfiles and run app commands
        exec                     Run as unprivileged user with Heroku-like env
        parse                    Get command string for a process type from Procfile
        start                    Run process type command from Procfile through exec
      slug                     Manage application slugs
        export                   Export generated slug tarball to URL (PUT) or STDOUT
        generate                 Generate a gzipped slug tarball from the current app
        import                   Import a gzipped slug tarball from URL or STDIN
      test                     Test running an app through Herokuish
      version                  Show version and supported version info
    
    

    Main functionality revolves around buildpack commands, procfile/exec commands, and slug commands. They are made to work together, but can be used independently or not at all.

    For example, build processes that produce Docker images without producing intermediary slugs can ignore slug commands. Similarly, non-buildpack runtime images such as google/python-runtime might find procfile commands useful just to support Procfiles.

    herokuish exec will by default drop root privileges through use of setuidgid, but if already running as a non-root user setuidgid will fail, you can opt-out from this by setting the env-var HEROKUISH_SETUIDGUID=false.

    Buildpacks

    Herokuish does not come with any buildpacks, but it is tested against recent versions of Heroku supported buildpacks. You can see this information with herokuish version. Example output:

    $ herokuish version
    herokuish: 0.3.0
    buildpacks:
      heroku-buildpack-multi     cddec34
      heroku-buildpack-nodejs    v60
      heroku-buildpack-php       v43
      heroku-buildpack-python    v52
      heroku-buildpack-ruby      v127
      ...
    

    You can install all supported buildpacks with herokuish buildpack install, or you can manually install buildpacks individually with herokuish buildpack install <url> [committish]. You can also mount a directory containing your platform’s supported buildpacks (see Paths, next section), or you could bake your supported buildpacks into an image. These are the types of decisions that are up to you.

    Paths

    Use herokuish paths to see relevant system paths it uses. You can use these to import or mount data for use inside a container. They can also be overridden by setting the appropriate environment variable.

    $ herokuish paths
    APP_PATH=/app                    # Application path during runtime
    ENV_PATH=/tmp/env                # Path to files for defining base environment
    BUILD_PATH=/tmp/build            # Working directory during builds
    CACHE_PATH=/tmp/cache            # Buildpack cache location
    IMPORT_PATH=/tmp/app             # Mounted path to copy to app path
    BUILDPACK_PATH=/tmp/buildpacks   # Path to installed buildpacks
    
    

    Entrypoints

    Some subcommands are made to be used as default commands or entrypoint commands for containers. Specifically, herokuish detects if it was called as /start, /exec, or /build which will shortcut it to running those subcommands directly. This means you can either install the binary in those locations or create symlinks from those locations, allowing you to use them as your container entrypoint.

    Help

    Don’t be afraid of the help command. It actually tells you exactly what a command does:

    $ herokuish help slug export
    slug-export <url>
      Export generated slug tarball to URL (PUT) or STDOUT
    
    slug-export ()
    {
        declare desc="Export generated slug tarball to URL (PUT) or STDOUT";
        declare url="$1";
        if [[ ! -f "$slug_path" ]]; then
            return 1;
        fi;
        if [[ -n "$url" ]]; then
            curl -0 -s -o /dev/null --retry 2 -X PUT -T "$slug_path" "$url";
        else
            cat "$slug_path";
        fi
    }
    
    

    Using Herokuish to test Heroku/Dokku apps

    Having trouble pushing an app to Dokku or Heroku? Use Herokuish with a local Docker instance to debug. This is especially helpful with Dokku to help determine if it’s a buildpack issue or an issue with Dokku. Buildpack issues should be filed against Herokuish.

    Running an app against Herokuish

    docker run --rm -v /abs/app/path:/tmp/app gliderlabs/herokuish /bin/herokuish test
    

    Mounting your local app source directory to /tmp/app and running /bin/herokuish test will run your app through the buildpack compile process. Then it starts your web process and attempts to connect to the web root path. If it runs into a problem, it should exit non-zero.

    ::: BUILDING APP :::
    -----> Ruby app detected
    -----> Compiling Ruby/Rack
    -----> Using Ruby version: ruby-1.9.3
      ...
    
    

    You can use this output when you submit issues.

    Running an app tests using Heroku buildpacks

    docker run --rm -v /abs/app/path:/tmp/app gliderlabs/herokuish /bin/herokuish buildpack test
    

    Mounting your local app source directory to /tmp/app and running /bin/herokuish buildpack test will run your app through the buildpack test-compile process. Then it will run test command to execute application tests.

    -----> Ruby app detected
    -----> Setting up Test for Ruby/Rack
    -----> Using Ruby version: ruby-2.3.3
      ...
    -----> Detecting rake tasks
    -----> Running test: bundle exec rspec
           .
           Finished in 0.00239 seconds (files took 0.07525 seconds to load)
           1 example, 0 failures
    

    If you are on macOS, you’ll want to explicitly set the platform:

    docker run --platform linux/amd64 --rm -v /abs/app/path:/tmp/app gliderlabs/herokuish /bin/herokuish buildpack test
    

    However, there is a risk of compatibility issues when running on a different platform than the one you are developing on. If you are getting strange compilation or segfaults, try running the build process on an x86 platform.

    Troubleshooting

    If you run into an issue and looking for more insight into what herokuish is doing, you can set the $TRACE environment variable.

    $ docker run --rm -e TRACE=true -v /abs/app/path:/tmp/app gliderlabs/herokuish /bin/herokuish test
    + [[ -d /tmp/app ]]
    + rm -rf /app
    + cp -r /tmp/app /app
    + cmd-export paths
    + declare 'desc=Exports a function as a command'
    + declare fn=paths as=paths
    + local ns=
    ++ cmd-list-ns
    ++ sort
    ++ grep -v :
    ++ for k in '"${!CMDS[@]}"'
    ++ echo :help
    ...
    ++ unprivileged /tmp/buildpacks/custom/bin/detect /tmp/build
    ++ setuidgid u33467 /tmp/buildpacks/custom/bin/detect /tmp/build
    ++ true
    + selected_name=
    + [[ -n /tmp/buildpacks/custom ]]
    + [[ -n '' ]]
    + title 'Unable to select a buildpack'
    ----->' Unable to select a buildpack
    + exit 1
    

    You can also set a custom buildpack:

    docker run -e BUILDPACK_URL="https://github.com/custom/buildpack.git#with-a-branch" -e STACK=heroku-24 -e TRACE=true --rm -v ./:/tmp/app -it gliderlabs/herokuish /bin/herokuish test
    

    Note that the underlying buildpacks will not trace their commands with TRACE=true is enabled. They need to independently set set -x in order to trace execution.

    Contributing

    Pull requests are welcome! Herokuish is written in Bash and Go. Please conform to the Bash styleguide used for this project when writing Bash.

    Developers should have Go installed with cross-compile support for Darwin and Linux. Tests will require Docker to be available. If you have OS X, we recommend boot2docker.

    For help and discussion beyond Github Issues, join us on Freenode in #gliderlabs.

    Releases

    Anybody can propose a release. First bump the version in Makefile and Dockerfile, make sure CHANGELOG.md is up to date, and make sure tests are passing. Then open a Pull Request from master into the release branch. Once a maintainer approves and merges, Github Actions will build a release and upload it to Github.

    Acknowledgements

    This project was sponsored and made possible by the Deis Project.

    That said, herokuish was designed based on the experience developing and re-developing Heroku compatibility in Dokku, Deis, and Flynn. Herokuish is based on code from all three projects, as such, thank you to all the contributors of those projects.

    In fact, since I hope this is the final implementation of Heroku emulation I’m involved with, I’d like to finally thank Matt Freeman (@nonuby). I’ve been more or less copy-and-pasting code he originally wrote for the now defunct OpenRuko since 2012.

    Lastly, thank you Heroku for pioneering such a great platform and inspiring all of us to try and take it further.

    License

    BSD

    Описание

    Utility for emulating Heroku build and runtime tasks in containers

    Конвейеры
    0 успешных
    0 с ошибкой