From 20927eea5febecad74b5b7fab3d4d348071d5317 Mon Sep 17 00:00:00 2001 From: Min Zeya Phyo Date: Tue, 28 Jul 2026 02:31:48 +0800 Subject: [PATCH] feat(ntfy): add initializer, Kamal accessory container, seed defaults --- config/deploy.yml | 39 ++++++++++++++++--------------------- config/initializers/ntfy.rb | 4 ++++ db/seeds.rb | 6 +++++- 3 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 config/initializers/ntfy.rb diff --git a/config/deploy.yml b/config/deploy.yml index af86a72..a10771d 100644 --- a/config/deploy.yml +++ b/config/deploy.yml @@ -35,6 +35,7 @@ registry: env: secret: - RAILS_MASTER_KEY + - NTFY_AUTH_FILE clear: # 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. @@ -53,6 +54,8 @@ env: # Log everything from Rails # RAILS_LOG_LEVEL: debug + NTFY_SERVER_URL: "http://192.168.0.1:8090" + # Aliases are triggered with "bin/kamal ". You can overwrite arguments on invocation: # "bin/kamal logs -r job" will tail logs from the first server in the job section. aliases: @@ -92,25 +95,17 @@ builder: # user: app # Use accessory services (secrets come from .kamal/secrets). -# accessories: -# db: -# image: mysql:8.0 -# host: 192.168.0.2 -# # Change to 3306 to expose port to the world instead of just local network. -# port: "127.0.0.1:3306:3306" -# env: -# clear: -# MYSQL_ROOT_HOST: '%' -# secret: -# - MYSQL_ROOT_PASSWORD -# files: -# - config/mysql/production.cnf:/etc/mysql/my.cnf -# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql -# directories: -# - data:/var/lib/mysql -# redis: -# image: redis:7.0 -# host: 192.168.0.2 -# port: 6379 -# directories: -# - data:/data +accessories: + ntfy: + image: binwiederhier/ntfy:latest + host: 192.168.0.1 + port: "127.0.0.1:8090:80" + cmd: serve + env: + clear: + NTFY_BASE_URL: "https://ntfy.app.example.com" + NTFY_LISTEN_HTTP: ":80" + secret: + - NTFY_AUTH_FILE + volumes: + - "ntfy_data:/var/lib/ntfy" diff --git a/config/initializers/ntfy.rb b/config/initializers/ntfy.rb new file mode 100644 index 0000000..e431d70 --- /dev/null +++ b/config/initializers/ntfy.rb @@ -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") diff --git a/db/seeds.rb b/db/seeds.rb index 4db034e..7f9f586 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -11,7 +11,11 @@ unless AdminUser.exists?(email: "admin@example.com") admin = AdminUser.create!( email: "admin@example.com", 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 " Email: admin@example.com"