Cloud foundry downloading wrong go version when binary file pushed to cf - go

Hi we are seeing wrong go version is downloaded when i push my binary file to cf
Steps followed to push code
run go build command
GOOS="linux" GOARCH=amd64 go build ${LDFLAGS} -o localdeploy/some-app main.go
cd localdeploy
cf push -f manifest.yml
Note: localdeploy folder contains manifest.yml and some-app binary file
Go.mod file
go 1.16
require (
github.com/cloudfoundry-community/go-cfenv v1.18.0
github.com/gin-gonic/gin v1.8.1
github.com/google/uuid v1.3.0
github.com/rs/zerolog v1.28.0
github.com/stretchr/testify v1.8.0
)
manifest file.yml
applications:
- name: some-app-1000-snapshot
command: ./some-app
stack: cflinuxfs3
buildpacks:
- https://github.com/cloudfoundry/binary-buildpack.git
Then i see following logs downloading go 1.15.5 instead of go 1.16
Below are the logs getting when pushed to cf --- application is working but why it is downloading 1.15 instead of 1.16 which is present in my mod file
Staging app and tracing logs...
-----> Download go 1.15.5
-----> Running go build supply
/tmp/buildpackdownloads/d612ac0e3047b21e80ecfeae72c39f81 ~
~
-----> Binary Buildpack version 1.0.46
-----> Download go 1.15.5
-----> Running go build finalize
/tmp/buildpackdownloads/d612ac0e3047b21e80ecfeae72c39f81 ~```

The binary buildpack doesn't install anything for your application. It is effectively a no-op buildpack.
Since you have compiled your application locally, the version of Go that is used for your binary is the version installed locally on your computer. You control that version based on what you have installed locally.
The output of the binary buildpack is confusing here, because you do see it downloading an older Go version. The reason this happens is because the buildpack itself is written in Go and you have the buildpack definition in your manifest.yml pointing to the source code of the buildpack. Thus to run the buildpack, it has to compile itself first. It needs Go to do that, so it downloads Go, builds itself, then runs itself. That's what you're seeing where it says Download go 1.15.5.
Most (all?) CloudFoundry installations are going to have the binary buildpack by default, so you don't need to reference the source. Run cf buildpacks and get the name of the binary buildpack from the list. It'll be something like binary-buildpack or binary_buildpack. Edit your manifest.yml and replace https://github.com/cloudfoundry/binary-buildpack.git with that value.
Now when you push, it'll use the existing buildpack which is already compiled and you shouldn't see those messages about Go being downloaded.

Related

How To Download Client-Go V12.0.0 via Go Get Cmd Tool

when I execute below cmd:
go get k8s.io/client-go#v12.0.0
it tells me: "go: k8s.io/client-go#v12.0.0: invalid version: module contains a go.mod file, so module path must match major version ("k8s.io/client-go/v12")"
ok, then I changed the cmd to this:
go get k8s.io/client-go#v12.0.0+incompatible
then again, it still tells me the same error: go: k8s.io/client-go#v12.0.0+incompatible: invalid version: module contains a go.mod file, so module path must match major version ("k8s.io/client-go/v12")
one interesting thing puzzles me that if I add require k8s.io/client-go v12.0.0+incompatible to go.mod and then execute go mod tidy, then client-go v12.0.0 will be downloaded correctly.
My question is: how can I download this specific version of client-go via go get??
Go Version: v1.18
I used the go install command to download client-go
Here are two examples to install the latest or specific version.
go install k8s.io/client-go#latest
go install k8s.io/client-go#v0.25.3
See client-go installation section for more help,
client-go install
how can I download this specific version of client-go via go get
Not at all.
go get is for adding dependencies to your project.
To download source code in a certain version from the internet use git clone and git checkout.

GO with Heroku Deployments

Hello i am currently running into a problem with using Heroku! It finds all my dependency's until
build project: cannot load io/fs: cannot find module providing package io/fs
I have the vendor directory on my github repo but it just wont build?
On heroku -> your project -> Settings -> Buildpacks, and add 'heroku/go'.
Then execute in any terminal:
heroku config:set GOVERSION=1.16
Per #jimb, you're likely using an earlier than Go 1.16 version.
fs became available with Go 1.16:
https://pkg.go.dev/io/fs?tab=versions
Check
go version
And you go.mod Go version.

go build: no Go files in /msfs2020-go-master

Im trying to rebuild a golang github repository to apply some minor changes.
The go application Im trying to modify is the following https://github.com/lian/msfs2020-go
Please use the provided github link to inspect the file tree.
I used the master branch and extracted it to /user/Documents/msfs2020-go-master
If I call go build from /user/Documents/msfs2020-go-master the output equals: no Go files in /user/Documents/msfs2020-go-master
I tried deleting the go.mod and recreating it with go mod init github.com/lian/msfs2020-go followed with a go mod tidy
but still no Go files in /user/Documents/msfs2020-go-master
Here the current go.mod
module github.com/lian/msfs2020-go
go 1.16
require github.com/gorilla/websocket v1.4.2
And here the go.sum
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
The master was build with 1.14 and Im using 1.16 golang.
All my test go applications/modules run/build/install fine at a "Hello World" developing level.
What did I do wrong? I gladly accept any input and will provide additional information's if requested.
The command go build builds the package in the current working directory. The command reports an error because there is not a package at the root of the repository.
Fix by building the package containing the command. Any of the following will work from the root of the repository:
go build ./vfrmap
or
cd vrfrmap
go build
or
go build github.com/lian/msfs2020-go/vfrmap
See also the file build-vfrmap.sh.

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"
}
]

Heroku buildpack - Installing texlive binary package

I'm trying to install the texlive-full package on heroku through making a custom buildpack. I'm working on django application, so I'm currently using version of heroku-buildpack-python (https://github.com/heroku/heroku-buildpack-python).
According to this tutorial:
https://devcenter.heroku.com/articles/buildpack-binaries
I found a binary package of texlive on http://packages.ubuntu.com/lucid/texlive-binaries (Links in the right column - Download Source Package) and I added these lines of code in python default heroku buildpack in the section #Build time in order to extract and install texlive-full on heroku.
# Build Time
# Switch to the repo's context.
cd $BUILD_DIR
TEXLIVE_BINARY="http://archive.ubuntu.com/ubuntu/pool/main/t/texlive-base/texlive-base_2012.20120611-5.debian.tar.gz"
TEXLIVE_VENDOR="vendor/texlive"
# vendor awesome-vm
mkdir -p $1/$TEXLIVE_VENDOR
curl $TEXLIVE_BINARY -o - | tar -xz -C $1/$TEXLIVE_VENDOR -f -
After pushing the django application to heroku I can see that slug is 58.0 MB big (before it was just 10.0 MB), so it might have added texlive-full binary package to it (which is about 44 MB). However the latex equation on the site is still not showing and the same error appears; (That appears when texlive is not installed)
ValueError at / latex returned code 32512 for formula:
Is there some easier way to install texlive-full on heroku? Or what is the correct notation for installing texlive-full in buildpack or any other kind of debian package?
Based on this buildpack I built my own version: https://github.com/syphar/heroku-buildpack-tex
It installs a small version of TeX-Live 2013 in your slug, and you can extend it by adding your own packages (collections or single packages from CTAN).
Since your (compressed) slug-size is limited to 300 MB on Heroku you can't texlive-full inside your application.
This buildpack worked for me:
https://github.com/holiture/heroku-buildpack-tex
That error code tends to be returned because of problems with your path (https://tex.stackexchange.com/questions/21692/latex-compilation-failure-on-mac-os-x-from-python-script) Follow the last step of the tutorial here https://devcenter.heroku.com/articles/buildpack-binaries and add the directory that your build pack works on to your path.

Resources