factsfinder

factsfinder

Hello everyone, I’ve created an API only phoenix boilerplate. You can check on github here: GitHub - factsfinder/phoenix_api: This is an api only phoenix framework boilerplate which supports graphql, authentication and aws/backblaze s3 and thumbnailing out the box as of now. · GitHub

I’ve come across elixir and Pheonix only an year ago. Decided to make a boilerplate out of my current side project’s phoenix api.

Hopefully it will be useful or save time of atleast one of ya.

Thanks and keep drinking elixir everyday :slight_smile:

Showing Posts 1 to 5

sergio

sergio

I notice you’re using Backblaze instead of S3. Something I also wanted to look into, can you describe that process a bit more? Is it doing a direct upload to backblaze? Or does the file pass through the server?

factsfinder

factsfinder OP

Sure. Using Backblaze cause b2 cloud storage is s3 compatible Low Cost, High Performance S3 Compatible Object Storage and 4 times cheaper than aws s3.

I’m not using any other server to upload files to backblaze. All the implementation is right there in the repo.

So I’m just using a combination of these libraries:

arc => GitHub - stavro/arc: 📎 Flexible file upload and attachment library for Elixir · GitHub
arc_ecto => GitHub - stavro/arc_ecto: An integration with Arc and Ecto. · GitHub

ex_aws => GitHub - ex-aws/ex_aws: A flexible, easy to use set of clients AWS APIs for Elixir · GitHub
ex_aws_s3 => GitHub - ex-aws/ex_aws_s3 · GitHub

Please note that in case of ex_aws and ex_aws_s3 I’m using forked versions that I made changes to support backblaze.
Here are forked ones that are being used right now.
https://github.com/factsfinder/ex_aws_s3
https://github.com/factsfinder/ex_aws

Pls check the lib => api => uploads => image.exs file to get a much better idea.

Let me know if you have any questions.

maz

maz

Does ex_aws support backblaze now? Or should I use your fork still?

chrislaskey

chrislaskey

It doesn’t appear so @maz, the ex_aws and ex_aws_s3 libraries only have support for the official AWS regions.

I ended up following the excellent work @factsfinder did in his original fork, just done to the latest main branch of each of these repos. If it helps for your own reference, here’s the forks:

I use them in a Phoenix application by updating mix.exs to include:

{:ex_aws, git: "https://github.com/chrislaskey/ex_aws.git", branch: "main", override: true},
{:ex_aws_s3, git: "https://github.com/chrislaskey/ex_aws_s3.git", branch: "main"},
{:hackney, "~> 1.18"}

And in config/runtime.exs:

config :ex_aws,
  access_key_id: [System.get_env("AWS_ACCESS_KEY_ID"), :instance_role],
  secret_access_key: [System.get_env("AWS_SECRET_ACCESS_KEY"), :instance_role],
  region: System.get_env("BACKBLAZE_B2_REGION")

Where the value of BACKBLAZE_B2_REGION in my case is "us-west-001".

And as a quick sanity check things are working, I use this command to from the REPL to verify a file download from the existing B2 bucket is working:

ExAws.request(ExAws.S3.download_file("nameofmyb2bucket", "hello.txt", "world.txt"))

Note: at the time of writing, I only updated my forks to support "us-west-001" and "us-west-002". If you need other Backblaze B2 regions, you’ll need to add them following the same pattern.

maz

maz

Looks like it is actually possible.

I got a presigned url from backblaze using above ex_aws_s3 config

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
AstonJ
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews