{"id":13437778,"url":"https://github.com/emk/heroku-buildpack-rust","last_synced_at":"2025-04-04T09:08:59.539Z","repository":{"id":17524763,"uuid":"20312826","full_name":"emk/heroku-buildpack-rust","owner":"emk","description":"A buildpack for Rust applications on Heroku, with full support for Rustup, cargo and build caching.","archived":false,"fork":false,"pushed_at":"2023-06-28T14:46:51.000Z","size":63,"stargazers_count":526,"open_issues_count":19,"forks_count":189,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-28T08:07:27.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-30T00:49:30.000Z","updated_at":"2025-03-23T22:05:07.000Z","dependencies_parsed_at":"2024-10-30T09:16:16.829Z","dependency_job_id":null,"html_url":"https://github.com/emk/heroku-buildpack-rust","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emk%2Fheroku-buildpack-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emk%2Fheroku-buildpack-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emk%2Fheroku-buildpack-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emk%2Fheroku-buildpack-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emk","download_url":"https://codeload.github.com/emk/heroku-buildpack-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149501,"owners_count":20891954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:00.179Z","updated_at":"2025-04-04T09:08:59.523Z","avatar_url":"https://github.com/emk.png","language":"Shell","funding_links":[],"categories":["Development tools","Shell","开发工具 Development tools","开发工具"],"sub_categories":["Deployment","部署 Deployment","部署"],"readme":"# Heroku buildpack for Rust\n\n[![Build Status](https://travis-ci.org/emk/heroku-buildpack-rust.svg?branch=master)](https://travis-ci.org/emk/heroku-buildpack-rust)\n\nThis is a Heroku buildpack for Rust with support for [cargo][] and [rustup][].  Features include:\n\n- Caching of builds between deployments.\n- Automatic updates to the latest stable Rust by default.\n- Optional pinning of Rust to a specific version.\n- Support for `export` so that other buildpacks can access the Rust toolchain.\n- Support for compiling Rust-based extensions for projects written in other languages.\n\n[fode]: https://github.com/ericfode/heroku-buildpack-rust\n[cargo]: http://crates.io/\n[rustup]: https://www.rustup.rs/\n\n## Example projects\n\nHere are several example projects:\n\n- [rust-buildpack-example-actix][] uses the popular [Actix][] framework, and runs on stable Rust.\n- [rust-buildpack-example-rocket][] uses the innovative [Rocket][] framework, which currently requires nightly Rust.\n\n[rust-buildpack-example-actix]: https://github.com/emk/rust-buildpack-example-actix\n[Actix]: https://actix.rs/\n[rust-buildpack-example-rocket]: https://github.com/emk/rust-buildpack-example-rocket\n[Rocket]: https://rocket.rs/\n\n## Using this buildpack\n\nTo deploy an application to Heroku, we recommend installing the [Heroku CLI][].\n\nIf you're creating a new Heroku application, `cd` to the directory containing your code, and run:\n\n```sh\nheroku create --buildpack emk/rust\n```\n\nThis will only work if your application has a `Cargo.toml` and uses `git`. If you want to set a particular name for application, see `heroku create --help` first.\n\nTo use this as the buildpack for an existing application, run:\n\n```sh\nheroku buildpacks:set emk/rust\n```\n\nYou will also need to create a `Procfile` pointing to the release version of your application, and commit it to `git`:\n\n```Procfile\nweb: ./target/release/hello\n```\n\n...where `hello` is the name of your binary.\n\nTo deploy your application, run:\n\n```sh\ngit push heroku master\n```\n\n### Running Diesel migrations during the release phase\n\nThis will install the diesel CLI at build time and make it available in your dyno. Migrations will run whenever a new version of your app is released. Add the following line to your `RustConfig`\n\n```sh\nRUST_INSTALL_DIESEL=1\n```\n\nand this one to your `Procfile`\n\n```Procfile\nrelease: ./target/release/diesel migration run\n```\n\n[Heroku CLI]: https://devcenter.heroku.com/articles/heroku-command-line\n\n## Specifying which version of Rust to use\n\nBy default, your application will be built using the latest stable Rust. Normally, this is pretty safe: New stable Rust releases have excellent backwards compatibility.\n\nBut you may wish to use `nightly` Rust or to lock your Rust version to a known-good configuration for more reproducible builds. To specify a specific version of the toolchain, use a [`rust-toolchain`](https://github.com/rust-lang-nursery/rustup.rs#the-toolchain-file) file in the format rustup uses.\n\nNote: if you previously specified a `VERSION` variable in `RustConfig`, that will continue to work, and will override a `rust-toolchain` file.\n\n## Combining with other buildpacks\n\nIf you have a project which combines both Rust and another programming language, you can insert this buildpack before your existing one as follows:\n\n```sh\nheroku buildpacks:add --index 1 emk/rust\n```\n\nIf you have a valid `Cargo.toml` in your project, this is all you need to do. The Rust buildpack will run first, and your existing buildpack will run second.\n\nBut if you only need Rust to build a particular Ruby gem, and you have no top-level `Cargo.toml` file, you'll need to let the buildpack know to skip the build stage.  You can do this by adding the following line to `RustConfig`:\n\n```sh\nRUST_SKIP_BUILD=1\n```\n\n## Customizing build flags\n\nIf you want to change the cargo build command, you can set the `RUST_CARGO_BUILD_FLAGS` variable inside the `RustConfig` file.\n\n```sh\nRUST_CARGO_BUILD_FLAGS=\"--release -p some_package --bin some_exe --bin some_bin_2\"\n```\n\nThe default value of `RUST_CARGO_BUILD_FLAGS` is `--release`.\nIf the variable is not set in `RustConfig`, the default value will be used to build the project.\n\n## Using the edge version of the buildpack\n\nThe `emk/rust` buildpack from the [Heroku Registry](https://devcenter.heroku.com/articles/buildpack-registry) contains the latest stable version of the buildpack. If you'd like to use the latest buildpack code from this Github repository, you can set your buildpack to the Github URL:\n\n```sh\nheroku buildpacks:set https://github.com/emk/heroku-buildpack-rust\n```\n\n## Development notes\n\nIf you need to tweak this buildpack, the following information may help.\n\n### Testing with Docker\n\nTo test changes to the buildpack using the included `docker-compose-test.yml`, run:\n\n```sh\n./test_buildpack\n```\n\nThen make sure there are no Rust-related *.so files getting linked:\n\n```sh\nldd heroku-rust-cargo-hello/target/release/hello\n```\n\nThis uses the Docker image `heroku/cedar`, which allows us to test in an official Cedar-like environment.\n\nWe also run this test automatically on Travis CI.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femk%2Fheroku-buildpack-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femk%2Fheroku-buildpack-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femk%2Fheroku-buildpack-rust/lists"}