Cloud Foundry Ruby Offline Buildpack - ruby

I'm trying to get a Ruby Offline buildpack working and am running into this error when deploying an application.
2015-03-31T14:28:56.21-0600 [STG/0] OUT -------> Buildpack version 1.3.0
2015-03-31T14:28:56.22-0600 [STG/0] OUT !
2015-03-31T14:28:56.22-0600 [STG/0] OUT ! No such file or directory - /var/vcap/data/dea_next/admin_buildpacks/fbc8ba1a-0f89-4cd4-bdc6-6b189b326ab6_f80a090fe58f5bba36a6d25dfe86220f7dfcc41d/compile-extensions/bin/translate_dependency_url https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/bundler-1.7.12.tgz
2015-03-31T14:28:56.22-0600 [STG/0] OUT !
Environment:
Linux CentOS 6
Here are the steps I followed:
download the ZIP from https://github.com/cloudfoundry/ruby-buildpack
unzip locally
cd ruby-buildpack
rvm use 2.1.5
BUNDLE_GEMFILE=cf.Gemfile bundle
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager cached
cf create-buildpack sjw_ruby_buildpack ruby_buildpack-cached-v1.3.0.zip 11
These instructions came from https://github.com/cloudfoundry-incubator/buildpack-packager/blob/master/doc/disconnected_environments.md
I then deployed the Ruby app as follows:
switched to ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]
bundle install
bundle package --all
cf push -b sjw_ruby_buildpack
Failed with the above error message.

This was answered on the Cloud Foundry Dev Group
https://groups.google.com/a/cloudfoundry.org/forum/?utm_medium=email&utm_source=footer#!topic/vcap-dev/9KhpUfuGprk
Here's the relevant section:
It seems like git submodule update --init isn't working, which is actually to be expected if you're using the "Download ZIP" button at the homepage of the ruby-buildpack repo. It sounds like that's how you got the buildpack (" - download the ZIP from https://github.com/cloudfoundry/ruby-buildpack), but Github doesn't provide you with the .git file when you download the source code this way.
To modify the prebuilt buildpack, you could download the ruby_buildpack-cached-v1.3.0.zip file from here, unzip it, modify it, re-zip it and run the cf create-buildpack command to upload it to your Cloud Foundry deployment.
If you need to build it entirely locally, you can try cloning the repo instead:
git clone https://github.com/cloudfoundry/ruby-buildpack.git
cd ruby-buildpack
rm ruby_buildpack-cached-v1.3.0.zip
git submodule update --init
BUNDLE_GEMFILE=cf.Gemfile bundle exec buildpack-packager cached
cf create-buildpack sjw_ruby_buildpack ruby_buildpack-cached-v1.3.0.zip 11
In particular, you should expect the git submodule update --init command NOT to return "fatal: Not a git repository (or any of the parent directories): .git".
Once that's done, try pushing your app again, specifying the buildpack with the -b flag like before, and let us know what happens.

Related

Replace go-swagger with another version in Windows

