fix production deployment: CSS, images and theme seeding
- Add @source for shop_components/ directory in app-shop.css (Tailwind wasn't scanning sub-modules after the refactor, dropping ~73 utilities) - Remove overly aggressive .dockerignore rules that excluded mockup image variants needed by the responsive_image component - Seed default theme settings on first boot via Release.seed_defaults/0 in the supervision tree (seeds.exs doesn't run in releases) - Fix PDP gallery images for mock data by appending -1200.webp to bare mockup base paths - Update fly.toml format from fly launch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ defmodule SimpleshopTheme.Application do
|
||||
SimpleshopTheme.Repo,
|
||||
{Ecto.Migrator,
|
||||
repos: Application.fetch_env!(:simpleshop_theme, :ecto_repos), skip: skip_migrations?()},
|
||||
# Seed default theme settings if none exist (first boot)
|
||||
Supervisor.child_spec({Task, &SimpleshopTheme.Release.seed_defaults/0}, id: :seed_defaults),
|
||||
# Load encrypted secrets from DB into Application env
|
||||
{Task, &SimpleshopTheme.Secrets.load_all/0},
|
||||
{DNSCluster, query: Application.get_env(:simpleshop_theme, :dns_cluster_query) || :ignore},
|
||||
|
||||
@@ -16,6 +16,25 @@ defmodule SimpleshopTheme.Release do
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
Seeds default theme settings if none exist.
|
||||
|
||||
Called on every boot but only writes to the DB on first run
|
||||
(when the settings table is empty). Safe to call repeatedly.
|
||||
"""
|
||||
def seed_defaults do
|
||||
alias SimpleshopTheme.Settings
|
||||
|
||||
case Settings.get_setting("theme_settings") do
|
||||
nil ->
|
||||
{:ok, _} = Settings.apply_preset(:studio)
|
||||
:ok
|
||||
|
||||
_exists ->
|
||||
:ok
|
||||
end
|
||||
end
|
||||
|
||||
def rollback(repo, version) do
|
||||
load_app()
|
||||
{:ok, _, _} = Ecto.Migrator.with_repo(repo, &Ecto.Migrator.run(&1, :down, to: version))
|
||||
|
||||
Reference in New Issue
Block a user