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

Spaces fixes #165

Merged
merged 13 commits into from
Mar 21, 2019
Merged

Spaces fixes #165

merged 13 commits into from
Mar 21, 2019

Conversation

amoeba
Copy link
Contributor

@amoeba amoeba commented Aug 4, 2018

Kinda-grabbag-of-a-PR here:

aws.s3 got some fixes, not sure if they're on CRAN yet, but now things that broke now work!

  • space_create works and is now re-enabled
  • spaces_object_put works w/ multipart
  • spaces_object_delete works now and is now re-enabled

Also added:

Fixes #163

More to come as I make time!

@amoeba
Copy link
Contributor Author

amoeba commented Aug 5, 2018

Just added space_location and a small fix I missed from R CMD CHECK.

@amoeba
Copy link
Contributor Author

amoeba commented Aug 5, 2018

Add documentation page at ?spaces_info. Is that the kind of thing you were looking for in #150?

@sckott sckott added this to the v0.7 milestone Aug 5, 2018
@sckott
Copy link
Collaborator

sckott commented Aug 5, 2018

Looking good.

Add documentation page at ?spaces_info. Is that the kind of thing you were looking for in #150?

Yeah i think so, looks good. We can see what users are confused by and add more details later.

Are there other things you're adding here?

@amoeba
Copy link
Contributor Author

amoeba commented Aug 5, 2018

All good now! Thanks.

@sckott
Copy link
Collaborator

sckott commented Aug 6, 2018

@amoeba i can't get space_create() to work. I pulled your branch down locally, then devtools::load_all(), I had a access key and secret key and then set the region to nyc3, then did