I am using go1.14.1 and go-swagger version dev in my Windows 10. I installed go-swagger with Installing from source.
I'd like to use go-swagger version 0.25 instead. What is the clean way of replacing dev with 0.25?
The installation process is same as for master (dev) version except you need to do one more additional step which is checking out tag v0.25.0 after cloning the repo to temporary directory:
dir=$(mktemp -d)
git clone https://github.com/go-swagger/go-swagger "$dir"
cd "$dir"
# Checkout version v0.25.0
git checkout v0.25.0
# Continue with installation, instead of
# go install ./cmd/swagger
# use this which just adds version information (current tag) and commit id to binary
go install -ldflags "-X github.com/go-swagger/go-swagger/cmd/swagger/commands.Version=$(git describe --tags) -X github.com/go-swagger/go-swagger/cmd/swagger/commands.Commit=$(git rev-parse HEAD)" ./cmd/swagger
NOTE: If you do just go install ./cmd/swagger it will technically still install v0.25.0 but swagger version subcommand will report it as dev. The version information is just a cosmetic thing passed from git repository down as content of variables in commands package and you can see how authors do it in their CircleCI config file here. Eventually you can add also other flags to get static build (but they don't do that in official Installing from source instructions).
Once done you should have go-swagger v0.25.0 installed in your $GOPATH/bin, verify with:
$ swagger version
version: v0.25.0
commit: f032690aab0634d97e2861a708d8fd9365ba77d2

Getting PDFTK installed on Heroku 18 for use in my Laravel app

I have added this pdftk buildpack to my free app on Heroku: https://github.com/fxtentacle/heroku-pdftk-buildpack.git.
I am unable to deploy my application to Heroku:
Preparing runtime environment...
-----> Checking for additional extensions to install...
-----> heroku-pdftk-buildpack app detected
cp: cannot stat 'binaries-heroku-18/*': No such file or directory
! Push rejected, failed to compile heroku-pdftk-buildpack app.
! Push failed
Also, I have added heroku/php and set the index of this buildpack to 1. When I go to my app's temporary URL, Laravel runs, but for some reasons, pdftk doesn't seem to run. Has anybody faced the same issue?
That buildpack hasn't been updated for the heroku-18 stack. Its compile script tries to copy precompiled binaries from binaries-$STACK/ into /app/bin/, but only contains binary directories for cedar-14 and heroku-16.
You could roll your app back to heroku-16, which will be supported until April, 2021, but of course this will also change other package versions:
heroku apps:stacks:set heroku-16 --app myapp
This would be very similar to going from Ubuntu 18.04 to Ubuntu 16.04, but it's likely to be your simplest solution.
Alternatively, you could fork the pdftk buildpack you found and update it for Ubuntu 18.04, but that isn't likely to be straightforward.
pdftk was removed from Ubuntu's official repositories because it depends on a deprecated library called gcj. The buildpack you're trying to use includes libgcj for cedar-14 and heroku-16 in their respective binary directories. You'll have to include that as well if you want to update the buildpack.
Also, I have added heroku/php and set the index of this buildpack to 1. When I go to my app's temporary URL, Laravel runs, but for some reasons, pdftk doesn't seem to run. Has anybody faced the same issue?
The error you're seeing is preventing your application from being deployed. You're not seeing a new version of the application with pdftk, but whatever was last deployed successfully. You'll have to resolve the build issue before you can use pdftk.
I followed this article (http://derekbarber.ca/blog/2014/11/20/using-pdftk-with-rails-on-heroku/) and got PDFTK working on Heroku-18, though on a Rails app.
Code excerpted below, HT #derek-barber.
mkdir -p [my_project]/vendor/pdftk/lib [my_project]vendor/pdftk/bin
cd /tmp
git clone https://github.com/millie/pdftk-source.git
cd pdftk-source
tar xzvf pdftk.tar.gz
mv bin/pdftk [my_project]/vendor/pdftk/bin/
mv lib/libgcj.so.12 [my_project]/vendor/pdftk/lib/
cd [my_project]
git add -f vendor/pdftk/
git commit -m "Add pdftk dependencies"
git push heroku master
heroku config:set LD_LIBRARY_PATH=/app/.heroku/vendor/lib:/app/vendor/pdftk/lib
heroku config:set PATH=/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin:/app/vendor/p
Once this PR is merged: https://github.com/fxtentacle/heroku-pdftk-buildpack/pull/9 then the buildpack should work with heroku-18 stack.
Maybe leave a comment to the repo owner asking them to merge?
For now, you could use the forked & updated version: https://github.com/Aesthetikx/heroku-pdftk-buildpack which works with heroku-18 stack.
If you are using an app.json file, then point the pdftk buildpack to the forked version:
"buildpacks": [
...,
{
"url": "https://github.com/fxtentacle/heroku-pdftk-buildpack.git"
}
]

Install FFMPEG on Heroku

I am trying to install FFMPEG to work with my NodeJs server.
I am using heroku-buildpack-multi plugin:
heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
I have created a .buildpacks (without extesion) file at my github repository. This is what it includes:
https://github.com/jayzes/heroku-buildpack-ffmpeg
https://github.com/heroku/heroku-buildpack-nodej
Each time i am trying to push my changes to heroku, this is what i get:
-----> Fetching custom git buildpack... failed
! Push rejected, error fetching custom buildpack
Unforlunatly, there is not much information regarding ffmpeg installtion
on heroku. What am i missing here?
I just tried this with a demo app I cloned from Heroku:
https://github.com/heroku/node-js-getting-started.git
I was able to deploy successfully following the same steps you listed above, except I added an 's' to the end of your second buildpack (you have a typo - could this be the issue?): https://github.com/heroku/heroku-buildpack-nodejs
I would recommend following the same process with a fresh codebase to help troubleshoot your environment. But note two things: 1) The heroku-buildpack-multi plugin you're using is deprecated, and 2) Heroku officially supports multiple buildpacks:
https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app
and has an officially supported ffmpeg buidback you can use:
https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest

Gemfile git branch for Beanstalk unable to bundle install

In my Gemfile I have
gem 'slim', :git => 'git://github.com/brennancheung/slim.git', :branch => 'angularjs_support'
which is a branch of the slim gem required for me to run AngularJS correctly with my views. I've pushed my code to my beanstalk application but am unable to bundle install according to the logs shown below...
sh: git: command not found
Git error: command `git clone 'git://github.com/brennancheung/slim.git'
"/usr/share/ruby/1.9/gems/1.9.1/cache/bundler/git/slim-700ed452e752ccb6baf9de9d0a46fbded8bb2da5"
--bare --no-hardlinks` in directory /var/app/ondeck has failed.
I'm new to Beanstalk and have no idea how to fix this. Any help on how to get bundle to install successfully would be greatly appreciated. Thanks.
Since git is not installed on by default on EC2 instance, you would have to find a workaround solution:
a. Install git on instance with configuration file and command.
It is the most obvious way to solve the problem, although not be the most efficient.
b. Clone slim repository into your project, so it will be deployed together.
Seems that slim is not being actively developed lately, so having the copy in your project might not be a bad idea. It protects you from github.com being down, yet you will have extra files to carry around.
c. Use configuration file and commands to pull the data from github.com directly with http.
Too many files to work with, and also dependency on third party service.
d. Use a combination of above. Clone slim repository and copy files to S3. Use configuration and commands to copy files from S3 to your instance.
It seems like the most elegant and efficient way to solve the problem.
It might look something like:
$ cat .ebextensions/myapp.config
commands:
10-copy-slim-from-s3
command: "aws s3 cp s3://mybucket/slim slim --recursive"

Cloning repository from ruby

I'm creating a Sinatra app that will pull in data from a remote git repository.
I've taken a look at the ruby-git gem, but I get cannot load such file -- git on the line of require 'git'. The gem is installed and in my Gemfile.
I'm not sure if this is the correct way about going about this, but essentially I want the app to checkout a git repository for pulling in data.
Ended up using the system command:
system("git clone #{$config['repository']} content")

Resources