feat(ntfy): add initializer, Kamal accessory container, seed defaults

This commit is contained in:
Min Zeya Phyo
2026-07-28 02:31:48 +08:00
parent 9fa6c37297
commit 20927eea5f
3 changed files with 26 additions and 23 deletions

View File

@@ -35,6 +35,7 @@ registry:
env: env:
secret: secret:
- RAILS_MASTER_KEY - RAILS_MASTER_KEY
- NTFY_AUTH_FILE
clear: clear:
# Run the Solid Queue Supervisor inside the web server's Puma process to do jobs. # Run the Solid Queue Supervisor inside the web server's Puma process to do jobs.
# When you start using multiple servers, you should split out job processing to a dedicated machine. # When you start using multiple servers, you should split out job processing to a dedicated machine.
@@ -53,6 +54,8 @@ env:
# Log everything from Rails # Log everything from Rails
# RAILS_LOG_LEVEL: debug # RAILS_LOG_LEVEL: debug
NTFY_SERVER_URL: "http://192.168.0.1:8090"
# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation: # Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
# "bin/kamal logs -r job" will tail logs from the first server in the job section. # "bin/kamal logs -r job" will tail logs from the first server in the job section.
aliases: aliases:
@@ -92,25 +95,17 @@ builder:
# user: app # user: app
# Use accessory services (secrets come from .kamal/secrets). # Use accessory services (secrets come from .kamal/secrets).
# accessories: accessories:
# db: ntfy:
# image: mysql:8.0 image: binwiederhier/ntfy:latest
# host: 192.168.0.2 host: 192.168.0.1
# # Change to 3306 to expose port to the world instead of just local network. port: "127.0.0.1:8090:80"
# port: "127.0.0.1:3306:3306" cmd: serve
# env: env:
# clear: clear:
# MYSQL_ROOT_HOST: '%' NTFY_BASE_URL: "https://ntfy.app.example.com"
# secret: NTFY_LISTEN_HTTP: ":80"
# - MYSQL_ROOT_PASSWORD secret:
# files: - NTFY_AUTH_FILE
# - config/mysql/production.cnf:/etc/mysql/my.cnf volumes:
# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql - "ntfy_data:/var/lib/ntfy"
# directories:
# - data:/var/lib/mysql
# redis:
# image: redis:7.0
# host: 192.168.0.2
# port: 6379
# directories:
# - data:/data

View File

@@ -0,0 +1,4 @@
# ntfy notification server configuration
# Default server URL used when AdminUser.ntfy_server_url is blank.
# In production, set this to your self-hosted ntfy instance.
NTFY_SERVER_URL = ENV.fetch("NTFY_SERVER_URL", "https://ntfy.sh")

View File

@@ -11,7 +11,11 @@ unless AdminUser.exists?(email: "admin@example.com")
admin = AdminUser.create!( admin = AdminUser.create!(
email: "admin@example.com", email: "admin@example.com",
password: "password123", password: "password123",
name: "Admin User" name: "Admin User",
ntfy_enabled: false,
ntfy_topic: nil,
ntfy_token: nil,
ntfy_server_url: nil
) )
puts "✅ Created Admin User" puts "✅ Created Admin User"
puts " Email: admin@example.com" puts " Email: admin@example.com"