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

feat(backend): migrate Arc to Waffle #811

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion apps/core/lib/core/schema/account.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.Account do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.{User, DomainMapping, PlatformSubscription}

schema "accounts" do
Expand Down
4 changes: 2 additions & 2 deletions apps/core/lib/core/schema/artifact.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.Artifact do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.{Repository}

defenum Platform, mac: 0, windows: 1, linux: 2, android: 3, freebsd: 4, openbsd: 5, solaris: 6
Expand Down Expand Up @@ -52,4 +52,4 @@ defmodule Core.Schema.Artifact do
end
end
def add_filesize(changeset, _), do: changeset
end
end
4 changes: 2 additions & 2 deletions apps/core/lib/core/schema/crd.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.Crd do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.Version

schema "crds" do
Expand All @@ -24,4 +24,4 @@ defmodule Core.Schema.Crd do
|> cast_attachments(attrs, [:blob], allow_urls: true)
|> validate_required([:name, :version_id])
end
end
end
2 changes: 1 addition & 1 deletion apps/core/lib/core/schema/file.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.File do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema

alias Core.Schema.IncidentMessage

Expand Down
4 changes: 2 additions & 2 deletions apps/core/lib/core/schema/integration.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.Integration do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema

alias Core.Schema.{Publisher, Repository, ResourceDefinition, Tag}

Expand Down Expand Up @@ -64,4 +64,4 @@ defmodule Core.Schema.Integration do
end)
end
def validate(changeset, _), do: add_error(changeset, :spec, "No resource definition present for this repository")
end
end
2 changes: 1 addition & 1 deletion apps/core/lib/core/schema/publisher.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.Publisher do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.{User, Address, Repository, Account}

