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

Is it possible to run a golem application on shiny-server? #936

Open
gioneves opened this issue Oct 17, 2022 · 5 comments
Open

Is it possible to run a golem application on shiny-server? #936

gioneves opened this issue Oct 17, 2022 · 5 comments

Comments

@gioneves
Copy link

gioneves commented Oct 17, 2022

I have a shiny app (golem) and I would like to put it on a shiny-server (locally).

golem::add_shinyserver_file()

Which creates an app.R file.

I downloaded the package with devtools::install_github() in other computer.

And I put the folder of this package inside srv/shiny-server/

Suppose my package name is mygolempackage, this is what appears when I run it http://192.000.0.000:3838/mygolempackage/:

Screenshot from 2022-10-17 18-47-07

When I run a conventional app (with .ui and .server files), it works normally.

But I would like to know if there is a possibility to serve other users through a packaged shiny (created with golem). I appreciate the support.

@ghost
Copy link

ghost commented Nov 3, 2022

golem::add_shinyserver_file() should add mygolempackage/app.R. It looks like you're missing that file.

@VincentGuyader
Copy link
Member

golem::add_shinyserver_file() should add mygolempackage/app.R. It looks like you're missing that file.

yes, the app.R file is missing in your server.

Regards

@VincentGuyader
Copy link
Member

do you manage to deploy your app ?

@ColinFay
Copy link
Member

ColinFay commented Dec 15, 2022

Hey,

> x <- tempdir()

> golem::create_golem(x, overwrite=TRUE)
[...Redacted]
> golem::add_shinyserver_file()
── Creating _disable_autoload.R ─────────────────
✔ CreatedAdding '^app\\.R$' to '.Rbuildignore'Adding '^rsconnect$' to '.Rbuildignore'Adding 'pkgload' to Imports field in DESCRIPTIONRefer to functions with `pkgload::fun()`File created at /private/var/folders/9w/zdlv83ws6csdjnfc5x819gtr0000gn/T/Rtmpk8FUoe/app.R
To deploy, run:rsconnect::deployApp()

• Note that you'll need to upload the whole package to Shiny Server
  • As you can see the app.R is created to inside the package.
> list.files(x)
 [1] "app.R"                                                                  
 [2] "DESCRIPTION"                                                            
 [3] "dev"                                                                    
 [5] "inst"                                                                   
 [7] "man"                                                                    
 [8] "NAMESPACE"                                                              
 [9] "R"  
  • The note does state that you'll need to upload the whole folder to your server (I agree though that the message could be made clearer)
• Note that you'll need to upload the whole package to Shiny Server
  • If you need to deploy after installing from remotes::install_github() or via a package manager, you'll need to create the app.R file yourself, with the following code mypkg::run_app() . This solution is documented here : https://engineering-shiny.org/deploy.html#rstudio-environments, but this should be documented in the vignette too.

Let me know if this helps :)

Colin

@gioneves
Copy link
Author

do you manage to deploy your app ?

I can not. I already inserted the app.R file and it doesn't work.

I can't leave the source code with the client, just the package. I put the app.R file in the package folder, but now another error appears:

An error has occurred
The application failed to start.

The application exited during initialization.

Thank you for your support.

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

No branches or pull requests

3 participants