Skip to content
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
24 changes: 22 additions & 2 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ jobs:
test "$(id -u)" = "1000"
test "$(id -g)" = "1000"
test -x /app/bin/textbin
test -x /app/bin/grant-platform-admin
test -x /app/bin/migrate
touch /var/lib/textbin/pastes/.write-test
touch /var/lib/textbin/uploads/.write-test
Expand Down Expand Up @@ -260,8 +261,9 @@ jobs:
}
trap cleanup EXIT

docker run --detach --name "$container_name" --network host \
docker run --detach --name "$container_name" --network host --read-only \
--mount "type=bind,src=$tls_dir,dst=/run/secrets/textbin,readonly" \
--tmpfs /app/tmp:rw,noexec,nosuid,nodev,size=16m,mode=0700,uid=1000,gid=1000 \
-e DATABASE_URL="ecto://${DATABASE_USER}:${DATABASE_PASSWORD}@localhost:5432/textbin_container_test" \
-e SECRET_KEY_BASE="$secret_key_base" \
-e PHX_HOST=localhost \
Expand All @@ -285,4 +287,22 @@ jobs:
done

test "$ready" = "true"
curl --fail --silent --show-error --output /dev/null http://127.0.0.1:4100/
curl --fail --silent --show-error --output /dev/null http://127.0.0.1:4100/healthz
curl --fail --silent --show-error --output /dev/null http://127.0.0.1:4100/readyz

docker exec "$container_name" /app/bin/textbin rpc '
{:ok, user} = Textbin.Accounts.register_user(%{email: "admin@example.com"})
user |> Textbin.Accounts.User.confirm_changeset() |> Textbin.Repo.update!()
:ok
'
docker exec "$container_name" /app/bin/grant-platform-admin 'Admin@Example.COM'
docker exec "$container_name" /app/bin/textbin rpc '
user = Textbin.Accounts.get_user_by_email("admin@example.com")
true = user.platform_role == "admin"
Textbin.Repo.get_by!(Textbin.Administration.PlatformAuditEvent,
action: "platform.admin.bootstrap",
actor_kind: "bootstrap",
target_id: user.id
)
:ok
'
21 changes: 21 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ case storage_backend do
raise "unsupported TEXTBIN_STORAGE_BACKEND: #{inspect(unsupported)}"
end

case System.get_env("TEXTBIN_MAILER_BACKEND") do
nil ->
if mail_from_address = System.get_env("MAIL_FROM_ADDRESS") do
config :textbin, :mail_from,
name: System.get_env("MAIL_FROM_NAME") || "Textbin",
address: mail_from_address
end

"postmark" ->
config :textbin, Textbin.Mailer,
adapter: Swoosh.Adapters.Postmark,
api_key: System.fetch_env!("POSTMARK_API_KEY")

config :textbin, :mail_from,
name: System.get_env("MAIL_FROM_NAME") || "Textbin",
address: System.fetch_env!("MAIL_FROM_ADDRESS")

unsupported ->
raise "unsupported TEXTBIN_MAILER_BACKEND: #{inspect(unsupported)}"
end

if config_env() == :prod do
parse_port = fn name, default ->
case Integer.parse(System.get_env(name) || default) do
Expand Down
4 changes: 2 additions & 2 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ gate** on `main`. Review and update pinned action commit SHAs deliberately when
upgrading release dependencies. The version comments beside each SHA are
informational; the SHA is the security boundary.

After the first container publication, make the `chaba2/textbin` package public
After the first container publication, make the `chaba-dev/textbin` package public
in GitHub's package settings as described in the self-hosting guide.

## Automated flow
Expand Down Expand Up @@ -111,7 +111,7 @@ main changes
-> release/next PR
-> vMAJOR.MINOR.PATCH tag
-> GitHub Release with CLI artifacts, notes, and tag comparison
-> ghcr.io/chaba2/textbin (linux/amd64 and linux/arm64)
-> ghcr.io/chaba-dev/textbin (linux/amd64 and linux/arm64)
```

## Published CLI platforms
Expand Down
Loading
Loading