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

Internet.Avatar Randomizer - Access to s3 Storage is diabled #336

Closed
nfMalde opened this issue Nov 22, 2020 · 5 comments
Closed

Internet.Avatar Randomizer - Access to s3 Storage is diabled #336

nfMalde opened this issue Nov 22, 2020 · 5 comments

Comments

@nfMalde
Copy link

nfMalde commented Nov 22, 2020

Version Information

Software Version(s)
Bogus NuGet Package 31.0.3
.NET Core? 3.1
.NET Full Framework? x
Windows OS? Windows 10 Pro
Linux OS? x
Visual Studio? VS2019 16.8.1

|

What locale are you using with Bogus?

en

What is the expected behavior?

Random Aavatar can be downloaded

What is the actual behavior?

403 Forbidde

Please provide a stack trace.

Sample Image Url
https://s3.amazonaws.com/uifaces/faces/twitter/urrutimeoli/128.jpg

Any possible solutions?

Reactivate S3 Storage for "Faces" or use another Store

How do you reproduce the issue?

Use Bogus.Internet.Avater

Do you have a unit test that can demonstrate the bug?

No

Can you identify the location in Bogus' source code where the problem exists?

https://github.com/bchavez/Bogus/blob/master/Source/Bogus/data/en.locale.json#L1837

If the bug is confirmed, would you be willing to submit a PR?

No

Possible related:
https://github.com/Marak/faker.js/issues/464

The Avatar Urls were usally downloadable. Now it seems like the S3 storage they are located on is offline or set to private.
Possible WorkArround for now: Use Bogus.Image.LoremFlickr() with a fixed size for avatars to archive generating dummy avatars.

@bchavez
Copy link
Owner

bchavez commented Nov 22, 2020

Hi @nfMalde, thanks very much for the heads up.

  • If anyone has a copy of the S3 bucket contents, please feel free to send a link.

I'd like to try to see if we can get this hosted for Bogus.

@nfMalde
Copy link
Author

nfMalde commented Nov 22, 2020

What about randomuser.me? I tried the service like the reporter in the related ticket and its quite nice.

@bchavez
Copy link
Owner

bchavez commented Nov 22, 2020

It's possible. Looks like randomuser.me has a sample size of about 200 images.

The unfortunate part of all this is that previously, the S3 storage bucket had over 1000 avatar images.

I ran a small LINQPad script running against Wayback Machine recovering the avatar images from the S3 bucket. Of 1254, only 4 didn't make it.

Failed: https://s3.amazonaws.com/uifaces/faces/twitter/tomaslau/128.jpg
Failed: https://s3.amazonaws.com/uifaces/faces/twitter/soffes/128.jpg
Failed: https://s3.amazonaws.com/uifaces/faces/twitter/fluidbrush/128.jpg
Failed: https://s3.amazonaws.com/uifaces/faces/twitter/tjisousa/128.jpg

Here's the backup of 1250 avatars: faces.zip

image

I'll see what kind of options are available to host these and maybe randomuser.me too so we don't run into the issue again.

Thanks,
Brian

@bchavez
Copy link
Owner

bchavez commented Nov 29, 2020

Hi @nfMalde,

The issue should be fixed in Bogus v32.0.1. The Internet.Avatar() images are now decentrally hosted globally on IPFS and retrieved from Cloudflare's IPFS gateway.

If you'd like to help host, you can Pin the following root CID folder:

Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye

The root folder can be browsed viewed here:
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/

There are a few ways the community can help host these files all over the world. I'll outline some of the easiest ways below:

Option 1: IPFS Desktop

Probably the easiest is to install IPFS Desktop on any machine. Once installed,

  • Click "Files"
  • Click "+ Import"
  • Click "From IPFS"

image

  • Copy and Paste the folder's CID: Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye
  • Click the "Import" button.

image

  • Once the folder appears, Pin the folder:

image

That's it! Now the files will be globally distributed and decentralized. The more the community helps host, the more resilient the URLs will be.

Option 2: IPFS on Docker

version: '3'
services:
  ipfs:
    restart: always
    image: ipfs/go-ipfs:latest
    environment:
      - IPFS_PROFILE=server
      - IPFS_PATH=/ipfsdata
    volumes:
      - ./data:/ipfsdata
    ports:
      - "4001:4001"
      - "127.0.0.1:8080:8080"
      - "127.0.0.1:8081:8081"
      - "127.0.0.1:5001:5001"
❯ mkdir data
❯ docker-compose up -d
❯ docker-compose exec ipfs ipfs pin add Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye

Option 3: IPFS via CLI on Windows

❯ choco install ipfs
❯ ipfs init
❯ ipfs daemon

Then separately, in a new command window:

❯ ipfs pin add Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye

Hope this helps and solves our problem. Hopefully, we can migrate to IPFS and away from centralized services that Bogus might rely on in the future.

Thanks,
Brian

@nfMalde
Copy link
Author

nfMalde commented Nov 29, 2020

Hi @bchavez !
Thanks for the fix! Ill try it all out as soon as I find some time.

Thanks,

Malte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants