Closed iciarfernandez closed 4 years ago
1) all 5 files and app should be in one main folder, and Heroku should be connected to that folder specifically:
2) not sure about the error, but did you updated init.R and other files to match your app?
also, did you forked the repo and put it outside your project ( e.g. somewhere om desktop for instance) and then do the steps described in the guide/?
I did fork the repo and put it in a temporary folder I created on my desktop, and I updated my init.R to include all packages that my app.R uses. I now also moved my app.R to the main repo folder like you said above (it was under 'scripts' before), but still getting this error:
=== Fetching app code. =!= There were problems parsing your heroku.yml. We've detected the following issues: "build" must validate one and only one schema (oneOf). Found none valid build.docker in body is a forbidden property build.web in body is a forbidden property
did you check the heroku.yaml is all good and indented properly also, the Dockfile all the app name match?
I think so? I'm not sure of how to check that.
My heroku.yml looks like this:
build:
docker:
web: Dockerfile
And my Dockerfile looks like this:
FROM plotly/heroku-docker-r:3.6.2_heroku18
# on build, copy application files
COPY . /app/
# for installing additional dependencies etc.
RUN if [ -f '/app/onbuild' ]; then bash /app/onbuild; fi;
# look for /app/apt-packages and if it exists, install the packages contained
RUN if [ -f '/app/apt-packages' ]; then apt-get update -q && cat apt-packages | xargs apt-get -qy install && rm -rf /var/lib/apt/lists/*; fi;
# look for /app/init.R and if it exists, execute it
RUN if [ -f '/app/init.R' ]; then /usr/bin/R --no-init-file --no-save --quiet --slave -f /app/init.R; fi;
# here app.R needs to match the name of the file which contains your app
CMD cd /app && /usr/bin/R --no-save -f /app/app.R
My app script is called app.R
how your app is called?
On Heroku.com I named it phd-satisfaction, is that what you mean?
no, the actual script to run app: is it app.R or smth else?
It's app.R
everything looks fine then in those apps. what about init.R? what did you put inside?
and after you moved the app, didi you commit and push the changes?
These are the contents of init.R,
# R script to run author supplied code, typically used to install additional R packages
# contains placeholders which are inserted by the compile script
# NOTE: this script is executed in the chroot context; check paths!
r <- getOption('repos')
r['CRAN'] <- 'http://cloud.r-project.org'
options(repos=r)
# ======================================================================
# packages go here
install.packages('remotes')
remotes::install_github('plotly/dashR', upgrade=TRUE)
install.packages('tidyverse')
install.packages('plotly')
install.packages('gapminder')
install.packages('ggsci')
install.packages('ggplot2')
yeah I did commit and push the changes, the app is on the main root repo folder both on GitHub and in my local clone in the temporary folder I created in my computer.
let me try and redo your app, and see whether I encounter the same issues, ok?
sounds good, thank you so much!
I was an easy to fix; first
build:
docker:
web: Dockerfile
Thank you so much! The app seemed to be deploying successfully, but the app doesn't actually display. In regards to your init.R comment, do the dash libraries also have to be loaded? I think that's what I'm confused about
@sciclic yes, all the libraries listed in README to your repo have to be installed. dash is installed with this code:
# packages go here
install.packages('remotes')
remotes::install_github('plotly/dashR', upgrade=TRUE)
you dont need to load any other dash related libraries
I see, thank you! I thought it only needed to be the libraries that were loaded in the app.R script. I'm trying now once I've updated it and I will let you know if it works. Thanks for all the help @yuliaUU ! :)
Hi again @yuliaUU, so I added all the libraries in our README to the init.R and deployed the app, the message on Heroku.com says that it was deployed successfully, but this is what shows up when I try to actually open the app
if you type in terminal, heroku logs -- tail
, what will you get?
This is the output of heroku logs --tail
in terminal
can you give me a link to updated files, i will have a look
yes, thank you!
this is what I found H10 error. @firasm , maybe you saw it already and can help with it?
thank you @yuliaUU, not too sure of how to fix that so we'll wait for @firasm to reply.!
@sciclic can you try again? i changed indenting of .yml. can you run using this one?
Running it right now! Thank you. Will let you know once it's finished
Now it's giving me a different error. Would it show up for you with the link phd-satisfaction.herokuapp.com?
I actually tried reloading a couple times, and now it gives me the same "application error" as before @yuliaUU
Hey just a small (unsuccessful) update that I deleted the app from Heroku, cloned the repo into a temp folder from scratch again, and repeated the whole process but still not working. I thought maybe that would be the easiest way, but no luck :(
@firasm , we cant seem to pinpoint the issue
Can you try to reduce your datasets by half and run it?
What do you mean by reduce the datasets by half? Right now I am attempting to deploy from terminal instead, based on this https://devcenter.heroku.com/articles/build-docker-images-heroku-yml#getting-started-existing-app
Thanks for all the help @yuliaUU, sorry we've had so many issues
make the data twice less; for example instead 4000 entries, do 1000. I was just wondering whether it is size related issue or not
Oh I see. Right now Jacob is trying to deploy it from his end to see if it somehow works for him, otherwise we'll try that! We did reduce the dataset for the app.R script (created a new dataframe called survey_dash.csv with less columns than the original), but I suppose it could still be a size issue
When I try to run it (with debug=TRUE), I get an error,
Invalid argument `value` passed into Slider with ID "ageslider".
Expected `number`.
Was supplied type `string`.
Value provided: "1"
I think your problem is Line 62:
make_plot2 <- function(ageslider = "1"){
the "1" shouldn't be a string, but a value.
There's also a second bug:
your app$run_server needs to be:
app$run_server(host = "0.0.0.0", port = Sys.getenv('PORT', 8050))
when it's deployed to heroku. Otherwise you will get errors like:
"App boot timeout"
Ok your app now deploys for me: https://test-app-squirrels.herokuapp.com
The last comment I made is most likely the error (I'm not sure what's going with your make_plot2 but it seems to work both ways)
@firasm @yuliaUU ,
Thanks for all your help, it seems to be running correctly now! The app$run_server change did the trick, although the make_plot function did not work correctly for me and deployment failed when passing 1 as a value :information_desk_person: Nonetheless, it's working now when passed as a string. Thanks :grin:
Hi @yuliaUU,
I was just going through the guidebook again to remember how we deployed an app to Heroku in class previously, but I'm a bit confused as to how to do this with our repo. My "app" is now on heroku.com and I got to the "deploy branch" step, but it's giving me errors. I guess my questions are:
Where do the required files (Dockerfile, heroku.yml, app.json, init.R, and apt-packages) need to be located within our repo? I first had them in the "scripts" folder but it gave me the error "cannot find a heroku.yml file" on Heroku.com, so I changed them to the root repo folder but I'm not sure that's how I'm supposed to approach that issue?
I am now getting this error, which I don't understand:
=== Fetching app code =!= There were problems parsing your heroku.yml. We've detected the following issues: "build" must validate one and only one schema (oneOf). Found none valid build.docker in body is a forbidden property build.web in body is a forbidden property
Thank you!!