switch image.rb to google storage via fog library#9807
Conversation
| has_attached_file :photo, styles: { thumb: '200x150>', medium: '500x375>', large: '800x600>' }, | ||
| :fog_credentials => { :provider => 'Google', | ||
| :google_storage_access_key_id => ENV["GOOGLE_STORAGE_KEY"], | ||
| :google_storage_secret_access_key => ENV["GOOGLE_STORAGE_SECRET"]} |
Codecov Report
@@ Coverage Diff @@
## main #9807 +/- ##
==========================================
- Coverage 82.26% 79.63% -2.64%
==========================================
Files 98 98
Lines 5960 5980 +20
==========================================
- Hits 4903 4762 -141
- Misses 1057 1218 +161
|
|
Ok then we'll test this in unstable as discussed! |
|
Tried this out- existing images look good but uploading didn't seem to work: This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Details>No such object: production-public-files/public/system/images/photos/000/039/685/original/PXL_20210610_011822610.jpg</Details>
</Error> |
|
A working image appears at this url: |
|
We should check the logs, it seems the app is returning a success response so it thinks the file exists and succeeded. The url format looks good. Wonder whats wrong? |
|
Here are the Rails logs for the upload: |
|
OK, strangely, there is already a file in that location, in Google Cloud storage: Created Dec 11 2020, last modified Jan 14, 2021, 12:35:23 PM So... what's up? Wait!!! OMG, it's because unstable is trying to upload into the same production google cloud image store -- we need a different one for the unstable site, i guess? Or am I just looking in the wrong spot for the file? |
|
I found the missing image in the Tycho filesystem.
So I guess this shows that probably the env variables are not being used
and that without them, the system will use the filesystem. I'll review the
env var setup now.
--
Sebastian Silva
El jue, 17 jun 2021 a las 15:00, Jeffrey Warren ***@***.***>)
escribió:
… OK, strangely, there is already a file in that location, in Google Cloud
storage:
https://storage.googleapis.com/production-public-files/public/system/images/photos/000/039/685/original/44.jpg
Created Dec 11 2020, last modified Jan 14, 2021, 12:35:23 PM
So... what's up?
Wait!!! OMG, it's because unstable is trying to upload into the same
production google cloud image store -- we need a different one for the
unstable site, i guess?
Or am I just looking in the wrong spot for the file?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#9807 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABQYS5DRW6CFZPMR4EXZ33TTJA3NANCNFSM46XXDZSQ>
.
|
|
I found this log on uploading to unstable: |
|
It doesn't look like an error
|
|
|
Testing with new HMAC keys, (https://cloud.google.com/storage/docs/authentication/managing-hmackeys#create) after debugging issues with dependencies and configuration. |
|
Okay it seems the authentication went fine now, but now we're getting: |
|
so it looks like the |
|
Looks like the problem wasn't local_root, will restore it for now and figure out the actual problem. |
|
The docs say: So I'm guessing the ACL error that happens with |
This reverts commit 8406611.
```
google_storage_access_key_id: ENV["GOOGLE_STORAGE_KEY"] || '' ,
google_storage_secret_access_key: ENV["GOOGLE_STORAGE_SECRET"] || ''
```
|
Code Climate has analyzed commit c9ac585 and detected 0 issues on this pull request. View more on Code Climate. |
|
I think we're ready to go! The gitpod dev setup has no old images. Let's pass tests and merge, final check stable, and publish! |
|
Woohoo!! 🎉 |
* switch image.rb to google storage via fog library * Update app/models/image.rb * Update app/models/image.rb * Update app/models/image.rb * Update image.rb * Add missing env vars * Add missing env vars to other environments * Update paperclip.rb * Update docker-compose-production.yml * Update docker-compose-stable.yml * Update docker-compose-unstable.yml * install fog-google * added local fog config and switch * fixed local storage for dev * fog_host relative * revert fog-google to before double-splat bug * Omit local_root parameter * Revert "Omit local_root parameter" This reverts commit 8406611. * Add JSON key option to Google Cloud Storage config * fixed display config with style, path * google_project * Update Gemfile * remove XML keys ``` google_storage_access_key_id: ENV["GOOGLE_STORAGE_KEY"] || '' , google_storage_secret_access_key: ENV["GOOGLE_STORAGE_SECRET"] || '' ``` * Add path adjustment to fog storage provider Co-authored-by: Sebastian Silva <sebastian@fuentelibre.org>
* switch image.rb to google storage via fog library * Update app/models/image.rb * Update app/models/image.rb * Update app/models/image.rb * Update image.rb * Add missing env vars * Add missing env vars to other environments * Update paperclip.rb * Update docker-compose-production.yml * Update docker-compose-stable.yml * Update docker-compose-unstable.yml * install fog-google * added local fog config and switch * fixed local storage for dev * fog_host relative * revert fog-google to before double-splat bug * Omit local_root parameter * Revert "Omit local_root parameter" This reverts commit 8406611. * Add JSON key option to Google Cloud Storage config * fixed display config with style, path * google_project * Update Gemfile * remove XML keys ``` google_storage_access_key_id: ENV["GOOGLE_STORAGE_KEY"] || '' , google_storage_secret_access_key: ENV["GOOGLE_STORAGE_SECRET"] || '' ``` * Add path adjustment to fog storage provider Co-authored-by: Sebastian Silva <sebastian@fuentelibre.org>
Fixes #9760