Is possible to deploy content from RStudio Server to Rsconnect server ?

Hi,

Simple question for begin, is it possible to deploy content from RStudio server to rsconnect server?

Parameters

rsconnect:

  • RStudio Connect v1.7.8-7
  • Build "1144ac9" with Available R Version: 3.6.1

rstudio server (Open Source)

  • 1.2.5019 (Elderflower)
  • R version 3.6.1 (2019-07-05) -- "Action of the Toes"

RStudio IDE:

  • Version 1.2.1335
  • Build 1379 (f1ac3452)

From RStudio IDE is possible to connect and publish

When i tried to login to rsconnect from desktop version everything works fine.
Via Tools -> Global Options -> Publishing I was able to login to rsconnect and deploy content.

Via R:

> library(rsconnect)
> rsconnect::addConnectServer('http://OUR_SERVER:3939', 'our_server')
> rsconnect::connectUser(server='our_server')
....8e/activate.
Waiting for authentication...
Account registered successfully:   (USERNAME)

Same ways not working on rstudio server

Via tools and console returned error HTTP 403,

  • ports on server and rsconnect are opened and was checked
> rsconnect::connectUser(server='our_server')
Error: HTTP 403
POST http://OUR_SERVER:3939/__api__/tokens

    <table class="mainTable">
        <tr>
            <td valign="top" class="icon">
                <img id="icon" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG4AAAAdCAYAAABL7VmUAAAKQWlDQ1BJQ0MgUHJvZmlsZQAASA2d...

Is there special configuration in rsconnect for accept server connection ?

Thanks for help

Hello @michalslovik! This is a fantastic question, and yes, it is possible to publish from RStudio Server to RStudio Connect. In fact, it works just the same through the IDE with click-button publishing and the like.

The trick is that networking is a bit different between RStudio Server and RStudio Connect because three computers are now involved (instead of two). Can you say a bit more about how / where RStudio Server and RStudio Connect are installed? Are they installed on separate servers? Inside of a data center?

The requirement that is very important to validate here:

RStudio Connect needs to be reachable at the same URL from both RStudio Server and from your local desktop in order for publishing to work as expected

If you execute the following from your terminal in RStudio Server, what output do you get?

curl -i -L http://OUR_SERVER:3939

They are installed on separate servers.

RStudio server is localed on VM (Ubuntu 18.04) and rsconnect server is localed on another VM (Ubuntu 16.04).

Logs from RStudio Server:

 $ curl -i -L http://OUR_SERVER:3939