space_create("new_space_name", config=httr::verbose())
-> PUT /new_space_name/ HTTP/1.1
-> Host: nyc3.digitaloceanspaces.com
-> User-Agent: libcurl/7.54.0 r-curl/3.2 httr/1.3.1
-> Accept-Encoding: gzip, deflate
-> Accept: application/json, text/xml, application/xml, */*
-> Content-Length: 0
->
<- HTTP/1.1 400 Bad Request
<- Date: Mon, 06 Aug 2018 23:46:23 GMT
<- Content-Length: 153
<- Content-Type: text/plain; charset=utf-8
<-

with some headers stripped out for brevity.

so i'm getting a 400 client error. Does it work for you?

@amoeba
Copy link
Contributor Author

amoeba commented Aug 7, 2018

Did you build a copy of aws.s3 from the latest on the master branch or are you using the latest CRAN release?

@sckott
Copy link
Collaborator

sckott commented Aug 7, 2018

used latest from github 0.3.19

@amoeba
Copy link
Contributor Author

amoeba commented Aug 7, 2018

Okay, thanks for testing this out. I'll take a look in the AM and see if I was just hallucinating.

@sckott
Copy link
Collaborator

sckott commented Aug 7, 2018

thanks

@amoeba
Copy link
Contributor Author

amoeba commented Aug 7, 2018

I had a sec just now to test. Works for me. Our implementation doesn't catch any errors aws.s3 gets into so it's a bit of a pain and could use some work. I wonder what's different between our approaches. Here's mine:

> library(analogsea)
> Sys.setenv("DO_SPACES_REGION"="nyc3",
+            "DO_SPACES_ACCESS_KEY"="...",
+            "DO_SPACES_SECRET_KEY"="...")
> # List my spaces
> spaces()
named list()
> space_create("test-for-scott")
New space test-for-scott created successfully
Session Info
> devtools::session_info()
Session info -----------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.1 (2018-07-02)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.2.723)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/Juneau              
 date     2018-08-06                  

Packages ---------------------------------------------------------------------------------
 package       * version    date       source                         
 analogsea     * 0.6.5.9110 2018-08-07 local                          
 aws.s3          0.3.19     2018-08-07 Github (cloudyr/aws.s3@874f6a7)
 aws.signature   0.4.4      2018-07-27 CRAN (R 3.5.0)                 
 base          * 3.5.1      2018-07-05 local                          
 base64enc       0.1-3      2015-07-28 CRAN (R 3.5.0)                 
 compiler        3.5.1      2018-07-05 local                          
 curl            3.2        2018-03-28 CRAN (R 3.5.0)                 
 datasets      * 3.5.1      2018-07-05 local                          
 devtools        1.13.5     2018-02-18 CRAN (R 3.5.0)                 
 digest          0.6.15     2018-01-28 CRAN (R 3.5.0)                 
 graphics      * 3.5.1      2018-07-05 local                          
 grDevices     * 3.5.1      2018-07-05 local                          
 httr            1.3.1      2017-08-20 CRAN (R 3.5.0)                 
 jsonlite        1.5        2017-06-01 CRAN (R 3.5.0)                 
 magrittr        1.5        2014-11-22 CRAN (R 3.5.0)                 
 memoise         1.1.0      2017-04-21 CRAN (R 3.5.0)                 
 methods       * 3.5.1      2018-07-05 local                          
 mime            0.5        2016-07-07 CRAN (R 3.5.0)                 
 R6              2.2.2      2017-06-17 CRAN (R 3.5.0)                 
 Rcpp            0.12.18    2018-07-23 CRAN (R 3.5.0)                 
 stats         * 3.5.1      2018-07-05 local                          
 tools           3.5.1      2018-07-05 local                          
 utils         * 3.5.1      2018-07-05 local                          
 withr           2.1.2      2018-03-15 CRAN (R 3.5.0)                 
 xml2            1.2.0      2018-01-24 CRAN (R 3.5.0)                 
 yaml            2.2.0      2018-07-25 cran (@2.2.0)
 collate  en_US.UTF-8                 
 tz       America/Juneau              
 date     2018-08-06                  

Packages ---------------------------------------------------------------------------------
 package       * version    date       source        
 analogsea     * 0.6.5.9110 2018-08-07 local         
 aws.s3          0.3.19     2018-08-07 local         
 aws.signature   0.4.1      2018-04-09 CRAN (R 3.5.0)
 base          * 3.5.1      2018-07-05 local         
 base64enc       0.1-3      2015-07-28 CRAN (R 3.5.0)
 compiler        3.5.1      2018-07-05 local         
 curl            3.2        2018-03-28 CRAN (R 3.5.0)
 datasets      * 3.5.1      2018-07-05 local         
 devtools        1.13.5     2018-02-18 CRAN (R 3.5.0)
 digest          0.6.15     2018-01-28 CRAN (R 3.5.0)
 graphics      * 3.5.1      2018-07-05 local         
 grDevices     * 3.5.1      2018-07-05 local         
 httr            1.3.1      2017-08-20 CRAN (R 3.5.0)
 jsonlite        1.5        2017-06-01 CRAN (R 3.5.0)
 magrittr        1.5        2014-11-22 CRAN (R 3.5.0)
 memoise         1.1.0      2017-04-21 CRAN (R 3.5.0)
 methods       * 3.5.1      2018-07-05 local         
 mime            0.5        2016-07-07 CRAN (R 3.5.0)
 R6              2.2.2      2017-06-17 CRAN (R 3.5.0)
 Rcpp            0.12.17    2018-05-18 CRAN (R 3.5.0)
 stats         * 3.5.1      2018-07-05 local         
 tools           3.5.1      2018-07-05 local         
 utils         * 3.5.1      2018-07-05 local         
 withr           2.1.2      2018-03-15 CRAN (R 3.5.0)
 xml2            1.2.0      2018-01-24 CRAN (R 3.5.0)
 yaml            2.2.0      2018-07-25 cran (@2.2.0)

And the space I made shows up on the website just fine. Our our versions of aws.s3 and aws.signature the same?

@sckott
Copy link
Collaborator

sckott commented Aug 7, 2018

will check, thanks

@sckott
Copy link
Collaborator

sckott commented Aug 7, 2018

same versions
Packages -------------
 package       * version    date       source
 .py             0.0.16     <NA>       local
 analogsea     * 0.6.5.9110 <NA>       local
 aws.s3          0.3.19     2018-08-06 Github (cloudyr/aws.s3@874f6a7)
 aws.signature   0.4.4      2018-07-27 CRAN (R 3.5.1)
 base          * 3.5.1      2018-07-19 local
 base64enc       0.1-3      2015-07-28 CRAN (R 3.5.0)
 commonmark      1.5        2018-04-28 CRAN (R 3.5.0)
 compiler        3.5.1      2018-07-19 local
 curl            3.2        2018-03-28 CRAN (R 3.5.0)
 datasets      * 3.5.1      2018-07-19 local
 devtools        1.13.6     2018-06-27 CRAN (R 3.5.0)
 digest          0.6.15     2018-01-28 CRAN (R 3.5.0)
 graphics      * 3.5.1      2018-07-19 local
 grDevices     * 3.5.1      2018-07-19 local
 httr            1.3.1      2017-08-20 CRAN (R 3.5.0)
 jsonlite        1.5        2017-06-01 CRAN (R 3.5.0)
 magrittr        1.5        2014-11-22 CRAN (R 3.5.0)
 memoise         1.1.0      2017-04-21 CRAN (R 3.5.0)
 methods       * 3.5.1      2018-07-19 local
 R6              2.2.2      2017-06-17 CRAN (R 3.5.0)
 Rcpp            0.12.18    2018-07-23 CRAN (R 3.5.1)
 rlang           0.2.1      2018-05-30 CRAN (R 3.5.0)
 roxygen2        6.1.0      2018-07-27 CRAN (R 3.5.0)
 rstudioapi      0.7        2017-09-07 CRAN (R 3.5.0)
 rtichoke        0.2.1      <NA>       local
 ssh             0.2        2018-06-04 CRAN (R 3.5.0)
 stats         * 3.5.1      2018-07-19 local
 stringi         1.2.4      2018-07-20 CRAN (R 3.5.0)
 stringr         1.3.1      2018-05-10 CRAN (R 3.5.0)
 testthat      * 2.0.0      2017-12-13 CRAN (R 3.5.0)
 tools           3.5.1      2018-07-19 local
 utils         * 3.5.1      2018-07-19 local
 withr           2.1.2      2018-03-15 CRAN (R 3.5.0)
 xml2            1.2.0      2018-01-24 CRAN (R 3.5.0)
 yaml            2.2.0      2018-07-25 CRAN (R 3.5.1)

Still not workfing for me, can you do space_create() with config=httr::verbose() so I can see the curl details? I'm getting a 400 but because aws.s3 just returns NULL on an error and doesn't pass on the response body I can't see what the message is, a downside of depending on this external pkg

@amoeba
Copy link
Contributor Author

amoeba commented Aug 7, 2018

Here's the doubly-verbose output:

> space_create("test-for-scott", config=httr::verbose(), verbose = TRUE)
Checking for credentials in user-supplied values
Using user-supplied value for AWS Access Key ID
Using user-supplied value for AWS Secret Access Key
Using user-supplied value for AWS Region ('nyc3')
Non-AWS base URL requested.
S3 Request URL: https://nyc3.digitaloceanspaces.com/test-for-scott/
Executing request with AWS credentials
Checking for credentials in user-supplied values
Using user-supplied value for AWS Access Key ID
Using user-supplied value for AWS Secret Access Key
Using user-supplied value for AWS Region ('nyc3')
Checking for credentials in user-supplied values
Using user-supplied value for AWS Secret Access Key
Using user-supplied value for AWS Region ('nyc3')
-> PUT /test-for-scott/ HTTP/1.1
-> Host: nyc3.digitaloceanspaces.com
-> User-Agent: libcurl/7.54.0 r-curl/3.2 httr/1.3.1
-> Accept-Encoding: gzip, deflate
-> Accept: application/json, text/xml, application/xml, */*
-> x-amz-acl: private
-> x-amz-date: 20180807T201511Z
-> x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
-> Authorization: AWS4-HMAC-SHA256 Credential=P4UB7DRO2X7VX2UV47LN/20180807/nyc3/s3/aws4_request, SignedHeaders=host;x-amz-acl;x-amz-date, Signature=85381e20229d9359ad4361b2b3929074c1cc52ea86e269d7c17af627dc772729
-> Content-Length: 0
-> 
<- HTTP/1.1 200 OK
<- Date: Tue, 07 Aug 2018 20:15:11 GMT
<- Content-Length: 0
<- 
Parsing AWS API response
Success: (200) OK
New space test-for-scott created successfully

