neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
Log in to mark this repository.
Slice 5 groundwork: deploys, blobs, assemble status, artifact bundles, storage
d9619e9 · gmorell · 2026-12-02 02:01
Files changed
modified
.gitignore
+3
−0
| 42 | 42 | |
| 43 | 43 | # Claude Code worktrees for background agents. |
| 44 | 44 | /.claude/worktrees/ |
| 45 | + | |
| 46 | +# Uploaded files in development (Vigil.Storage.Local) | |
| 47 | +/storage/ |
modified
config/runtime.exs
+17
−0
| 150 | 150 | # |
| 151 | 151 | # See https://swoosh.hexdocs.pm/Swoosh.html#module-installation for details. |
| 152 | 152 | end |
| 153 | + | |
| 154 | +# Uploaded files (sourcemap chunks and bundles): local disk under | |
| 155 | +# VIGIL_STORAGE_ROOT, or an S3-compatible bucket when S3_BUCKET is set. | |
| 156 | +if root = System.get_env("VIGIL_STORAGE_ROOT") do | |
| 157 | + config :vigil, Vigil.Storage.Local, root: root | |
| 158 | +end | |
| 159 | + | |
| 160 | +if bucket = System.get_env("S3_BUCKET") do | |
| 161 | + config :vigil, :storage, Vigil.Storage.S3 | |
| 162 | + | |
| 163 | + config :vigil, Vigil.Storage.S3, | |
| 164 | + bucket: bucket, | |
| 165 | + endpoint: System.fetch_env!("S3_ENDPOINT"), | |
| 166 | + region: System.get_env("S3_REGION", "us-east-1"), | |
| 167 | + access_key_id: System.fetch_env!("S3_ACCESS_KEY_ID"), | |
| 168 | + secret_access_key: System.fetch_env!("S3_SECRET_ACCESS_KEY") | |
| 169 | +end |
modified
config/test.exs
+4
−0
| 59 | 59 | # Sort query params output of verified routes for robust url comparisons |
| 60 | 60 | config :phoenix, |
| 61 | 61 | sort_verified_routes_query_params: true |
| 62 | + | |
| 63 | +# Uploaded files (chunks, bundle files) go under _build, per test partition. | |
| 64 | +config :vigil, Vigil.Storage.Local, | |
| 65 | + root: Path.expand("../_build/test/storage#{System.get_env("MIX_TEST_PARTITION")}", __DIR__) |
added
lib/vigil/artifacts/artifact_bundle.ex
+23
−0
| 1 | +defmodule Vigil.Artifacts.ArtifactBundle do | |
| 2 | + @moduledoc """ | |
| 3 | + An artifact bundle sentry-cli uploaded (`sourcemaps upload`): a zip with a | |
| 4 | + `manifest.json`, assembled from chunks. Its files are extracted into | |
| 5 | + `Vigil.Artifacts.ArtifactFile`s; the zip itself isn't kept. | |
| 6 | + """ | |
| 7 | + use Vigil.Schema | |
| 8 | + | |
| 9 | + schema "artifact_bundles" do | |
| 10 | + field :organization_id, Ecto.UUID | |
| 11 | + field :checksum, :string | |
| 12 | + field :bundle_id, :string | |
| 13 | + field :release, :string | |
| 14 | + field :dist, :string | |
| 15 | + field :artifact_count, :integer, default: 0 | |
| 16 | + field :size, :integer, default: 0 | |
| 17 | + | |
| 18 | + many_to_many :projects, Vigil.Projects.Project, join_through: "artifact_bundle_projects" | |
| 19 | + has_many :files, Vigil.Artifacts.ArtifactFile | |
| 20 | + | |
| 21 | + timestamps(type: :utc_datetime, updated_at: false) | |
| 22 | + end | |
| 23 | +end |
added
lib/vigil/artifacts/artifact_file.ex
+24
−0
| 1 | +defmodule Vigil.Artifacts.ArtifactFile do | |
| 2 | + @moduledoc """ | |
| 3 | + One file of an artifact bundle: `kind` is minified_source, source_map, | |
| 4 | + source, indexed_ram_bundle or other; `url` is the manifest's | |
| 5 | + (`~/static/js/app.js`); `debug_id` pairs a minified file with its map; | |
| 6 | + `sourcemap` is a minified file's `Sourcemap` header (its map's url). | |
| 7 | + """ | |
| 8 | + use Vigil.Schema | |
| 9 | + | |
| 10 | + schema "artifact_files" do | |
| 11 | + field :organization_id, Ecto.UUID | |
| 12 | + field :kind, :string | |
| 13 | + field :url, :string | |
| 14 | + field :debug_id, Ecto.UUID | |
| 15 | + field :sourcemap, :string | |
| 16 | + field :headers, :map, default: %{} | |
| 17 | + field :size, :integer | |
| 18 | + field :storage_key, :string | |
| 19 | + | |
| 20 | + belongs_to :artifact_bundle, Vigil.Artifacts.ArtifactBundle | |
| 21 | + | |
| 22 | + timestamps(type: :utc_datetime, updated_at: false) | |
| 23 | + end | |
| 24 | +end |
added
lib/vigil/artifacts/assemble_status.ex
+17
−0
Click to load diff…
added
lib/vigil/artifacts/file_blob.ex
+16
−0
Click to load diff…
added
lib/vigil/releases/deploy.ex
+16
−0
Click to load diff…
added
lib/vigil/storage.ex
+20
−0
Click to load diff…
added
lib/vigil/storage/local.ex
+60
−0
Click to load diff…
added
lib/vigil/storage/s3.ex
+69
−0
Click to load diff…
added
priv/repo/migrations/20261202020100_create_releases_artifacts.exs
+118
−0
Click to load diff…
Parents: 0ac4ba6