HTTP/1.1 307 Temporary Redirect
Content-Type: text/html; charset=utf-8
Location: /connect/
Server: RStudio Connect v1.7.8-7
Set-Cookie: rscid=MTU3NjA3NjM1MXxEdi1CQkFFQ180SUFBUkFCRUFBQU52LUNBQU1HYzNSeWFXNW5EQVlBQkVkVlNVUVNZMjl1Ym1WamRDOXpkRzl5WlM1SFZVbEVfNE1HQVFFRVIxVkpSQUhfaEFBQUFCRF9oUVlCQVFSVlZVbEVBZi1HQUFBQVZmLUVFZ0FROGRlUG9UeGlUQktOQXMtSDJ0SEM0QVp6ZEhKcGJtY01DUUFIWTNKbFlYUmxaQVZwYm5RMk5BUUdBUHk3NGdoLUJuTjBjbWx1Wnd3SkFBZHlaV1p5WlhOb0JXbHVkRFkwQkFZQV9MdmlDSDQ9fJz7byAhqzf6wziZeI0JEZqDHXETShSbKIjeSjqssUw9; Path=/; Expires=Thu, 12 Dec 2019 14:59:11 GMT; Max-Age=86400; HttpOnly
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Date: Wed, 11 Dec 2019 14:59:11 GMT
Content-Length: 45

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: must-revalidate, no-cache, max-age=0
Content-Length: 2413
Content-Type: text/html; charset=utf-8
Last-Modified: Wed, 11 Dec 2019 14:15:07 GMT
Server: RStudio Connect v1.7.8-7
Set-Cookie: rscid=MTU3NjA3NjM1MXxEdi1CQkFFQ180SUFBUkFCRUFBQU52LUNBQU1HYzNSeWFXNW5EQVlBQkVkVlNVUVNZMjl1Ym1WamRDOXpkRzl5WlM1SFZVbEVfNE1HQVFFRVIxVkpSQUhfaEFBQUFCRF9oUVlCQVFSVlZVbEVBZi1HQUFBQVZmLUVFZ0FRcXhQeUZzR09Rc2VhZ0ROU0doU0dWUVp6ZEhKcGJtY01DUUFIWTNKbFlYUmxaQVZwYm5RMk5BUUdBUHk3NGdoLUJuTjBjbWx1Wnd3SkFBZHlaV1p5WlhOb0JXbHVkRFkwQkFZQV9MdmlDSDQ9fG8yToQpBmOjFTGQLQPEpoTgJHq0_jh7WyUZu0M3QTMS; Path=/; Expires=Thu, 12 Dec 2019 14:59:11 GMT; Max-Age=86400; HttpOnly
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Date: Wed, 11 Dec 2019 14:59:11 GMT

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>RStudio Connect</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
    <meta name="apple-mobile-web-app-capable" content="yes" />

    <!--[if lt IE 9]>
        <script src="assets/javascripts/ie.min.js"></script>
        <![endif]-->
    <!-- jQuery  -->

    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    <script async src="out/dashboard.bundle.js"></script>
    <style>#initialSpinner .dot{width:40%;height:40%;border-radius:50%;position:absolute;-webkit-animation:initialProgressPulse 2s infinite ease-in-out;animation:initialProgressPulse 2s infinite ease-in-out}#initialSpinner .dot.one{top:0;left:30%;background-color:#75aadb}#initialSpinner .dot.two{top:30%;left:0;-webkit-animation-delay:-1.5s;animation-delay:-1.5s;background-color:#75aadb}#initialSpinner .dot.three{bottom:0;left:30%;-webkit-animation-delay:-1s;animation-delay:-1s;background-color:#75aadb}#initialSpinner .dot.four{top:30%;right:0;-webkit-animation-delay:-.5s;animation-delay:-.5s;background-color:#75aadb}#initialSpinner{display:block;width:100%;height:100%;position:relative;-webkit-animation:rotate 2s infinite linear;animation:rotate 2s infinite linear}@-webkit-keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate{100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-webkit-keyframes initialProgressPulse{0%,100%{-webkit-transform:scale(.1);transform:scale(.1);opacity:.1}50%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}@keyframes initialProgressPulse{0%,100%{-webkit-transform:scale(.1);transform:scale(.1);opacity:.1}50%{-webkit-transform:scale(1);transform:scale(1);opacity:1}}#initialSpinnerWrapper{margin-left:auto;margin-right:auto;height:150px;width:150px;margin-top:150px}</style>
  </head>

  <body>
    <app-layout>
      <standard-page>
        <ui-view></ui-view>
      </standard-page>
    </app-layout>

                <div id="initialSpinnerWrapper" ng-if="false">
                        <div id="initialSpinner">
                                <div class="dot one"></div>
                                <div class="dot two"></div>
                                <div class="dot three"></div>
                                <div class="dot four"></div>
                        </div>
                </div>

    <div class="taskui-global" taskui="taskui"></div>
  </body>
</html>

Interesting!! That is the behavior we would expect to see... Hm...

How about this, can you try to "Enable verbose deployment logging"?

You can turn on verbose logging by going to Tools -> Global Options -> Publishing and selecting "Show diagnostic information when publishing".

It also might be worth checking the version of rsconnect that you have installed on the server. The latest version on CRAN is 0.8.15, and the dev version is presently 0.8.15-9000:

packageVersion("rsconnect")

You can also set the following settings inside of your R console (again on the server):

options(rsconnect.http.verbose = TRUE)
options(rsconnect.http.trace.json = TRUE)

Then try to connect your account in the RStudio Server IDE by clicking the publish button in the IDE?

image

If you can share the verbose messaging you get in the console afterwards, that would be helpful!

It's also worth noting (and I should have mentioned this earlier). This is definitely covered under our professional support for RStudio Connect, so you can also send an email to our support team / open a ticket with the information that I requested and we can handle through that channel as well!

The latest version of rsconnect is 0.8.15:

> library(rsconnect)
> packageVersion("rsconnect")
[1] ‘0.8.15’

When is enabled logging:

