Skip to content

13.push

OPTIONAL

Push notification service

  1. Install dependencies

    shell cd /opt/rbt/server/services/push npm install

  2. Make file environment ".env" and edit vars

    shell cp .env_example .env

  3. Put your FCM and APN files into "assets" folder

assets/pushServiceAccountKey.json assets/certificate-and-privatekey.pem

pushServiceAccountKey.json - data from Firebase Cloud Messaging (FCM)

certificate-and-privatekey.pem - certificate for Apple's VoIP APN

shell openssl pkcs12 -in <YOUR-VOIP-CERTIFICATE>.p12 -out assets/certificate-and-privatekey.pem -nodes -legacy

  1. Add user and group:

    shell groupadd rbt useradd -g rbt -s /bin/true -d /dev/null rbt

  2. Make logging dir:

    shell mkdir -p /var/log/rbt_push_service/ chown -R rbt:rbt /var/log/rbt_push_service/

  3. Make logrotate:

    shell echo '/var/log/rbt_push_service/*.log { daily missingok rotate 7 compress notifempty copytruncate dateext dateformat -%Y-%m-%d }' | tee /etc/logrotate.d/rbt_push

    Restart service

    shell systemctl restart logrotate

  4. Make service:

    shell ln -sf /opt/rbt/server/services/push/push.service /usr/lib/systemd/system/push@.service

  5. Enable and start service

    shell systemctl enable push@0.service --now

Next