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

Refiner-DTM-RC:v0.5.5 #228

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8aafc60
Bump gettext from 0.24.0 to 0.25.0
dependabot[bot] Aug 12, 2024
fc1bc05
update ipfs-pinner docker compose run
noslav Aug 13, 2024
e12fccc
Merge pull request #227 from covalenthq/dependabot/hex/develop/gettex…
noslav Aug 13, 2024
e552ae6
move pinner ci version back to stable
noslav Aug 13, 2024
947f09e
Bump gettext from 0.25.0 to 0.26.1
dependabot[bot] Aug 26, 2024
d5bf6ef
Bump telemetry from 1.2.1 to 1.3.0
dependabot[bot] Aug 26, 2024
1811a28
Merge pull request #230 from covalenthq/dependabot/hex/develop/teleme…
noslav Sep 18, 2024
ff10f05
Merge pull request #229 from covalenthq/dependabot/hex/develop/gettex…
noslav Sep 18, 2024
da34fd6
Update dependabot.yml
rogarcia Jun 11, 2024
cea9d4d
update tagged release workflow
noslav Aug 6, 2024
c470d0c
Upload feature patch using Tesla
Karthiksrinatha Sep 24, 2024
23c38ea
Formatting followed
Karthiksrinatha Sep 24, 2024
adb8cdf
Credo changes
Karthiksrinatha Sep 24, 2024
f066036
Merge pull request #233 from covalenthq/tesla_multipart
noslav Sep 25, 2024
af806a4
Bump plug_cowboy from 2.7.1 to 2.7.2
dependabot[bot] Sep 25, 2024
a138ebf
Bump finch from 0.18.0 to 0.19.0
dependabot[bot] Sep 25, 2024
d406505
bump refiner minor version
noslav Sep 25, 2024
265a163
Merge pull request #231 from covalenthq/dependabot/hex/develop/finch-…
noslav Sep 25, 2024
7587aef
Merge pull request #232 from covalenthq/dependabot/hex/develop/plug_c…
noslav Sep 25, 2024
1754c7f
Bump hackney from 1.18.1 to 1.20.1
dependabot[bot] Sep 30, 2024
d710ba0
Bump credo from 1.7.7 to 1.7.8
dependabot[bot] Sep 30, 2024
bd2e1fb
Bump rustler from 0.34.0 to 0.35.0
dependabot[bot] Oct 21, 2024
cd6d412
Bump tesla from 1.12.1 to 1.13.0
dependabot[bot] Oct 28, 2024
18c14d7
Merge pull request #234 from covalenthq/dependabot/hex/develop/hackne…
rogarcia Oct 28, 2024
3c0a17f
Merge pull request #235 from covalenthq/dependabot/hex/develop/credo-…
rogarcia Oct 31, 2024
f7eba6a
Bump dialyxir from 1.4.3 to 1.4.4
dependabot[bot] Oct 31, 2024
65be99e
Merge pull request #236 from covalenthq/dependabot/hex/develop/dialyx…
rogarcia Oct 31, 2024
0d5e617
Merge pull request #237 from covalenthq/dependabot/hex/develop/rustle…
rogarcia Oct 31, 2024
0e3da1c
Merge pull request #239 from covalenthq/dependabot/hex/develop/tesla-…
rogarcia Oct 31, 2024
96b384a
Bump credo from 1.7.8 to 1.7.9
dependabot[bot] Nov 4, 2024
0c7e7f9
Merge pull request #240 from covalenthq/dependabot/hex/develop/credo-…
rogarcia Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
target-branch: "develop"
reviewers:
- "noslav"
- "rogarcia"
- "rogarcia"
2 changes: 1 addition & 1 deletion .github/workflows/tag-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Build & Publish the Docker image
run: |
docker buildx create --name builder --use --platform=linux/amd64,linux/arm64 && docker buildx build --platform=linux/amd64,linux/arm64 . -t us-docker.pkg.dev/covalent-project/network/refiner:stable -t us-docker.pkg.dev/covalent-project/network/refiner:"${{ env.TAG }}" --push
docker buildx create --name builder --use --platform=linux/amd64 && docker buildx build --platform=linux/amd64 . -t us-docker.pkg.dev/covalent-project/network/refiner:stable -t us-docker.pkg.dev/covalent-project/network/refiner:"${{ env.TAG }}" --push

- uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand Down
28 changes: 15 additions & 13 deletions lib/refiner/ipfs/ipfs_interactor.ex
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
defmodule Refiner.IPFSInteractor do
use GenServer
use Tesla

alias Multipart.Part
alias Refiner.Events

plug(Tesla.Middleware.JSON)

require Logger

@spec start_link([
Expand All @@ -27,20 +30,19 @@ defmodule Refiner.IPFSInteractor do
def handle_call({:pin, file_path}, _from, state) do
start_pin_ms = System.monotonic_time(:millisecond)
ipfs_url = Application.get_env(:refiner, :ipfs_pinner_url)
url = "#{ipfs_url}/upload"

multipart = Multipart.new() |> Multipart.add_part(Part.file_body(file_path))
body_stream = Multipart.body_stream(multipart)
content_length = Multipart.content_length(multipart)
content_type = Multipart.content_type(multipart, "multipart/form-data")
headers = [{"Content-Type", content_type}, {"Content-Length", to_string(content_length)}]

resp =
Finch.build("POST", url, headers, {:stream, body_stream})
|> Finch.request(Refiner.Finch)

case resp do
{:ok, %Finch.Response{body: body, headers: _, status: _}} ->
# Create a multipart request
multipart =
Tesla.Multipart.new()
|> Tesla.Multipart.add_file(file_path,
filename: Path.basename(file_path),
headers: [
{"Content-Type", "multipart/form-data"}
]
)

case post("#{ipfs_url}/upload", multipart) do
{:ok, %Tesla.Env{body: body, headers: _, status: _}} ->
body_map = body |> Poison.decode!()

end_pin_ms = System.monotonic_time(:millisecond)
Expand Down
12 changes: 8 additions & 4 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Refiner.MixProject do
def project do
[
app: :refiner,
version: "0.5.2",
version: "0.5.5",
elixir: "~> 1.17.1",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down Expand Up @@ -63,7 +63,7 @@ defmodule Refiner.MixProject do
# networking
{:certifi, "~> 2.9", override: true},
{:cors_plug, "~> 3.0"},
{:finch, "~> 0.18.0"},
{:finch, "~> 0.19.0"},
{:downstream, "~> 1.0"},
{:websockex, "~> 0.4.3"},
{:multipart, "~> 0.4.0"},
Expand All @@ -81,14 +81,18 @@ defmodule Refiner.MixProject do
{:etfs, "~> 0.2.0"},

# tracing metrics
{:telemetry, "~> 1.2.1", override: true},
{:telemetry, "~> 1.3.0", override: true},
{:telemetry_metrics, "~> 0.3.0"},
{:telemetry_metrics_prometheus, "~> 0.3.1"},
{:telemetry_metrics_prometheus_core, "~>0.2.2"},

# utils
{:briefly, "~> 0.5.0"},
{:rustler, ">= 0.0.0", optional: true}
{:rustler, ">= 0.0.0", optional: true},

# Tesla for multipart
{:tesla, "~> 1.12"},
{:hackney, "~> 1.17"}

# Unused
# {:erlexec, "~> 2.0"},
Expand Down
Loading
Loading