options(rsconnect.http.verbose = TRUE)
options(rsconnect.http.trace.json = TRUE)

  • Trying 172.22.1.4...
  • TCP_NODELAY set
  • Connected to PROXY_GATE.com (IP) port 8080 (#0)

GET http://OUR_RSCONNECT.com:3939/api/server_settings HTTP/1.1
Host: OUR_RSCONNECT.com:3939
User-Agent: rsconnect/0.8.15
Accept: /
Accept-Encoding: deflate, gzip
Proxy-Connection: Keep-Alive
X-Auth-Token: anonymous-access

< HTTP/1.1 403 Forbidden
< Server: squid
< Mime-Version: 1.0
< Date: Thu, 12 Dec 2019 07:12:17 GMT
< Content-Type: text/html;charset=utf-8
< Content-Length: 20299
< X-Squid-Error: ERR_BLOCKED_PORT 0
< X-Cache: MISS from swre-prx001-ch-rum-5
< Via: 1.1 swre-prx001-ch-rum-5 (squid)
< Connection: keep-alive
<

  • Connection #0 to host PROXY_GATE.com left intact

And after click on publish, it ask where i would like to publish (RPubs or RStudio Connect). I click on RStudio Connect -> Publish finished document only ->
Connect Publishing after that ask for RStudio Connect Account where i enter servername:3939 and result is:

verifying_account

The latest version on CRAN is 0.8.15:

> library(rsconnect)
> packageVersion("rsconnect")
[1] ‘0.8.15’

When is enabled logging:

options(rsconnect.http.verbose = TRUE)
options(rsconnect.http.trace.json = TRUE)

  • Trying 172.22.1.4...
  • TCP_NODELAY set
  • Connected to PROXY_GATE.com (IP) port 8080 (#0)

GET http://OUR_RSCONNECT.com:3939/api/server_settings HTTP/1.1
Host: OUR_RSCONNECT.com:3939
User-Agent: rsconnect/0.8.15
Accept: /
Accept-Encoding: deflate, gzip
Proxy-Connection: Keep-Alive
X-Auth-Token: anonymous-access

< HTTP/1.1 403 Forbidden
< Server: squid
< Mime-Version: 1.0
< Date: Thu, 12 Dec 2019 07:12:17 GMT
< Content-Type: text/html;charset=utf-8
< Content-Length: 20299
< X-Squid-Error: ERR_BLOCKED_PORT 0
< X-Cache: MISS from swre-prx001-ch-rum-5
< Via: 1.1 swre-prx001-ch-rum-5 (squid)
< Connection: keep-alive
<

  • Connection #0 to host PROXY_GATE.com left intact

And after click on publish, it ask where i would like to publish (RPubs or RStudio Connect). I click on RStudio Connect -> Publish finished document only ->
Connect Publishing after that ask for RStudio Connect Account where i enter servername:3939 and result is:

verifying_account

There we go!! This tells us a great deal:

< HTTP/1.1 403 Forbidden
< Server: squid
< Mime-Version: 1.0
< Date: Thu, 12 Dec 2019 07:12:17 GMT
< Content-Type: text/html;charset=utf-8
< Content-Length: 20299
< X-Squid-Error: ERR_BLOCKED_PORT 0
< X-Cache: MISS from swre-prx001-ch-rum-5
< Via: 1.1 swre-prx001-ch-rum-5 (squid)
< Connection: keep-alive

It looks like you have a squid proxy set up somewhere? Can you share the output of Sys.getenv() (be sure to redact any secrets stored therein).

I suspect you have an HTTP_PROXY or HTTPS_PROXY (or lowercase variants) set on the RStudio Server Pro server, and so outbound traffic (to RStudio Connect) is trying to go through the proxy and getting killed on accounts of accessing a port that is "disallowed."

1 Like

Yes actually the proxy was a problem:

> Sys.getenv() 
_R_CHECK_COMPILATION_FLAGS_KNOWN_
                                 -Wformat -Werror=format-security -Wdate-time
CLICOLOR_FORCE                   1
DISPLAY                          :0
EDITOR                           vi
GIT_ASKPASS                      rpostback-askpass
HOME                             /home/username
http_proxy                       http://GATEWAY:8080
https_proxy                      http://GATEWAY:8080
...

After disabling with
Sys.unsetenv("http_proxy")
Sys.unsetenv("https_proxy")

I was able to connect and publish.

1 Like

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