mirror of https://github.com/zulip/zulip.git
management: Provide a way to deactivate the push registration.
This commit is contained in:
parent
4e66e8742f
commit
57c083a4e9
|
@ -287,10 +287,50 @@ If you'd like to rotate your server's API key for this service
|
||||||
generate a new `zulip_org_key` and store that new key in
|
generate a new `zulip_org_key` and store that new key in
|
||||||
`/etc/zulip/zulip-secrets.conf`.
|
`/etc/zulip/zulip-secrets.conf`.
|
||||||
|
|
||||||
|
## Deactivating your server's registration
|
||||||
|
|
||||||
|
If you are deleting your Zulip server or otherwise no longer want to
|
||||||
|
use the Mobile Push Notification Service, you can deactivate your server's
|
||||||
|
registration.
|
||||||
|
|
||||||
|
1. [Cancel any paid
|
||||||
|
plans](https://zulip.com/help/self-hosted-billing#cancel-paid-plan)
|
||||||
|
associated with your server.
|
||||||
|
|
||||||
|
1. Run the deregistration command. If you installed Zulip directly on
|
||||||
|
the server (without Docker), run as root:
|
||||||
|
|
||||||
|
```
|
||||||
|
su zulip -c '/home/zulip/deployments/current/manage.py register_server --deactivate'
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if you're using Docker, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker exec -it -u zulip <container_name> /home/zulip/deployments/current/manage.py register_server --deactivate
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Comment out the
|
||||||
|
`PUSH_NOTIFICATION_BOUNCER_URL = 'https://push.zulipchat.com'` line
|
||||||
|
in your `/etc/zulip/settings.py` file (i.e., add `# ` at the
|
||||||
|
start of the line), and [restart your Zulip
|
||||||
|
server](settings.md#making-changes).
|
||||||
|
|
||||||
|
If you ever need to reactivate your server's registration, [contact Zulip
|
||||||
|
support](https://zulip.com/help/contact-support).
|
||||||
|
|
||||||
|
### Pausing use of the Mobile Push Notification Service
|
||||||
|
|
||||||
|
You can temporarily stop using the Mobile Push Notification Service. Comment out
|
||||||
|
the `PUSH_NOTIFICATION_BOUNCER_URL = 'https://push.zulipchat.com'` line in your
|
||||||
|
`/etc/zulip/settings.py` file (i.e., add `# ` at the start of the line), and
|
||||||
|
[restart your Zulip server](settings.md#making-changes). This approach makes it
|
||||||
|
easy to start using the service again by uncommenting the same line.
|
||||||
|
|
||||||
## Sending push notifications directly from your server
|
## Sending push notifications directly from your server
|
||||||
|
|
||||||
This section documents an alternative way to send push notifications
|
This section documents an alternative way to send push notifications
|
||||||
that does not involve using the Mobile Push Notifications Service at
|
that does not involve using the Mobile Push Notification Service at
|
||||||
the cost of needing to compile and distribute modified versions of the
|
the cost of needing to compile and distribute modified versions of the
|
||||||
Zulip mobile apps.
|
Zulip mobile apps.
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,11 @@ from requests.models import Response
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
from zerver.lib.management import ZulipBaseCommand, check_config
|
from zerver.lib.management import ZulipBaseCommand, check_config
|
||||||
from zerver.lib.remote_server import PushBouncerSession, send_server_data_to_push_bouncer
|
from zerver.lib.remote_server import (
|
||||||
|
PushBouncerSession,
|
||||||
|
send_json_to_push_bouncer,
|
||||||
|
send_server_data_to_push_bouncer,
|
||||||
|
)
|
||||||
|
|
||||||
if settings.DEVELOPMENT:
|
if settings.DEVELOPMENT:
|
||||||
SECRETS_FILENAME = "zproject/dev-secrets.conf"
|
SECRETS_FILENAME = "zproject/dev-secrets.conf"
|
||||||
|
@ -28,11 +32,17 @@ class Command(ZulipBaseCommand):
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Agree to the Zulipchat Terms of Service: https://zulip.com/policies/terms.",
|
help="Agree to the Zulipchat Terms of Service: https://zulip.com/policies/terms.",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
action = parser.add_mutually_exclusive_group()
|
||||||
|
action.add_argument(
|
||||||
"--rotate-key",
|
"--rotate-key",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Automatically rotate your server's zulip_org_key",
|
help="Automatically rotate your server's zulip_org_key",
|
||||||
)
|
)
|
||||||
|
action.add_argument(
|
||||||
|
"--deactivate",
|
||||||
|
action="store_true",
|
||||||
|
help="Deregister the server; this will stop mobile push notifications",
|
||||||
|
)
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def handle(self, *args: Any, **options: Any) -> None:
|
def handle(self, *args: Any, **options: Any) -> None:
|
||||||
|
@ -58,6 +68,11 @@ class Command(ZulipBaseCommand):
|
||||||
"in /etc/zulip/settings.py (remove the '#')"
|
"in /etc/zulip/settings.py (remove the '#')"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if options["deactivate"]:
|
||||||
|
send_json_to_push_bouncer("POST", "server/deactivate", {})
|
||||||
|
print("Mobile Push Notification Service registration successfully deactivated!")
|
||||||
|
return
|
||||||
|
|
||||||
request = {
|
request = {
|
||||||
"zulip_org_id": settings.ZULIP_ORG_ID,
|
"zulip_org_id": settings.ZULIP_ORG_ID,
|
||||||
"zulip_org_key": settings.ZULIP_ORG_KEY,
|
"zulip_org_key": settings.ZULIP_ORG_KEY,
|
||||||
|
|
Loading…
Reference in New Issue