Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

continuous installation with private repositories #19

Closed
sollano opened this issue Sep 1, 2017 · 12 comments
Closed

continuous installation with private repositories #19

sollano opened this issue Sep 1, 2017 · 12 comments
Labels

Comments

@sollano
Copy link

sollano commented Sep 1, 2017

Hello Jon,
I've created a continuous installation .exe file of an app I'm developing, using a github repository. It worked, and updated successfully. I had to make one change to the vignette code, however. Putting the apps name in the 'pkgs' argument would throw an error. So I moved it to the remotes argument. With that the app installed and launched. The code for creating the app looks like this:

create_app(
  app_name     = "AppInventarioNativas",
  app_repo_url = "https://github.com/sollano/AppInventarioNativas",
  pkgs         = c("shiny", "DT", "formattable", "readxl", "plyr", "tidyr","dplyr", "ggplot2", "lazyeval", "ggdendro","ggthemes","xlsx"),
  remotes      = "sollano/AppInventarioNativas",
  app_icon     = "LAB_logo.ico",
  setup_icon   = "LAB_logo.ico",
  publisher    = "Treelab ufvjm",
  pub_url      = "http://gorgens.wixsite.com/treelab",
  dir_out      = "exe_folder"
)

But, If I use the same code to create another .exe , plus the auth_user and auth_pw arguments using my account credentials, after making that repository private, the app does not run. It throws the error "startup failed with error(s): there is no package called "AppInventarioNativas" ". It does that after loading all the necessary packages.

In the error log, I can see that the the app fails when it tries to download from my private repository:

Error in packageVersion(config$appname[[1]]) : 
  package 'AppInventarioNativas' not found
Downloading GitHub repo sollano/AppInventarioNativas@master
from URL https://api.github.com/repos/sollano/AppInventarioNativas/zipball/master
Installation failed: Not Found (404)

But here's the thing: If I manually install the app on my computer via the main R GUI or RStudio, the .exe updates the app, and launches it normally, but does not add it to apps library folder like it should.

I'll make the repo public again, so you can check it out if you need to. I'm sure I am missing something here.

Thanks again for the great package!

@Dripdrop12
Copy link
Member

First, that is a beautiful app! Very nice work 👍

I got it to install, but you are right. The vignette needs to be updated because you should not put the app in the pkgs argument. I just walked through it again, and that is a bug.

It also looks like your github repo is out of sync with the package description file. Github is at 0.0.16, but the app's package is at 0.0.15. I don't think that is the main problem though because it just triggers an installation each time the icon is clicked.

I just ran:

create_app(
    app_name     = "AppInventarioNativas", app_dir = "app",
    app_repo_url = "https://github.com/sollano/AppInventarioNativas",
    pkgs         = c("shiny", "DT", "formattable", "readxl", "plyr", "dplyr", "ggplot2", "lazyeval", "ggdendro","ggthemes","xlsx"),
    publisher    = "Treelab uvjm",
    pub_url      = "http://gorgens.wixsite.com/treelab",
    dir_out      = "exe_folder"
)

And it pulled it down and installed it on my computer in "Documents\AppInventarioNativas\library\AppInventarioNativas." Because the versions are different, it tries to install every time its icon is clicked but it seems to be working.

I'll admit. I have not tested Github's private repos as much as I would like because many of my private repos are on Bitbucket. It looks like we need to dig into that a bit more to figure out why it is not installing correctly.

@Dripdrop12 Dripdrop12 added the bug label Sep 1, 2017
@sollano
Copy link
Author

sollano commented Sep 1, 2017

First, that is a beautiful app! Very nice work 👍

Thank you very much, Jon! It is part of my master's degree thesis. We are still working on it, but I'm glad you liked it!

It also looks like your github repo is out of sync with the package description file. Github is at 0.0.16, but the app's package is at 0.0.15.

Yes, you are right. I forgot to update it there, but that was a update that I did just to test if the app could pull from Github sucessfully. Like you said, I don't think that's the problem. I had that problem before I made that update.

I have not tested Github's private repos as much as I would like because many of my private repos are on Bitbucket. It looks like we need to dig into that a bit more to figure out why it is not installing correctly.

I understand. Are you using devtools to install from github? I tried to install AppInventarioNativas as a package when it was private using devtools::install_github(sollano/AppInventarioNativas), but it failed. It only worked when I provided a token with the auth_token argument. Maybe that is what's causing the installation to fail.

