Coder Social home page Coder Social logo

heroku-buildpack-rust's Introduction

Deprecated, please don't use this. It's far, far too old.

heroku-buildpack-rust

Build Status

Features:

  • Cached multirust, Rust toolchain.
  • Caching of previous build artifacts to (potentially dramatically) speed up similar builds.
  • Configurable version selection inside of the Cargo.toml, or by specifying the $RUST_VERSION environment variable.

Configuration

You can use any override you would pass multirust for this buildpack.

We currently (ab)use the cargo's "target" feature to set the version desired. Unfortunately because of this there are sometimes (harmless) cargo warnings about an unused value in the toml file.

Example:

[package]
name = "foo"
version = "0.1.0"
authors = ["Andrew Hobden <[email protected]>"]

[dependencies]
iron = "*"

[target.heroku]
version = "nightly"

Instructions

APP="rust-buildpack-test" && \
cargo new --bin $APP      && \
cd $APP                   && \
git init                  && \
heroku create $APP --buildpack https://github.com/Hoverbear/heroku-buildpack-rust && \
echo "web: target/release/$APP" > Procfile

Example App

After following the instructions above, in Cargo.toml add:

[dependencies]
iron = "*"

In src/main.rs let's use a simple iron demo:

extern crate iron;

use iron::prelude::*;
use iron::status;
use std::env;

fn main() {
    fn hello_world(_: &mut Request) -> IronResult<Response> {
        Ok(Response::with((status::Ok, "Hello World!")))
    }

    let url = format!("0.0.0.0:{}", env::var("PORT").unwrap());

    println!("Binding on {:?}", url);
    Iron::new(hello_world).http(&url[..]).unwrap();
    println!("Bound on {:?}", url);
}

Now the following steps:

git add src/main.rs Cargo.toml Procfile && \
git commit -m "Init"                    && \
git push heroku master

Heroku should then build your application. Finally, you may need to start your application's web dyno with:

heroku ps:scale web=1

Now you can visit https://$APP.herokuapp.com/ and see your application!

Testing

If you have Docker, you can test this buildpack by doing the following:

make

The Makefile defines how to pull down the testrunner and build the appropriate docker container, then test the buildpack.

heroku-buildpack-rust's People

Contributors

homu avatar hoverbear avatar hugo avatar pascalw avatar roxasshadow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

heroku-buildpack-rust's Issues

Thank you

Thank you for this amazing buildpack! Just deployed a hello world server successfully just following the readme instructions (!!!)! Previously, I tried the emk's buildpack, but I couldn't get it to work. That's not to say that it is bad, it's just to say that I'm not too bright and this buildpack rocks!

Use ENV over Cargo.toml?

Should an ENV flag be used over the Cargo.toml to configure which version to use from multirust?

I'd argue that using Cargo.toml makes it more reproducible and declarative.

Compiled slug size is too large

I'm not sure if this is a good place for this issue but I'm quite stuck on it.

Basically in the last days I'm having a problem deploying a project on heroku because the slug size is too big (Compiled slug size: 307.2M is too large (max is 300M). โ€“ appears just after the compilation of all the deps).

I created a .slugignore containing /target/release/deps (I also tried with target/release/deps) but nothing changed. I also noticed that folder to be large 400-500M, thing that sounds quite weird to me but probably that's the size after being compressed.

The project itself (without .git and target) is just 180K, anyway.

Update: for now I solved by purging the git cache as suggested here, but I feel like this is not the ideal way to solve this problem, like the .slugignore would most likely be.

Cannot find std libraries?

When I try to run the application I get this error:
2016-06-09T12:49:20.847819+00:00 app[web.1]: ./target/release/test: error while loading shared libraries: libstd-8102e29f.so: cannot open shared object file: No such file or directoryย 
I have no idea what could be wrong.

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.