ctmm-initiative / ctmmweb

Web app for analyzing animal tracking data, built upon ctmm R package
http://biology.umd.edu/movement.html
GNU General Public License v3.0
34 stars 22 forks source link

installer for local installation #76

Closed xhdong-umd closed 5 years ago

xhdong-umd commented 5 years ago

Although we have instructions in github readme, some users may not read/realize or know how to install the package locally.

I'll edit the readme to make it as short as possible, make the local install option more obvious.

I'll also explore whether we can create a installer package/installer.

There may be also some existing tool/package for this.

xhdong-umd commented 5 years ago

I edited the readme to make it simpler.

Hope user will read it and get the idea. It's not in master branch for now because I still need to work on best option on release and installer.

NoonanM commented 5 years ago

Another piece that might be useful is an "updater".

Assuming that everything has already been installed, for mac it could be a simple apple script packaged as a downloadable app e.g.,

tell application "R" activate cmd "devtools::install_github("ctmm-initiative/ctmmweb")" end tell

xhdong-umd commented 5 years ago

Yes, actually everything can be done from script (including download a installer and run it), and it'll be easy to maintain and deploy. However I'm afraid windows user might not be familiar with download a script and run it. They are more comfortable with installers.

For windows my current plan is:

I'll first focus on windows, then look at Mac.

NoonanM commented 5 years ago

Ok, great. Sounds like you've thought of all the pieces then.

Also, yes, windows is probably the place to start. My guess is that it has the largest base of users unfamiliar with command line.

chfleming commented 5 years ago

I also know with Windows, installing a new version of R does not automatically uninstall old versions of R. We will need to automate that as well.

I thought the windows R installer had the option of modifying the PATH, but maybe it isn't default?

xhdong-umd commented 5 years ago

I'll try to uninstall old version.

Windows installer will not touch PATH(it's tricky to work with path too, with permission limits sometimes user can only modify user environment but not system environment), only add path to registry by default(I'm not totally sure if it's the default, I need to check later in my home pc). If user deselected that option, we will have no way to know about the path. I'm just hoping most users will not change that option.

https://cran.r-project.org/bin/windows/base/rw-FAQ.html#Rcmd-is-not-found-in-my-PATH_0021

The R installer does not put Rcmd.exe (nor any other R executable) on your PATH.

https://cran.r-project.org/bin/windows/base/rw-FAQ.html#Does-R-use-the-Registry_003f

When you run the R installer, there are options (under ‘Select Additional Tasks’) to ‘Save version number in registry’ and (for Administrator installs) ‘Associate R with .RData files’.

xhdong-umd commented 5 years ago

Do you think it's a good idea to have a button inside app to update itself?

The idea lcase is to update self and launch new version again, but that requires too much background handling. For now I can make it to quit the app, run installation code automatically (I cannot make it run app automatically afterwards because background process will cause problems). It will be same with clicking a update app shortcut with our installer, just run it from inside the app.

chfleming commented 5 years ago

I think that's a good idea. Also, if the button/option flagged in some way when an update was available.

xhdong-umd commented 5 years ago

We can let the app check new releases in each run, this is easy but could be too slow(and if there is no internet it has to be timeout so wait for some time).

Ideally it should only check every month or so, then I need to save last checked time in disk somewhere. This can be done if I include some package dataset in installation, and updating it with app running.

The whole process need to be done properly and lots of things need to be considered.

xhdong-umd commented 5 years ago

I decided to use the link from "previous versions" page. The latest version can still be found from this folder, but it should be still valid even after new version is out.

xhdong-umd commented 5 years ago

Making the installer to detect R path is really not easy. First I tried to use batch file in windows, then I realized the better option is for the installer to detect path. Innosetup support Pascal script which should have the capability, but I need to learn the syntax and usage of this language to

  1. detect path in registry
  2. pop up a dialog ask to user to manually input if no path is detected
  3. create shortcuts with path

Right now I'm having problems with syntax...

@jmcalabrese @chfleming @NoonanM I'm not sure if this can be done before course, maybe I should test with ctmm (I have done some basic tests which seemed OK), and add the self update feature first, then make a release version. After that I'll continue working on the installer.

I have experimented with the alternative package installation solution which is hosting the package as a repo, so there is no need to use devtools.

jmcalabrese commented 5 years ago

A stable release for the course is more important than the installer, so do the release first, and work on the installer later.

xhdong-umd commented 5 years ago

The self update method I tried can only work with install.package call (the official releases can be hosted in customized repo and can be installed with install.package) but not with devtools::install_github(which is used to install latest development version).

It's tricky because the app need to quit itself, schedule a update. devtools seemed interfere with the process more and prevented a clean exit (it worked in a simple test app but not in the actual webapp).

I'm wondering whether this is still useful if it can only install release version, and I still need to put a lot of effort in update checking, update schedule, UI design etc.

xhdong-umd commented 5 years ago

I updated the project readme to make it very simple and clear. I also rewrote the installation page, hope its easy to follow for most users.

screen shot 2019-02-07 at 4 27 51 pm

Package version updated to 0.2.3 to match ctmm 0.5.3. I intend to always match the last digit for the tested CRAN version. I also updated NEWS, hosted app. I will make the release tomorrow when there is nothing to change.

xhdong-umd commented 5 years ago

After spending one whole day on the installer issue, I finally made a working installer.

@jmcalabrese @chfleming @NoonanM You can download the ctmmwebsetup.exe from this page

The installer will download R installer and run it first, then detect R path, modify Path variable, install ctmmweb package (it may need install quite some in first time), and place a shortcut in start menu. User can start the app from start menu later. There is also batch files in installed folder for updating github version. The program can be uninstalled properly.

There are some limits:

NoonanM commented 5 years ago

I can't test it on my mac, but sounds good.

xhdong-umd commented 5 years ago

Maybe I can make the R installer part optional properly. I'll work on it later with my windows pc.

xhdong-umd commented 5 years ago

I finally made it work with the better design. The installer is updated.

Interestingly, I found the app start and run much slower in my old PC. It was not too slow running other programs. Not sure if it's R or Shiny's limitations.

xhdong-umd commented 5 years ago

I updated the installer:

xhdong-umd commented 5 years ago

Next I will add some check on the app to check updates every 1-2 months.

xhdong-umd commented 5 years ago

I added code to check new release every 60 days.

New version found, please update the package. Windows user can run the update app link from start menu.

NoonanM commented 5 years ago

I was working with a user who installed the package using the installer. It ran through to completion, they used all of the default settings, but the desktop icon doesn't do anything. A command prompt window opens, but then closes before running the lines to open the app.

I'm not sure how to better explain the issue.

xhdong-umd commented 5 years ago

We need to first find out the exact error message. The icon just point to a .bat file in installed folder, so just start windows command line prompt in that folder and run the bat file in command line, that should make it possible to see the error.

My guess is some path or registry problems not working as expected.

NoonanM commented 5 years ago

After restarting their computer, the app icon no functions properly. No idea why it was not working previously...