In the create_app function, we have the option to set the login information of the private repo. But, since devtools::install_github only accepts tokens as a mean of authentication, maybe the solution is to add a token argument to your function, that redirects to the devtools::install_github call that runs every time the app needs to be updated. I guess it would work.

Oh, I just noticed that tidyr needs to be included in the pkgs argument too.

@sollano
Copy link
Author

sollano commented Sep 1, 2017

Jon, another potential bug that I found is that when I manually set the icons and texts for the app launcher, they are used and work as expected, but, the default ones (setup.ico, default.ico, infoafter.txt, infobefore.txt) are created anyway. Furthermore, the app won't compile unless these files exist in the folder.

@Dripdrop12
Copy link
Member

Good catch. The new icons will be used but the old icons can cause trouble. I'll patch that piece to make sure that the old icons are ignored after the defaults have changed

@Dripdrop12
Copy link
Member

Dripdrop12 commented Sep 3, 2017

I made sure the old icons won't cause compile errors and also added a check to verify that the icons and info texts exist. If they don't, these are the warning messages it will produce:

> create_app("myapp", "app", info_after = "infoafter2.txt", info_before = "infobefore2.txt", app_icon = "app.ico", setup_icon = "setup2.ico")
Warning messages:
1: Make sure infobefore2.txt is in app/ before you call compile_iss() 
2: Make sure infoafter2.txt is in app/ before you call compile_iss() 
3: Make sure setup2.ico is in app/ before you call compile_iss() 
4: Make sure app.ico is in app/ before you call compile_iss()

@Dripdrop12
Copy link
Member

@sollano I patched the develop branch using Github's auth_token. Can you try installing it:

install_github("ficonsulting/RInno", ref = "develop")

Then add auth_token = [your auth token] to your create_app call? That should work for your private repo. I'll update the vignette with more details in the next patch, too.

Thanks!

@sollano
Copy link
Author

sollano commented Sep 3, 2017

I made sure the old icons won't cause compile errors and also added a check to verify that the icons and info texts exist. If they don't, these are the warning messages

Jon, just compiled the app here, and the default icons are no longer produced. It is working fine now!

I patched the develop branch using Github's auth_token. Can you try installing it

Jon, unfortunately this did now work for me. The app crashes just after the "Initializing" message. Here's the error log:

Loading required package: methods
Error in warn_user(httr::GET(base_url)) : 
  It looks like your username and/or password are incorrect.
Calls: source ... withVisible -> eval -> eval -> get_remote_version -> warn_user
Execution halted

I made sure to update the RInno package, and check if the token was working. It seems like some function is still trying to use login information.

Thanks!

@Dripdrop12
Copy link
Member

I just bit the bullet and bought the privilege to create private repos on Github. There was one line that was not working as expected. I think I just fixed it.

@sollano
Copy link
Author

sollano commented Sep 4, 2017

I just bit the bullet and bought the privilege to create private repos on Github. There was one line that was not working as expected. I think I just fixed it.

Oh man, sorry for the trouble. I'm still getting an error with the httr::GET(base_url) in the log. Which means that the function is still treating my repo as a public one, and getting 403. Really strange. Maybe I'm doing something wrong. Here's my code:

devtools::install_github("ficonsulting/RInno", ref = "develop")

require(RInno)

create_app(
  app_name     = "AppInventarioNativas",
  app_dir      = "app_folder",
  app_repo_url = "https://github.com/sollano/AppInventarioNativas",
  pkgs         = c("shiny", "DT", "formattable", "readxl", "plyr", "tidyr","dplyr", "ggplot2", "lazyeval", "ggdendro","ggthemes","xlsx"),
  app_icon     = "LAB_logo.ico",
  setup_icon   = "LAB_logo.ico",
  publisher    = "treelab ufvjm",
  pub_url      = "http://gorgens.wixsite.com/treelab",
  dir_out      = "exe_folder",
  info_before  = "info_before.txt",
 info_after    = "info_after.txt",
 auth_token   = [my-token]
)
compile_iss()

I can create a token for you to use, if you'd like.

@Dripdrop12
Copy link
Member

Nope. That was my fault. I forgot to pass the token down to the lower level function calls... Thank you for your persistent and detailed responses!

@sollano
Copy link
Author

sollano commented Sep 4, 2017

Nope. That was my fault. I forgot to pass the token down to the lower level function calls... Thank you for your persistent and detailed responses!

Yes, now it's working perfectly! Awesome.

Thank you, jon! I'm glad to help.

@Dripdrop12
Copy link
Member

Great working with you! I'm going to give you a shout out in the package news update ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants