Test R app via openCPU localy - r

I wrote an R package and now I want to provide let's say a small demo fronted as a webapplication. For this I already wrote a index.html file which I saved to the <pkgRoot>/inst/www/ folder. I also installed the opencpu package which works fine wehen I use it via the localhost:<portNum>/ocpu/test/ "Interface", where I already can see my Package and use the Ajax POST and GET requests in order to see the package is doing what it's ment to do.
But now im stuck in a sense that I do not know how to test my own app (index.html) localy.
localhost:<portNum>/ocpu/<pkgName>/www/index.html does not work.
As I understood it, the opencpu Comes with the Apache 2 and hence ist not neccessary to set up an additional webserver?
When I check the path to the installed package the www folder as well as the index.html seem to be exactly were they should be, as far as I understand it.
Do i somehow have to install the app via the
opencpu::install_apps("pkgName")
inside R? Becaue if I try to do this, it seems there is no way to install local apps but only apps hosted at github.
.... and I just want to test the app localy!
Realy happy for any suggestions

Just use
opencpu::ocpu_start_app("pkgName")
That should start an HTTP server in R and launch your browser.

Related

ACORE API, assistance with errors and deployment

I'm having trouble with setting up ACORE API's and then having them work on a website.
Background:
Azerothcore running 3.3.5 on a debian standalone server, this has the Database, Core files and runs both the world and auth server basically a standard setup that is shown in the how-to wiki.
I also have a standalone web server, on the same subnet, but it's a separate server running linux and normal web server stuff, this has a wordpress installation with azerothcore plugin for user signup etc.
I'm trying to add the player map (https://github.com/azerothcore/playermap) and the ACORE-API set of functions (server status, arenastats, BG que and wow statistics) (https://github.com/azerothcore/acore-api)
Problem:
I understand the acore-api must be run in a container (docker or whatever) on the server, which I have done and it binds to port 3000, I can then go to the local ip:3000 and it brings up this error. (all db's etc are connecting and soap is working)
error 404 when navigating to IP:3000
I do get a few errors when running NPM install seen here: I'm not sure if they would be causing any issues or not.
screenshot of NPM errors on install
But further that, when I put say 'serverstatus' on the webserver (separate server) and configure the config.ts file I can't seem to get anything to display.
I'm not sure what I'm doing wrong but is the same scenario for all of the different functions for the acore-api
How are these meant to be installed and function? I feel I'm missing a vital step.
Likewise, with PLAYERMAP I have edited the comm_conf.php and set the realmd_id, but when loading the page, I do get the map, but the uptime is missing and no players are shown?
Could someone assist if possible?
Seems like an issue with NodeJS version. Update your NodeJS to latest LTS version 16.13.0 (https://nodejs.org)

How to run a shiny app as a standalone application?

I've some shiny app and I want to execute and to make it standalone application (it will be awesome if it will open via chrome).
I can't upload the app to the Net and I want that also co-workers without R studio or R
will use this app.
because of the security company - I can't download any software except R packages.
I saw here a few solution, but all of them included any software download.
I have done some research on this issue. The commenters are basically correct: you need the R binaries in some way, either a portable R or an R server. But there are solutions that allow it to bundle those with your code and hide the details from your users.
On option is to wrap your app along with
a portable R into a container application like Electron. The electron-quick-start project tries this.
The RInno package provides functions to bundle your app and R portable into an installer app. Every user runs the installer on their system once which will install your app, the packages and the code. But in the end users may not see the difference to other apps. They get a link in the start menu and that's it. I did that successfully. But it did not work out of the box. I had to adjust the output manually in several places.
A second container solution works with docker. That is what ShinyProxy does. See also this blog.
The package shinyShortcut (I quote) "will produce an executable file that runs the shiny app directly in the user's default browser".
Important to note: I haven't tested most of them. From reviewing the solutions I often get the feeling that these solutions might make releases somewhat complicated because there are always manual steps involved.

Using RStudio to Make Pull Requests in Git

My enterprise has a Git repository. To make changes, I have to make changes in my forked repository and then make a pull request.
I primarily use RStudio, so I have enabled its integration with Git. I can make changes to my forked repository and then push, pull, sync, etc. The problem is that I still have an additional step of logging into GitHub and making a pull request for my forked repository. Is there a way of doing this from RStudio?
I too use RStudio for R development and I do not believe there is a way to do this. The reason is because this is more than just adding code to a branch, you're requesting a management feature to take place which is pulling part of your code into another branch of the code base. RStudio appears to be limited to pulling, syncing and committing. Likely you need to use a separate, more full featured GitHub client.
This could be done via the GitHub API, which could be executed from an R package using the httr or curl package, after which such a package could have an addin for RStudio, which would let you check everything using a nice Shiny app!
Now we only need to look for someone who wants to develop this… Can’t seem to find it (Jan 2022).

OpenCPU server root directory

What directory does the single-user OpenCPU server serve from, and if I have a webpage that uses OpenCPU JavaScript code, how do I make it run on my server? I want to avoid using CORS.
I've tried fooling around with .opencpu.conf, but no luck - there isn't anything there that specifies the server path, except for "appspaths", changing which doesn't affect anything.
Further, as a side question - has anybody attempted installing the OpenCPU cloud server on Arch, and is the process more or less straightforward?
Thanks, cheers.
You need to put your code into the inst dir of an R package and install that on your server. See one of the example apps which are live here: https://www.opencpu.org/apps.html

Opencpu and R-statistics

I am wanting to use OpenCpu to do statistical web-based apps.
BUT, the documentation I see on the web seems to be contradictory.
Just trying to get started is difficult for a newbie.
I hope someone knows how.
I have seen some posts here on stackoverflow, and I still see contradictions.
Note that I have used Rserve in java and Rpy2 in python, and these are wrappers to R-stats.
BUT on the website I see that they say that OpenCpu is an embedded engine using HTTP.
I wish to install this OpenCpu on my local Ubuntu machine.
So my question is:
(1)Does OpenCpu server contain some embedded version of R-statistics?
SO the download contains everything i need.
OR
(2)does one have to install R-statistics separately and the OpenCpu server separately,
so hence these are 2 separate applications that talk to one another over HTTP.
So you can see that I was not able to find this kind of fundamental starting knowledge on the web.
Doing apt-get install opencpu will automatically install R. Not because it is contained, but because it is declared as a dependency, so the package manager understands it needs R, apache, etc when it installs opencpu.

Resources