Comments (27)
Notice I didn't say "official"...
Oh, indeed.
Well... I guess, for a clean fix, one need to parse the .env
file as key=value entries instead of plain source
ing it.
Unfortunately, I am not very good with bash nor regepx ;)
I will think about this.
Thank you for your time :)
from herokuish.
@pierredavidbelanger v0.3.20
has a basic (emphasis on basic) env file parser that will work with spaces. please give it shot.
from herokuish.
Ah that is for tests, hence why it's in the Dockerfile.dev
.
@michaelshobbs @progrium thoughts on including that in the base image, or replacing the usage in tests for something is in the base image?
from herokuish.
I just saw #195
I do have pushed this issue too hard after all :)
I changed my mind on this.
I realized that herokuish is not (required to be) Heroku, and as so, Dokku take for granted that .env
file is shell source
-able.
I vote you revert 465bbe1, instead of trying to code a key=value parser (that supports complex shell syntax and variable interpolation) in shell :)
And, for my original issue (being able to build the official unmodified java-getting-started), the workaround will be to simply rm
the .env
file; indeed, on the Heroku build servers, the .env
file is not used, because it should not be under source control anyways.
Does it make sens ?
from herokuish.
Spaces aren't valid values in unquoted shell, so yes, you will have to quote the value in order to have it be assigned.
from herokuish.
Spaces aren't valid values in unquoted shell
I know that. And I will surely not make this mistake in my own application.
But it seems Heroku will not treat .env
file like a shell.
You understand that I am using the official Heroku unmodified java-getting-started app ?
And since:
The goal is to be the definitive, well maintained and heavily tested Heroku emulation utility shared by all.
I just assumed the official Heroku java-getting-started app would work unmodified.
This is why I reported this issue.
from herokuish.
If you use the heroku cli to set the above environment variable, that is the following command:
heroku config:set ENERGY="20 GeV"
Without quoting, that would result in an error since GeV
would be parsed as a key without a specified value (actually it might set it to empty string, but its certainly not what you want).
Via the web ui, you are explicitly quoting as there isn't a way to specify multiple key=value
pairs in the web form on a single form input.
For their api, same deal, except it's using json dictionaries.
Their backing store is not a .env
file, but rather a database of those credentials. Thus they have it in key => value
format, where you can think of that value as being quoted (otherwise it wouldn't be in the same field in their database.
So yes, I do think this works as a pretty good test of the heroku parsing scheme, given that our .env parsing is done via shell, where the value must be quoted in order to be used.
from herokuish.
During this tutorial https://devcenter.heroku.com/articles/getting-started-with-java
when I git push heroku master
, it does not fail with an GeV: command not found
.
I guess, what I expect is that I can build the official example app without error.
Why parsing the .env
file at all during build time ?
from herokuish.
@pierredavidbelanger I get your point. Do you have a solution in mind or better yet a PR to make this work?
from herokuish.
@michaelshobbs Thank you.
Also, I am sorry, I may be pushing this issue too hard ;)
I am new with this project, I may be wrong, but I think that removing this if will help.
Though, given the comment, it seems to be there for a reason ?
If I understand correctly, .env
file is there to help devs simulate Heroku ENV when running locally (just like foreman do, for example). Heroku does not care for this file at build or run time.
from herokuish.
Unfortunately the reasoning for herokuish's support of .env
is not so intentional. Additionally, removing that line will cause all apps that do not have a .env
file to fail to build. That block is read "if the file $app_path/.env
exists, then source it."
The problem is that bash has very strict parsing rules and doesn't have the additional constructs of a language like ruby; like what foreman is written in.
from herokuish.
When I say, removing the if, I mean, completely .. like, not sourcing .env at all ..
Or, if you really want to continue to source it (let say, maybe because actual users may depends on this), maybe you can try to source it, is a way compatible with foreman.
from herokuish.
Ah! Understood. So that is there because some buildpacks still use it.
Please feel free to contribute to the project and make this work for you and the rest of the folks out there.
from herokuish.
I really wonder which official buildpack uses this file.
Even Heroku recommend to .gitignore this file.
from herokuish.
Notice I didn't say "official"...
from herokuish.
@michaelshobbs That was fast! Your fix is working for the heroku/java-getting-started application.
I just tried this:
$ docker build -t herokuish .
$ git clone https://github.com/heroku/java-getting-started.git
$ docker run --rm -it -e TRACE=true -v `pwd`/java-getting-started:/tmp/app herokuish test
It worked. Here is the relevant parts of the logs:
...
+ [[ -f /app/.env ]]
++ cat /app/.env
++ _envfile-parse
++ declare 'desc=Parse input into shell export commands'
++ local key
++ local value
+++ cat
++ read line
++ [[ ENERGY=20 GeV =~ ^#.* ]]
++ key=ENERGY
++ key=ENERGY
++ value='20 GeV'
++ case "$value" in
++ value='"20 GeV"'
++ echo 'export ENERGY="20 GeV"'
++ read line
++ [[ -n '' ]]
+ eval export 'ENERGY="20' 'GeV"'
++ export 'ENERGY=20 GeV'
++ ENERGY='20 GeV'
...
++ curl --fail --retry 10 --retry-delay 2 -v -s localhost:5678/
* Hostname was NOT found in DNS cache
* Trying ::1...
* Connected to localhost (::1) port 5678 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:5678
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
* Server Jetty(9.0.z-SNAPSHOT) is not blacklisted
< Server: Jetty(9.0.z-SNAPSHOT)
<
...
from herokuish.
Also, not related to the original issue:
I spotted this, near the end of the output:
::: CHECKING APP :::
+ local output
++ xargs
++ html2text -ascii
/tmp/bashenv.409484805: line 122: html2text: command not found
I guess html2text
is missing from the image.
from herokuish.
@pierredavidbelanger yeah you can add that via apt-get in your own custom image. Is that available on heroku? If so, they haven't pushed out their latest changes to their oss project.
from herokuish.
I am not using a custom image. I am docker build
ing straight from the root of your freshly cloned project.
Try this :
$ git clone https://github.com/gliderlabs/herokuish
$ cd herokuish
$ docker build -t herokuish .
$ git clone https://github.com/heroku/java-getting-started.git
$ docker run --rm -it -e TRACE=true -v `pwd`/java-getting-started:/tmp/app herokuish herokuish test | grep html2text
++ html2text -ascii
/tmp/bashenv.788662760: line 122: html2text: command not found
This tool seems not to be used used by the official java buildpack.
The html2text: command not found
error, come from your herokuish test
command here
I guess you expect it to be present on the heroku/cedar:14
image ?
from herokuish.
Right, I'm saying that this package is not on the official heroku setup either:
$ heroku run bash
Running bash on ⬢ my-fancy-app... up, run.6417 (Hobby)
~ $ which html2text
~ $ html2text
bash: html2text: command not found
If you want that binary, you'll need to make a new Dockerfile that uses our image and calls apt-get install
on whatever package contains html2text
.
from herokuish.
But herokuish relies on it,
herokuish/include/herokuish.bash
Line 109 in 3d79244
So shouldn't that technically mean it should be installed in herokuish by default?
from herokuish.
I have no use for this package myself :)
I guess we are lost on translation here, I am sorry for that, my primary language is not english.
I just wanted to report to you, that your herokuish test
command is throwing some command not found
error. And this is due to the fact that heroku/cedar:14
does not contains this package, nor your default image.
I see, though, that this one does though.
from herokuish.
@josegonzalez I'm fine with including that in the base image. That's the "easiest" fix.
from herokuish.
What else does it pull in? If it's just that binary, lets do it, otherwise I'm 👎 .
from herokuish.
It has no new dependencies
Package: html2text
Versions:
1.3.2a-18 (/var/lib/apt/lists/httpredir.debian.org_debian_dists_jessie_main_binary-amd64_Packages.gz) (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/httpredir.debian.org_debian_dists_jessie_main_binary-amd64_Packages.gz
MD5: a57fb9ed5921cd11bfc59269f601f3c0
Reverse Depends:
urlwatch,html2text
dhelp,html2text
Dependencies:
1.3.2a-18 - libc6 (2 2.14) libgcc1 (2 1:4.1.1) libstdc++6 (2 4.9) curl (16 (null)) wget (0 (null))
Provides:
1.3.2a-18 -
Reverse Provides:
from herokuish.
Alright, ship it (but add a caveat to our readme saying we include it for tests).
from herokuish.
Actually I think I only added that as part of the emberjs buildpack addition. I'll drop that too since we're not shipping with that buildpack anymore. c797745
from herokuish.
Related Issues (20)
- Failure to run on ARM/M2 HOT 3
- Missing jq HOT 1
- Log buildpack version HOT 2
- Add support for .profile bash file per Heroku HOT 3
- add rng-tools for more entropy in `/dev/random`? HOT 1
- Export_env : command not found HOT 1
- Update ruby buildpack to v228 HOT 2
- Change node js and php detection order HOT 2
- Errors in post-install scripts HOT 2
- Execute command inside bash instead of exec HOT 3
- Use latest heroku images to fix Let's Encrypt root certificate expiration HOT 3
- Fails to find nodejs version HOT 6
- Draft new release HOT 1
- Question: Can I use the Heroku-22 stack already? HOT 3
- Error during installation: manifest for not found for v0.5.40 HOT 16
- Game changer
- Security vulnerability in v0.5.40-22 HOT 4
- Cannot install on Rocky 8.6/8.7 - Permission denied HOT 1
- Heroku stack images got updated, missing packages used by a buildpack HOT 4
- No images in Docker Hub for v0.5.41 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from herokuish.