Put the application on another web server.

Hello,

I created an APP in shiny and deployed it to shinyapps.io (https://jovanisouza5.shinyapps.io/shiny/).

However I would like to put on another web server? What are the possibilities? Will it export the model as api using some package?

I left the APP below if it helps!

library(shiny)
library(ggplot2)

ui <- pageWithSidebar(
    headerPanel("Example"),
    sidebarPanel(
        radioButtons("color", "Pick Color", c("Pink", "Green", "Blue")),
        selectInput("shape", "Select Shape:", c("Circle", "Triangle"))
    ),
    mainPanel(
        fluidRow(column(width = 6,
                        h4("Click plot to add points"),
                        actionButton("rem_point", "Remove Last Point"),
                        plotOutput("plot1", click = "plot_click")),
                 column(width = 6,
                        h4("Table of points on plot"),
                        tableOutput("table")))
    )
)

server = function(input, output){

    ## 1. set up reactive dataframe ##
    values <- reactiveValues()
    values$DT <- data.frame(x = numeric(),
                            y = numeric(),
                            color = factor(),
                            shape = factor())

    ## 2. Create a plot ##
    output$plot1 = renderPlot({
       ggplot(values$DT, aes(x = x, y = y)) +
            geom_point(aes(color = color,
                           shape = shape), size = 5) +
            lims(x = c(0, 100), y = c(0, 100)) +
            theme(legend.position = "bottom") +
            # include so that colors don't change as more color/shape chosen
            scale_color_discrete(drop = FALSE) +
            scale_shape_discrete(drop = FALSE)
    })

    ## 3. add new row to reactive dataframe upon clicking plot ##
    observeEvent(input$plot_click, {
        # each input is a factor so levels are consistent for plotting characteristics
        add_row <- data.frame(x = input$plot_click$x,
                              y = input$plot_click$y,
                              color = factor(input$color, levels = c("Pink", "Green", "Blue")),
                              shape = factor(input$shape, levels = c("Circle", "Triangle")))
        # add row to the data.frame
        values$DT <- rbind(values$DT, add_row)
    })

    ## 4. remove row on actionButton click ##
    observeEvent(input$rem_point, {
        rem_row <- values$DT[-nrow(values$DT), ]
        values$DT <- rem_row
    })

    ## 5. render a table of the growing dataframe ##
    output$table <- renderTable({
        values$DT
    })
}

shinyApp(ui, server)

hi @Jovani , what are your reasons to put your app on another web server?
Basically, the three options you have to deploy an app are described on here

Hi, thanks for reply!

Actually, I just inserted a simple example, I have a much more elaborate algorithm. I would like to try for a simple example before moving on to the algorithm.

There are two main reasons I want to change:

  • I would like to change the site name, ie instead of getting shinyapps.io, I would like an algorithm name, eg www.algorithmjovani.com

  • When I use a very large database in the web version of the algorithm, it takes too long to run, moreover it crashes if I use shinyapps.io version. If I use this same database by RStudio, I don't have this problem.

Ah I see, good to know that your actual app is quite different.

Did you investigate why the app crashes on shinyapps.io? Maybe you need to change some settings or your app requires a plan/subscription that offers more resources. You could automatically forward users that visit your site to shinyapps.io

If you want to move away from shinyapps.io, you could install shiny server on a server in the cloud and connect it to the domain you want. It gives you the most flexibility but it requires more effort as well to set it up. See here an example of how to setup shiny server on digital ocean.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.