R
Railway6mo ago
yann

Run ntfy.sh on Railway

Does anyone run ntfy.sh on Railway and could share their Dockerfile / deploy commands? https://docs.ntfy.sh/install/#docker
Installation - ntfy
Send push notifications to your phone via PUT/POST
13 Replies
Percy
Percy6mo ago
Project ID: 4777e174-d2c3-4955-bb26-7510d6ed462a
yann
yann6mo ago
4777e174-d2c3-4955-bb26-7510d6ed462a
Brody
Brody6mo ago
their yaml file lays out how you would go about deploying on railway
version: '3'
services:
ntfy:
image: binwiederhier/ntfy
restart: unless-stopped
environment:
NTFY_BASE_URL: http://ntfy.example.com
NTFY_CACHE_FILE: /var/lib/ntfy/cache.db
NTFY_AUTH_FILE: /var/lib/ntfy/auth.db
NTFY_AUTH_DEFAULT_ACCESS: deny-all
NTFY_BEHIND_PROXY: true
NTFY_ATTACHMENT_CACHE_DIR: /var/lib/ntfy/attachments
NTFY_ENABLE_LOGIN: true
volumes:
- ./:/var/lib/ntfy
ports:
- 80:80
command: serve
version: '3'
services:
ntfy:
image: binwiederhier/ntfy
restart: unless-stopped
environment:
NTFY_BASE_URL: http://ntfy.example.com
NTFY_CACHE_FILE: /var/lib/ntfy/cache.db
NTFY_AUTH_FILE: /var/lib/ntfy/auth.db
NTFY_AUTH_DEFAULT_ACCESS: deny-all
NTFY_BEHIND_PROXY: true
NTFY_ATTACHMENT_CACHE_DIR: /var/lib/ntfy/attachments
NTFY_ENABLE_LOGIN: true
volumes:
- ./:/var/lib/ntfy
ports:
- 80:80
command: serve
if you give me some time ill try my hand at making a template for you @yann - here you go! https://railway.app/template/AYXXPG if you need to change any configurations, the environment variables for ntfy can be found here https://docs.ntfy.sh/config/#config-options
yann
yann6mo ago
Hey, the template works. Is the source code of the template published anywhere? Would love to see how it looks like. By the way, to use ntfy effectively, it's required to run some commands on the instance. For example to configure auth roles. Do you know if it's possible to connect to the deployed container and run commands on it?
Brody
Brody6mo ago
templates don't have source code, there's no coding involved, but you can use this tool to view the config of the template https://bookmarklets.up.railway.app/template-info/ railway doesn't provide any kind of ssh access to containers.
yann
yann6mo ago
So the only way to run these commands would be to make them part of the start command?
Brody
Brody6mo ago
correct
yann
yann6mo ago
I see now that the auth commands for ntfy are interactive. (https://docs.ntfy.sh/config/#example-private-instance) That basically means that ntfy cannot be deployed on railway with auth?
Configuration - ntfy
Send push notifications to your phone via PUT/POST
Brody
Brody6mo ago
does it not provide a flag for the password?
yann
yann6mo ago
Update: It is possible to set NTFY_PASSWORD which determines the password for the next added user. You can then create an admin user like this: ntfy user add --role=admin name
yann
yann6mo ago
With this admin user you can do some basic user management through the API: https://github.com/binwiederhier/ntfy/issues/722#issuecomment-1546789275
GitHub
[Feature Request] Disable topic subscriptions through admin API · I...
Hello mate, For a small startup business that a friend and I have been creating and which would integrate your cool notication service, we got a little feature request for NTFY.sh that allows manag...
yann
yann6mo ago
It is quite inconvenient to re-deploy the container every time you want to run a command. Is there really no other way?
Brody
Brody6mo ago
there isn't and personally I wouldn't be trying to use the start command as a command input box the better option would be to write a Dockerfile thats based on the ntfy image and then run all the needed commands from a bash/sh script so it's all setup in a single deploy