-
Notifications
You must be signed in to change notification settings - Fork 1
fixes, local development and qr in device setup #1
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,9 +14,7 @@ config :goatmire, Goatmire.Repo, | |
| # watchers to your application. For example, we can use it | ||
| # to bundle .js and .css sources. | ||
| config :goatmire, GoatmireWeb.Endpoint, | ||
| # Binding to loopback ipv4 address prevents access from other machines. | ||
| # Change to `ip: {0, 0, 0, 0}` to allow access from other machines. | ||
| http: [ip: {127, 0, 0, 1}, port: String.to_integer(System.get_env("PORT") || "4000")], | ||
| http: [ip: {0, 0, 0, 0}, port: String.to_integer(System.get_env("PORT") || "4000")], | ||
| check_origin: false, | ||
| code_reloader: true, | ||
| debug_errors: true, | ||
|
|
@@ -83,3 +81,19 @@ config :phoenix_live_view, | |
|
|
||
| # Disable swoosh api client as it is only required for production adapters. | ||
| config :swoosh, :api_client, false | ||
|
|
||
| # MinIO (local S3) config for development | ||
| # Uses mDNS hostname - works for both local (via hosts) and network devices | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setups minio in local development |
||
| minio_host = System.get_env("MINIO_HOST") || "pepe-laptop.local" | ||
|
|
||
| config :ex_aws, | ||
| json_codec: Jason, | ||
| access_key_id: "minioadmin", | ||
| secret_access_key: "minioadmin" | ||
|
|
||
| config :ex_aws, :s3, | ||
| scheme: "http://", | ||
| host: minio_host, | ||
| port: 9000, | ||
| region: "us-east-1", | ||
| bucket: "goatmire" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,26 +20,26 @@ if System.get_env("PHX_SERVER") do | |
| config :goatmire, GoatmireWeb.Endpoint, server: true | ||
| end | ||
|
|
||
| # Tigris config | ||
| config :ex_aws, | ||
| debug_requests: true, | ||
| json_codec: Jason, | ||
| access_key_id: | ||
| System.get_env("AWS_ACCESS_KEY_ID") || | ||
| raise("Missing env variable: AWS_ACCESS_KEY_ID"), | ||
| secret_access_key: | ||
| System.get_env("AWS_SECRET_ACCESS_KEY") || | ||
| raise("Missing env variable: AWS_SECRET_ACCESS_KEY") | ||
| if config_env() == :prod do | ||
| # Tigris config | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tigris conf under prod |
||
| config :ex_aws, | ||
| debug_requests: true, | ||
| json_codec: Jason, | ||
| access_key_id: | ||
| System.get_env("AWS_ACCESS_KEY_ID") || | ||
| raise("Missing env variable: AWS_ACCESS_KEY_ID"), | ||
| secret_access_key: | ||
| System.get_env("AWS_SECRET_ACCESS_KEY") || | ||
| raise("Missing env variable: AWS_SECRET_ACCESS_KEY") | ||
|
|
||
| config :ex_aws, :s3, | ||
| scheme: "https://", | ||
| host: "fly.storage.tigris.dev", | ||
| region: "auto", | ||
| bucket: | ||
| System.get_env("BUCKET_NAME") || | ||
| raise("Missing env variable: BUCKET_NAME") | ||
| config :ex_aws, :s3, | ||
| scheme: "https://", | ||
| host: "fly.storage.tigris.dev", | ||
| region: "auto", | ||
| bucket: | ||
| System.get_env("BUCKET_NAME") || | ||
| raise("Missing env variable: BUCKET_NAME") | ||
|
|
||
| if config_env() == :prod do | ||
| database_path = | ||
| System.get_env("DATABASE_PATH") || | ||
| raise """ | ||
|
|
||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setups the minio for local development. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| services: | ||
| minio: | ||
| image: minio/minio:RELEASE.2024-11-07T00-52-20Z | ||
| container_name: goatmire-minio | ||
| ports: | ||
| - "9000:9000" | ||
| - "9001:9001" | ||
| environment: | ||
| MINIO_ROOT_USER: minioadmin | ||
| MINIO_ROOT_PASSWORD: minioadmin | ||
| command: server /data --console-address ":9001" | ||
| volumes: | ||
| - minio-data:/data | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 5 | ||
|
|
||
| create-bucket: | ||
| image: minio/mc:RELEASE.2025-08-13T08-35-41Z | ||
| container_name: goatmire-create-bucket | ||
| depends_on: | ||
| minio: | ||
| condition: service_healthy | ||
| entrypoint: > | ||
| /bin/sh -c " | ||
| mc alias set local http://minio:9000 minioadmin minioadmin; | ||
| mc mb local/goatmire --ignore-existing; | ||
| mc anonymous set public local/goatmire; | ||
| exit 0; | ||
| " | ||
|
|
||
| volumes: | ||
| minio-data: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| defmodule Goatmire.GallerySlideshow do | ||
| use GenServer | ||
|
|
||
| require Logger | ||
|
|
||
| alias Goatmire.Media | ||
|
|
||
| def start_link(opts \\ []) do | ||
|
|
@@ -16,13 +18,22 @@ defmodule Goatmire.GallerySlideshow do | |
| end | ||
|
|
||
| @impl true | ||
| def handle_info(:update, state) do | ||
| [image | rest] = | ||
| case state.photos do | ||
| [] -> Media.list_approved_images() |> Enum.shuffle() | ||
| photos -> photos | ||
| end | ||
| def handle_info(:update, %{photos: []} = state) do | ||
| case Media.list_approved_images() |> Enum.shuffle() do | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix when not approved photos |
||
| [] -> | ||
| Logger.warning("No approved images available for slideshow") | ||
| {:noreply, state} | ||
|
|
||
| [image | rest] -> | ||
| broadcast_and_update(image, rest, state) | ||
| end | ||
| end | ||
|
|
||
| def handle_info(:update, %{photos: [image | rest]} = state) do | ||
| broadcast_and_update(image, rest, state) | ||
| end | ||
|
|
||
| defp broadcast_and_update(image, rest, state) do | ||
| GoatmireWeb.Endpoint.broadcast("device_gallery", "image", %{ | ||
| url: Goatmire.Utils.presigned_url(image.dithered_key) | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allows local development in your local network