shinyapps.io to AWS postgreSQL connection.

742 views
Skip to first unread message

thomas woolston

unread,
Apr 2, 2015, 2:58:19 PM4/2/15
to shinyap...@googlegroups.com
My shiny application connects just fine to my AWS postgreSQL instance from my local machine.  When deployed on shinyapps.io the dbConnect command times out with:   'dial tcp 127.0.0.1:43954: connection refused" and the program crashes.  I have had my administrator add the following IP address to AWS
54.204.37.78
54.204.29.251
54.204.36.75
54.204.34.9.

These are entries in the AWS authorization instances.   According to some prior posting here, I have even tried to load the older postgreSQL binaries  install.packages(RPostgreQSL, type= mac.binary).   No change.   Can still connect from my local machine but not from the deployed application.   I was reading that I might be required to make ssl keys on AWS and use a system() command in the R code on the shinyapp to get the shiny app to connect to AWS?   

My shinyapps.io log appears to show that my PostgreSQL package is working.

Library(RPostgreSQL)
 
m<- dbDriver("PostgreSQL")
print(dbGetInfo(m))

This displays an object that looks identical on the shiny apps.io deployment and the local machine.

con<- dbConnect(m, user = "user", 
password="password", host=  "xxx.xxx.us-east-1.rds.amazonaws.com" ,
port='5432'
dbname= 'dbname')

Crashes and displays the connection refused list above.  

Could somebody please help?   Is creating SSL keys on AWS and executing system() commands from the deployed shinyapps.io the right direction?  See



Andy Kipp

unread,
Apr 2, 2015, 3:46:30 PM4/2/15
to thomas woolston, shinyap...@googlegroups.com
Thomas,

Can you send the output of shinyapps::showLogs()?

Thanks
-Andy

--
You received this message because you are subscribed to the Google Groups "ShinyApps Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/d4f1a1e7-e2f8-4f01-868c-6da082ca2e3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Bond

unread,
May 4, 2015, 2:41:08 AM5/4/15
to shinyap...@googlegroups.com, twools...@gmail.com
Hi Andy,

I am having similar bugs as Thomas.

We need to white-listing the ip addresses shinyapp.io is using on cloud database server.

The display error message is as follows, (my ui.R and server.R are slightly different as I am using MySQL on Google SQL service, but the logic of bug is the same)

 Error in .local(drv, ...) : 
2015-05-04T06:32:19.831547+00:00 shinyapps[40315]:   Failed to connect to database: Error: Lost connection to MySQL server at 'reading initial communication packet', system error: 0
2015-05-04T06:32:19.831549+00:00 shinyapps[40315]: 

We are able to deploy them locally because we white-listed our local machine's ip address to cloud database.

Thanks for enlightening in advance.

Best,

James

Tareef Kawaf

unread,
May 4, 2015, 3:00:42 AM5/4/15
to James Bond, shinyap...@googlegroups.com, twools...@gmail.com

Here are the IP addresses you will want to whitelist.

54.204.29.251 

54.204.34.9

54.204.36.75

54.204.37.78


Hope this helps.
Tareef

James Bond

unread,
May 4, 2015, 3:51:14 AM5/4/15
to shinyap...@googlegroups.com, twools...@gmail.com, pid...@gmail.com
Hi Tareef,

Thanks a lot, it works, perfect.

Best,

James

Durga Sridharala

unread,
Nov 26, 2015, 6:32:31 AM11/26/15
to ShinyApps Users, pid...@gmail.com, twools...@gmail.com
I am facing similar issue with files , could you please help. Shiny server couldnt find my file path.

Log error shows: C:\Users\SRIDHDX\Documents\Durga\Durga\Shiny\data\IDSMODULEINFORMATION_1.csv' does not exist. Include one or more spaces to consider the input a system command.

Initially I tried with Oracle data base as that doesnt work I tried with csv files. this is also not working.

Tareef Kawaf

unread,
Nov 26, 2015, 7:47:49 AM11/26/15
to Durga Sridharala, ShinyApps Users, James Colmez, thomas woolston
This is a separate issue.  It looks like your application is referencing a file in your C: drive.  In order for your application to run on shinyapps.io, any files that i loads up NEED to be within the directory structure of your application and needs to be loaded with relative paths, not absolute paths.
Our company is out on vacation today and tomorrow so unfortunately we will have minimal ability to provide support during that time. 
I hope that gets you over the hump.

Best,
Tareef

Reply all
Reply to author
Forward
0 new messages