crystal-lang / heroku-buildpack-crystal Goto Github PK
View Code? Open in Web Editor NEWHeroku buildpack for Crystal
License: MIT License
Heroku buildpack for Crystal
License: MIT License
My name is Jon Byrum and I’m a product manager at Heroku. Your buildpack is one of the top 200 most popular buildpacks on Heroku!
I would like to invite you to publish your buildpack early in our Buildpack Registry, before it is made available to the general public (expected early July).
To register your buildpack, visit: https://addons-next.heroku.com/buildpacks
Documentation: https://devcenter.heroku.com/articles/buildpack-registry
Why register?
heroku buildpacks:search
. In the future, we will only display registered buildpacks on elements.heroku.com/buildpacksRecommended naming conventions:
It would be greatly appreciated if you could publish before June 18th, as we prepare to make the feature publicly available. Registering a buildpack should take approximately 5 minutes.
If you have any questions about registering (or run into any issues), please email:
[email protected]
It looks like this is installing Crystal 0.5.3 [eac061b](Thu Nov 6 21:29:19 UTC 2014)
$ git push heroku
Counting objects: 51, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (47/47), done.
Writing objects: 100% (51/51), 7.26 KiB | 0 bytes/s, done.
Total 51 (delta 23), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching set buildpack https://github.com/crystal-lang/heroku-buildpack-crystal.git... done
remote: -----> Crystal app detected
remote: -----> Installing Crystal (0.18.4 due to .crystal-version file)
remote: -----> Installing Dependencies
remote: Updating https://github.com/sdogruyol/kemal.git
remote: Updating https://github.com/luislavena/radix.git
remote: Updating https://github.com/jeromegn/kilt.git
remote: Updating https://github.com/sdogruyol/spec-kemal.git
remote: Updating https://github.com/mperham/sidekiq.cr.git
remote: Updating https://github.com/mperham/crystal-redis.git
remote: Updating https://github.com/ysbaddaden/pool.git
remote: Updating https://github.com/miketheman/statsd.cr.git
remote: Updating https://github.com/beanieboi/aws-signer.cr.git
remote: Installing kemal (0c46bd65da9092c4e2d1776c13730eb63fbb6bc9)
remote: Installing radix (0.3.0)
remote: Installing kilt (0.3.3)
remote: Installing spec-kemal (8c0d4268b9ae2b8e7aadfe290006c28060bb61c8)
remote: Installing sidekiq (9248c0f0469d1ead010080a3acf2d6fa4e22c7d5)
remote: Installing redis (744bac8ec708e996ab020b79cbebdb17e28f6e23)
remote: Installing pool (0.2.3)
remote: Installing statsd (917c948e182b26150e124fa84a30ec4518635bf0)
remote: Installing aws_signer (bae4215fb96a074f1cc0e5cb07f116d0f93744ab)
remote: -----> Compiling src/lighthouse.cr (auto-detected from shard.yml)
remote: Deprecation: The build command was renamed to compile and will be removed in a future version.
remote: /usr/bin/ld: cannot find -lgmp
remote: collect2: error: ld returned 1 exit status
remote: Error: execution of command failed with code: 1: `cc -o "/tmp/build_48475e7b877277455138ed66882ee136/app" "${@}" -rdynamic -lgmp -lz `pkg-config --libs libssl || printf %s '-lssl -lcrypto'` `pkg-config --libs libcrypto || printf %s '-lcrypto'` -lpcre -lm -lgc -lpthread /tmp/crystal/src/ext/libcrystal.a -levent -lrt -ldl -L/usr/lib -L/usr/local/lib`
remote:
remote: ! Push rejected, failed to compile Crystal app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to codeship-lighthouse-cr.
remote:
To https://git.heroku.com/codeship-lighthouse-cr.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/codeship-lighthouse-cr.git'
it looks like gmp is a new dependency in Crystal 0.18? i remember that the deployment worked fine with 0.17.
Hello, I am running into an issue when I try to build my app on my heroku server. It is building (and running) fine locally but fails to build with an unterminated call
error when I try to deploy it to heroku. Here is the stacktrace I get for the error:
remote: Syntax error in ./libs/multi_auth/multi_auth/providers/facebook.cr:36: unterminated call
remote:
remote: JSON.mapping(
remote: ^
remote:
remote: ! Push rejected, failed to compile Crystal app.
remote:
remote: ! Push failed
Any ideas what I can do to fix this? The error comes from here: https://github.com/msa7/multi_auth/blob/master/src/multi_auth/providers/facebook.cr#L36
Thanks in advance!
Deprecation: The compile command was renamed to build and will be removed in a future version.
I'm having trouble getting my app to compile for Heroku. I can compile it just fine on my own machine. I am getting an error message, but I'm not sure what it means or how to go about troubleshooting it: .cr does not exist
. Any idea what this means and how to resolve it?
I created the project using crystal init
, added a Procfile (web: crystal src/cj-fan-server
), adjusted the license and version, and created a lib folder. I have not made any other changes to the configuration (not including source code) or structure (source: https://github.com/cloewen8/CJ-Fan-Server).
So far I've tried adding .cr
to the process command, renaming the Procfile temporarily, and searching for the error message (not a single match).
I have a Crystal 0.33 app on Heroku, it's worked for a while flawlessly. However, I recently tried to push a minor change and the build broke since it installed version 0.35.1 which is incompatible with my 0.33 code. Heroku support pointed out that I needed a .crystal-version
file. So, I created one with 0.33
in it. I'm getting this error now:
remote: -----> Installing Crystal (0.33 due to .crystal-version file) from ... curl: no URL specified!
remote: curl: try 'curl --help' or 'curl --manual' for more information
remote:
remote: gzip: stdin: unexpected end of file
remote: tar: Child returned status 1
remote: tar: Error is not recoverable: exiting now
remote: ! Push rejected, failed to compile Crystal app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to xxxxx.
So, is there a way to specify the URL with the version? How can I fix this?
Thanks!
Not experienced with crystal,
but why not set port from ENV,
like other buildpacks do (ruby,go)?
Currently, I have a Rails app and I am thinking about integrating crystal in the pipeline for async jobs.
I know that heroku provides now an interface of multiple buildpacks for every app.
https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app
For instance, I am using ffmpeg-buildpack: https://github.com/shunjikonishi/heroku-buildpack-ffmpeg
Would it be possible for the build-pack to compile one class and run on demand? For instance with the Heroku scheduler?
Heroku added support for ENV_DIR
back on February 24 2014. It looks like the buildpack reads in the ENV_DIR
argument, however, I don't see where it actually makes use of it.
From bin/compile#L42:
ENV_DIR=$3
If the ENV_DIR
were properly supported I should be able to have something like:
$ tree
.
├── env
│ └── SHARDS_OPTS
Where SHARDS_OPTS
has the contents of --ignore-crystal-version
Heroku provides an example of how to use it in bash:
export_env_dir() {
env_dir=$1
acceptlist_regex=${2:-''}
denylist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)$'}
if [ -d "$env_dir" ]; then
for e in $(ls $env_dir); do
echo "$e" | grep -E "$acceptlist_regex" | grep -qvE "$denylist_regex" &&
export "$e=$(cat $env_dir/$e)"
:
done
fi
}
For another example, refer to the Ruby buildpack:
They have a helper, lib/language_pack/shell_helpers.rb#L50-L63:
def self.blacklist?(key)
%w(PATH GEM_PATH GEM_HOME GIT_DIR JRUBY_OPTS JAVA_OPTS JAVA_TOOL_OPTIONS RUBYOPT).include?(key)
end
def self.initialize_env(path)
env_dir = Pathname.new("#{path}")
if env_dir.exist? && env_dir.directory?
env_dir.each_child do |file|
key = file.basename.to_s
value = file.read.strip
user_env_hash[key] = value unless blacklist?(key)
end
end
end
The build script uses the env
dir:
PLATFORM_DIR=$2
ENV_DIR="$PLATFORM_DIR/env"
Since the release of 0.23.1 I'm getting this from the buildpack:
remote: -----> Crystal app detected
remote: -----> Installing Crystal (0.23.1 due to latest release at https://github.com/crystal-lang/crystal)...
remote: gzip: stdin: not in gzip format
remote: tar: Child returned status 1
remote: tar: Error is not recoverable: exiting now
remote: done
remote: -----> Installing Dependencies... /app/tmp/buildpacks/7cae2d464297fe40ab4f8baf661b5905138e7a4679faeb1e9b99b4ed6b787bc446f63a669c7a918dc21952d53acb6cac9426f13ed74d85acdccff4c0dc00b0f6/bin/compile: line 65: crystal: command not found
Something changed about the upstream filenames, perhaps?
It's easy to abstract away code to what you're familiar with. In one of my projects I modeled the directory structure after Rails. This build pack won't allow for a folder to be named /app/
since the executable /app
exists (or vice versa). Can you please change the executable to be named /app.ex
?
I don't think any other changes are necessary. Path is important so the executable should remain where it is.
I've tried thinking of another name for app for a folder to model after Rails, but it really loses the familiarly organized structure. Best thing I can think of is for the buildpack to add an extension to the executable.
Inside the build pack
crystal -v
Crystal 0.22.0 [3c71228] (2017-04-20) LLVM 3.5.0
I'm getting very slow compile times, possibly because of this. Any ideas how I update this.
I'll update this if I work it out sooner.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.