@repo_sideload_limit 5
Expand Down
2 changes: 1 addition & 1 deletion apps/core/lib/core/schema/repository.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.Repository do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.{
Publisher,
Dashboard,
Expand Down
4 changes: 2 additions & 2 deletions apps/core/lib/core/schema/terraform.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.Terraform do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.{Repository, Dependencies}

schema "terraform" do
Expand Down Expand Up @@ -62,4 +62,4 @@ defmodule Core.Schema.Terraform do
_ -> cs
end
end
end
end
2 changes: 1 addition & 1 deletion apps/core/lib/core/schema/test_step.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.TestStep do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.Test

schema "test_steps" do
Expand Down
2 changes: 1 addition & 1 deletion apps/core/lib/core/schema/user.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.User do
use Piazza.Ecto.Schema, derive_json: false
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.{
Address,
Publisher,
Expand Down
2 changes: 1 addition & 1 deletion apps/core/lib/core/schema/version.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Schema.Version do
use Piazza.Ecto.Schema
use Arc.Ecto.Schema
use Waffle.Ecto.Schema
alias Core.Schema.{
Chart,
Dependencies,
Expand Down
4 changes: 2 additions & 2 deletions apps/core/lib/core/services/storage.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Core.Storage do
use Arc.Definition
use Arc.Ecto.Definition
use Waffle.Definition
use Waffle.Ecto.Definition
alias Core.Schema.{
User,
Publisher,
Expand Down
6 changes: 3 additions & 3 deletions apps/core/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ defmodule Core.MixProject do
{:flow, "~> 0.15.0"},
{:joken, "~> 2.5.0"},
{:guardian, "~> 1.2.1"},
{:arc, "~> 0.11.0"},
{:arc_gcs, "~> 0.2.0"},
{:waffle, "~> 1.1.6"},
{:waffle_gcs, "~> 0.2.0"},
{:porcelain, "~> 2.0"},
{:ex_aws, "~> 2.4.0"},
{:ex_aws_s3, "~> 2.3.3"},
{:ex_aws_sts, "~> 2.3.0"},
{:configparser_ex, "~> 4.0"},
{:sweet_xml, "~> 0.7.3"},
{:arc_ecto, "~> 0.11.3"},
{:waffle_ecto, "~> 0.0.11"},
{:dictionary, "~> 0.1.0"},
{:mojito, "~> 0.7.0"},
{:nebulex, "== 2.4.2"},
Expand Down
4 changes: 2 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ config :botanist,
config :core, :connection_draining,
shutdown_delay_ms: 1

config :arc,
storage: Arc.Storage.GCS,
config :waffle,
storage: Waffle.Storage.Google.CloudStorage,
bucket: "forge-assets"

config :stripity_stripe,
Expand Down
6 changes: 3 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
"amqp": {:hex, :amqp, "3.2.0", "51e85e06e4d283d98f21dce95906e42cb181fc7ceeb967b33b3be73d6ea41aa5", [:mix], [{:amqp_client, "~> 3.9.1", [hex: :amqp_client, repo: "hexpm", optional: false]}], "hexpm", "1439570336df6e79000239938fb055a0944dc9a768b4dec0af1375404508a014"},
"amqp_client": {:hex, :amqp_client, "3.9.25", "640cf676efa775b77ff4613f2a14b73ef68a9f2b2cfe8ba708e0599d389f2bc4", [:make, :rebar3], [{:rabbit_common, "3.9.25", [hex: :rabbit_common, repo: "hexpm", optional: false]}], "hexpm", "d76ad46ee333313fe8a6ad0939d56dfcead0c28ca1024e4410ec89393c1f3ef7"},
"apq": {:hex, :apq, "1.2.1", "efcbcbbb32b033b490a8d64d473fa042b4644960acab19a71076d28b263b8f46", [:mix], [{:absinthe_plug, "~> 1.4", [hex: :absinthe_plug, repo: "hexpm", optional: false]}], "hexpm", "4c33ab1e0cadc486597c266fe318f637a104305a21c4d0c306ac341d8bb6de02"},
"arc": {:hex, :arc, "0.11.0", "ac7a0cc03035317b6fef9fe94c97d7d9bd183a3e7ce1606aa0c175cfa8d1ba6d", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:ex_aws_s3, "~> 2.0", [hex: :ex_aws_s3, repo: "hexpm", optional: true]}, {:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.1", [hex: :poison, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "e91a8bd676fca716f6e46275ae81fb96c0bbc7a9d5b96cac511ae190588eddd0"},
"arc_ecto": {:hex, :arc_ecto, "0.11.3", "52f278330fe3a29472ce5d9682514ca09eaed4b33453cbaedb5241a491464f7d", [:mix], [{:arc, "~> 0.11.0", [hex: :arc, repo: "hexpm", optional: false]}, {:ecto, ">= 2.1.0", [hex: :ecto, repo: "hexpm", optional: false]}], "hexpm", "24beed35003707434a778caece7d71e46e911d46d1e82e7787345264fc8e96d0"},
"arc_gcs": {:hex, :arc_gcs, "0.2.4", "1a499aaa5562019d180dcf9b74999ac647427c9e62c81190139304343a184d1e", [:mix], [{:arc, "~> 0.11", [hex: :arc, repo: "hexpm", optional: false]}, {:google_api_storage, "~> 0.13", [hex: :google_api_storage, repo: "hexpm", optional: false]}, {:goth, "~> 1.0", [hex: :goth, repo: "hexpm", optional: false]}, {:mime, "~> 1.3", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm", "8d59a84f6b06a6f994c0211d10837a37ab1d1cd2d66ca9309531c7856783ef6d"},
"argon2_elixir": {:hex, :argon2_elixir, "2.0.5", "0073a87d755c7e63fc4f9d08b1d1646585b93f144cecde126e15061b24240b20", [:make, :mix], [{:comeonin, "~> 5.1", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.5", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "31d0dc208100fd77a2fc4aa2eb4567308791316c69dfb3d449550fbb058ecb02"},
"artificery": {:hex, :artificery, "0.4.2", "3ded6e29e13113af52811c72f414d1e88f711410cac1b619ab3a2666bbd7efd4", [:mix], [], "hexpm", "514586f4312ef3709a3ccbd8e55f69455add235c1729656687bb781d10d0afdb"},
"bamboo": {:hex, :bamboo, "2.0.2", "0e2914d2bea0de3b1743384c24ffbe20fbb58094376a49f1cf5d9ed9959abd82", [:mix], [{:hackney, ">= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.4", [hex: :mime, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "058d57cf4fcdac19413aa72732eb43c88954fb151a1cb6a382014e0cddbf6314"},
Expand Down Expand Up @@ -146,6 +143,9 @@
"tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
"uri_query": {:hex, :uri_query, "0.1.2", "ae35b83b472f3568c2c159eee3f3ccf585375d8a94fb5382db1ea3589e75c3b4", [:mix], [], "hexpm", "e3bc81816c98502c36498b9b2f239b89c71ce5eadfff7ceb2d6c0a2e6ae2ea0c"},
"waffle": {:hex, :waffle, "1.1.6", "e944b31f8a3f3b15b8ce5c6ca315cecbcbfab354c2bb83f5980c79728cf422c0", [:mix], [{:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:ex_aws_s3, "~> 2.1", [hex: :ex_aws_s3, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: false]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "deecbf205acc5b6d0bc23d3813fa384486606a50d82b803edbd29e2a46258d4d"},
"waffle_ecto": {:hex, :waffle_ecto, "0.0.11", "3d9581b3dfc83964ad968ef6bbf31132b5e6959c542a74c49e2a2245a9521048", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:waffle, "~> 1.0", [hex: :waffle, repo: "hexpm", optional: false]}], "hexpm", "626c2832ba94e20840532e609d3af70526d18ff9dfe1b352afb3fbabedb31a7e"},
"waffle_gcs": {:hex, :waffle_gcs, "0.2.0", "dea6bb5da8da961a2a7a000178b0912cd342c89891c73ec745e19b1841b47fb2", [:mix], [{:google_api_storage, "~> 0.14", [hex: :google_api_storage, repo: "hexpm", optional: false]}, {:goth, "~> 1.1", [hex: :goth, repo: "hexpm", optional: false]}, {:waffle, "~> 1.1", [hex: :waffle, repo: "hexpm", optional: false]}], "hexpm", "5250750957d21cbaa762b88e71ca82014e7d803f3c2759a75ec2bb93fa3a384d"},
"websockex": {:hex, :websockex, "0.4.3", "92b7905769c79c6480c02daacaca2ddd49de936d912976a4d3c923723b647bf0", [:mix], [], "hexpm", "95f2e7072b85a3a4cc385602d42115b73ce0b74a9121d0d6dbbf557645ac53e4"},
"workos": {:hex, :workos, "0.1.2", "d4b80b94091b8568cff4aef4ecbcd34b43b4b3b148fe35c21ced88b01fb14297", [:mix], [{:hackney, "~> 1.16.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: false]}, {:tesla, "~> 1.4", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "1c119e20729c71dcf86f7559c4ae1af13105bdaaddbba3e1dae8149b378f66a9"},
"x509": {:hex, :x509, "0.8.5", "22b2c5dfc87b05d46595d3764f41a23fcb7360f891e0464f1a2ec118177cd4e4", [:mix], [], "hexpm", "c63eb89e8bbe8a5e21b6404ad1082faff670e38b74960297f90d023177949e07"},
Expand Down
6 changes: 3 additions & 3 deletions rel/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ config :core, hostname: host
config :email, host: "https://#{host}"
config :core, host: "https://#{host}"

config :arc,
storage: Arc.Storage.GCS,
config :waffle,
storage: Waffle.Storage.Google.CloudStorage,
bucket: get_env("BUCKET")

config :core, Core.Guardian,
Expand Down Expand Up @@ -102,7 +102,7 @@ end

if provider != :gcp do
config :goth, disabled: true
config :arc, storage: Arc.Storage.S3
config :waffle, storage: Waffle.Storage.S3
end

if org_id = get_env("GCP_ORG_ID") do
Expand Down