splashblot / dronedb

Location Intelligence & Data Visualization tool
http://carto.com
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Imposible to change Avatar #39

Closed ivanprado closed 7 years ago

ivanprado commented 7 years ago

It is not possible to upload an Avatar.

jjmata commented 7 years ago

Pretty sure this has to do with the S3 assets issue, will triage today.

jjmata commented 7 years ago

Probably related to this "still in my local repo" change:

jjmata at rye in ~/src/docker-dronedb on master [!]
$ git diff
diff --git a/startup.sh b/startup.sh
index bc64fe2..9fd90a4 100755
--- a/startup.sh
+++ b/startup.sh
@@ -50,7 +50,9 @@ HUBSPOT_TOKEN=$(cat /run/secrets/HUBSPOT_TOKEN) \
   FS_ORG=$(cat /run/secrets/FS_ORG) \
   ROLLBAR_API_KEY=$(cat /run/secrets/ROLLBAR_API_KEY) \
   MAILGUN_POSTMASTER_PASSWORD=$(cat /run/secrets/MAILGUN_POSTMASTER_PASSWORD) \
-  envsubst '$HUBSPOT_TOKEN:$FS_ORG:$ROLLBAR_API_KEY:$MAILGUN_POSTMASTER_PASSWORD'\
+  AWS_S3_ACCESS_KEY_ID=$(cat /run/secrets/AWS_S3_ACCESS_KEY_ID) \
+  AWS_S3_SECRET_ACCESS_KEY=$(cat /run/secrets/AWS_S3_SECRET_ACCESS_KEY) \
+  envsubst '$HUBSPOT_TOKEN:$FS_ORG:$ROLLBAR_API_KEY:$MAILGUN_POSTMASTER_PASSWORD:$AWS_S3_ACCESS_KEY_ID:$AWS_S3_SECRET_ACCESS_KEY'\
   < /dronedb/config/app_config.yml.pre-secrets \
   > /dronedb/config/app_config.yml
apercas commented 7 years ago

Are we switching to gravitar or backing up to the AWS solution?

jjmata commented 7 years ago

Both should work (Gravatar and local/AWS).

apercas commented 7 years ago

UPDATE After puts-ing from https://github.com/splashblot/dronedb/blob/tileo-june2017/app/models/asset.rb#L160 the values of Cartodb.config[:aws]["s3"] and Cartodb.config[:assets]["s3_bucket_name"] the results are:

dronedb_1     | {"access_key_id"=>"", "secret_access_key"=>""}
dronedb_1     | tileo-localhost-org-assets

So it can read the name of the bucket but not access key pair. Will update with more info when available.

jjmata commented 7 years ago

OK, mystery solved ... at some point in the last few days envsubst of the tokens started failing, so:

root@ec1871cc4cb7:/dronedb/config# diff app_config.yml app_config.yml.pre-secrets
248,249c248,249
<       access_key_id: ""
<       secret_access_key: ""
---
>       access_key_id: "$AWS_S3_ACCESS_KEY_ID"
>       secret_access_key: "$AWS_S3_SECRET_ACCESS_KEY"
686c686
<     password: ''
---
>     password: '$MAILGUN_POSTMASTER_PASSWORD'
704c704
<   rollbar_api_key: ''
---
>   rollbar_api_key: '$ROLLBAR_API_KEY'
706c706
<     org: ''
---
>     org: '$FS_ORG'
712c712
<       token: ''
---
>       token: '$HUBSPOT_TOKEN'

Those empty entries should have values in them!

This seem to be the offending error:

dronedb_1        | /opt/startup.sh: line 65:  : command not found

Line 65 takes care of the substitution.

jjmata commented 7 years ago

I'll finish this tomorrow, taking over here.

apercas commented 7 years ago

Hope this works! From my end: I directly added a brand new pair of access keys on file_upload.rb and the logs prompted the correct values (obviously) however I got the same 'no valid credentials' issue. Maybe I didn't grant proper access to that pair as my knowledge of AWS console is not strong.

jjmata commented 7 years ago

The S3 buckets piece is working now (see https://github.com/splashblot/dronedb/issues/12) and I can see the assets uploaded to the appropriate bucket, one of:

But for some reason the UI doesn't reflect / update and start using the asset. I believe we need to do some more configuration to start serving those assets, haven't found where. Do you remember where this is done, @MariaCheca?

jjmata commented 7 years ago

I can confirm that the assets are (at least sometimes) coming from S3:

That's the SmartRural logo that is currently working in prod.