I've found debugging by throwing browser() statements in s3HTTP which does most of the work. I'm scratching my head trying to think how I can help debug further.

@sckott sckott added the spaces label Dec 19, 2018
@sckott
Copy link
Collaborator

sckott commented Mar 21, 2019

hugh, seems that I was running into invalid regions

https://www.digitalocean.com/docs/platform/availability-matrix/#product-availability-by-datacenter-region suggests nyc3 is not available, with the following avail: ams3, sfo2, sgp1

i imagine we should change the default to one of those 3?

@amoeba
Copy link
Contributor Author

amoeba commented Mar 21, 2019

i imagine we should change the default to one of those 3?

I think this is just due to today's spaces outage, and I think it might fix itself. IIRC nyc3 was the first and only availability region and I haven't ehard anything that indicates it's going away.
Screen Shot 2019-03-20 at 4 16 33 PM

Incident details: https://status.digitalocean.com/incidents/bbyt03t1vm88

I'll do some digging.

@sckott
Copy link
Collaborator

sckott commented Mar 21, 2019

hmm, if that's right that nyc3 is just out temporarily, then I guess I don't know why it was failing on my end before. Anyway, seems to be working now

@sckott
Copy link
Collaborator

sckott commented Mar 21, 2019

i can work on #150 and then I think we're very close to getting this off to cran

@amoeba
Copy link
Contributor Author

amoeba commented Mar 21, 2019

Sounds great, let me know if you want a hand or a second set of eyes.

@sckott sckott merged commit 59ad079 into pachadotdev:master Mar 21, 2019
@sckott sckott modified the milestones: v0.7, v0.8 Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot change "spaces_base" variable, spaces different region support
2 participants