Skip to content

Commit 5da3e43

Browse files
pcrockettp1gp1g
andauthored
molly migration (#17)
Resolves #15 Two big upstream changes: * Molly merged unified push into the main app! No more "UP flavored app." * Mollysocket introduced VAPID support with a new QR code workflow. This adjusts docs and adds some scripts to adapt to these changes. Thanks @p1gp1g for your help. --------- Co-authored-by: sim <git@sgougeon.fr>
1 parent a1a148b commit 5da3e43

File tree

10 files changed

+131
-35
lines changed

10 files changed

+131
-35
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
fly.toml
2+
fly.toml.old

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
FROM ghcr.io/mollyim/mollysocket:latest
33

44
ENV MOLLY_WEBSERVER=false \
5+
MOLLY_VAPID_KEY_FILE=vapid.key \
56
RUST_LOG=info
67

7-
CMD [ "server" ]
8+
COPY assets/*.sh /usr/local/bin/
9+
10+
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ]
11+
CMD [ "/usr/local/bin/mollysocket", "server" ]

Makefile

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
launch: fly.toml
2-
flyctl launch --copy-config --no-public-ips --yes
2+
@flyctl launch --copy-config --no-public-ips --yes
33
.PHONY: launch
44

55
deploy:
6-
flyctl deploy
6+
@flyctl deploy
77
.PHONY: deploy
88

99
ssh:
10-
flyctl ssh console
10+
@flyctl ssh console
1111
.PHONY: ssh
1212

13+
qr:
14+
@# if your terminal background is dark:
15+
@flyctl ssh console --command "qr.sh"
16+
.PHONY: qr
17+
18+
qr-invert:
19+
@# if your terminal background is light:
20+
@flyctl ssh console --command "mollysocket qr airgapped"
21+
.PHONY: qr-invert
22+
23+
restart:
24+
@flyctl scale count 0 --process-group worker --yes
25+
@flyctl scale count 1 --process-group worker --yes
26+
.PHONY: restart
27+
1328
status:
14-
flyctl status
29+
@flyctl status
1530
.PHONY: status
1631

1732
logs:
18-
flyctl logs --no-tail
33+
@flyctl logs --no-tail
1934
.PHONY: logs
2035

2136
release:
2237
@gh release create --generate-notes --draft
2338
.PHONY: release
2439

2540
fly.toml:
26-
cp fly.template.toml fly.toml
41+
@cp fly.template.toml fly.toml

README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
Get Signal push notifications without Google Play Services, and without killing your phone's
44
battery. A secure, free, low-maintenance solution using [Fly.io](https://fly.io).
55

6-
---
7-
8-
**IMPORTANT UPDATE 2024-12-04:** Good news! Unified push has been merged into the main Molly
9-
app, and the old "unified push" flavor of the app is now deprecated. There also seem to be some
10-
usability improvements around getting it set up. That said, I don't have time to look into them
11-
now, so these instructions are now old. In the next few days I'll get around to bringing them
12-
up-to-date.
13-
14-
See [this issue](https://github.com/pcrockett/mollysocket-fly/issues/15) for more details.
15-
16-
---
17-
186
**Table of Contents:**
197

208
* [What we're building and why](doc/WHAT_WHY.md)

assets/docker-entrypoint.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
4+
gen_vapid_key() {
5+
echo "Generating VAPID key..."
6+
mollysocket vapid gen > "${MOLLY_VAPID_KEY_FILE}"
7+
}
8+
9+
main() {
10+
test -f "${MOLLY_VAPID_KEY_FILE}" || gen_vapid_key
11+
"${@}"
12+
}
13+
14+
main "${@}"

assets/qr.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
4+
RESET='\033[0m'
5+
BLACK_FOREGROUND='\033[47m'
6+
WHITE_BACKGROUND='\033[0;30m'
7+
8+
main() {
9+
echo -e "
10+
${WHITE_BACKGROUND}${BLACK_FOREGROUND}
11+
$(mollysocket qr airgapped)
12+
${RESET}
13+
"
14+
}
15+
16+
main

doc/HOWTO.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ mobile data connections.
5353

5454
### Install Molly on your Android phone
5555

56-
[Install the UnifiedPush flavor of Molly](https://github.com/mollyim/mollyim-android-unifiedpush?tab=readme-ov-file#download)
57-
on your phone and [migrate your Signal account](https://github.com/mollyim/mollyim-android/wiki/Migrating-From-Signal)
56+
[Install Molly](https://github.com/mollyim/mollyim-android?tab=readme-ov-file#download) on your
57+
phone and [migrate your Signal account](https://github.com/mollyim/mollyim-android/wiki/Migrating-From-Signal)
5858
(if necessary).
5959

6060
Also disable battery optimizations for the Molly app. And once again don't worry; Molly won't eat
@@ -65,10 +65,13 @@ your battery like the Signal app.
6565
Once Molly is all set up and running, go into notification settings in Molly and scroll down to the
6666
bottom.
6767

68-
1. Select UnifiedPush as the delivery method.
69-
2. Click on the new UnifiedPush option that appears.
70-
3. Turn on "air gapped" mode.
71-
4. Click on "Server parameters" to copy a command to the clipboard.
68+
1. Find _Delivery service_ and click on it.
69+
2. Select _UnifiedPush_. This will bring up a message about scanning a QR code.
70+
3. Come back to the git repository you cloned. Run `make qr`. This should show you a QR code.
71+
4. On your phone, click _Scan QR code_. Allow the app to use your camera, and scan the code. _If
72+
your terminal background is light (what kind of monster are you? 😉) and you have trouble
73+
scanning the QR code, try running `make qr-invert` instead._
74+
5. Click on "Server parameters" to copy a command to the clipboard.
7275

7376
Send that command to your computer where you're working somehow (for example via Signal's "Note to
7477
self" feature and the Signal Desktop app).
@@ -78,7 +81,7 @@ self" feature and the Signal Desktop app).
7881
Come back to the git repository you cloned. Run
7982

8083
```bash
81-
flyctl ssh console
84+
make ssh
8285
```
8386

8487
This will open an interactive terminal on your server. Then run
@@ -92,7 +95,7 @@ Almost done! Run `exit` to exit the SSH session and come back to your local mach
9295

9396
### Restart the server
9497

95-
Run `flyctl deploy`. This will restart the MollySocket server, which will cause MollySocket to begin
98+
Run `make restart`. This will restart the MollySocket server, which will cause MollySocket to begin
9699
monitoring the Signal service for notifications.
97100

98101
If everything is working, there's just one thing left to do:

doc/MIGRATION.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
## Legacy Molly-UP to Molly-FOSS migration notes
2+
3+
Good news! This UnifiedPush "flavor" of Molly [is no longer required](https://github.com/mollyim/mollyim-android-unifiedpush/releases/tag/v7.23.1-1.up1).
4+
UnifiedPush support has been merged into the main Molly-FOSS app.
5+
6+
**There will be no more updates for the legacy app.** To keep receiving updates, you'll need to
7+
migrate to the main Molly-FOSS app.
8+
9+
Additionally, a new version of [MollySocket](https://github.com/mollyim/mollysocket) has been
10+
released with a slightly different workflow for getting set up. I recommend that you:
11+
12+
1. [Create a new instance of MollySocket](#create-a-new-instance-of-mollysocket)
13+
2. [Migrate your Android app from the legacy version to Molly-FOSS](#migrating-to-molly-foss)
14+
3. [Restore MollySocket push notifications](#restore-mollysocket-push-notifications)
15+
3. [Destroy the old instance of MollySocket](#destroy-the-old-instance-of-mollysocket)
16+
17+
### Create a new instance of MollySocket
18+
19+
Open this repository in a terminal and run:
20+
21+
```bash
22+
mv fly.toml fly.toml.old
23+
make launch
24+
```
25+
26+
Congratulations, you should now have a second instance of MollySocket running in a new Fly app.
27+
28+
### Migrating to Molly-FOSS
29+
30+
1. [Install Molly-FOSS on your phone](https://molly.im/download/fdroid/). _Don't uninstall the old
31+
Molly-UP app yet._
32+
2. In the old Molly app, go to Chat settings and scroll down to the bottom to _Chat backups_. Click
33+
that and generate a new backup. Remember the file path where you saved the backup.
34+
3. Now go to Android's app settings page and _Disable_ the old Molly app. Don't uninstall it yet,
35+
just in case. You can uninstall it later when you're all finished and everything is working.
36+
4. Open up the new Molly-FOSS app. As you go through the welcome screens, you'll see an option to
37+
restore from a backup. Do that.
38+
39+
When the new app is running correctly, you'll need to Restore push notifications.
40+
41+
### Restore MollySocket push notifications
42+
43+
Go through the steps in the instructions starting at
44+
[step 5: Setup the Molly app for push notifications](HOWTO.md#setup-the-molly-app-for-push-notifications).
45+
46+
_Recommended: Let it run for a while to make sure you continue receiving push notifications._
47+
48+
### Destroy the old instance of MollySocket
49+
50+
1. [Login to fly.io](https://fly.io/app/sign-in)
51+
2. Click on the old MollySocket app
52+
3. Go to Settings
53+
4. Click _Delete app_.
54+
55+
Now is also probably a good time to fully uninstall the old Molly-UP app from your phone.

doc/WHAT_WHY.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ alive at all times. For some reason, Signal isn't good at doing that efficiently
99
burn through 50% of your battery in a single day.
1010

1111
Fortunately, there's [Molly](https://molly.im/), a Signal fork that is mostly marketed as "A
12-
hardened version of Signal." However the killer feature in my opinion is not the extra security, but
13-
rather [UnifiedPush](https://unifiedpush.org/) support. UnifiedPush is what allows an app to receive
14-
proper push notifications without Google Play Services and _also_ without absolutely destroying your
15-
battery life.
12+
hardened version of Signal." However the killer feature in my opinion is not the extra security,
13+
but rather [UnifiedPush](https://unifiedpush.org/) support. UnifiedPush is what allows an app to
14+
receive proper push notifications without Google Play Services and _also_ without absolutely
15+
destroying your battery life.
1616

1717
Here's an oversimplified, mostly wrong diagram that lays out how the whole system should work:
1818

@@ -44,11 +44,11 @@ to wake up Molly, which then handles actually downloading and displaying the not
4444

4545
If you think the above diagram looks like a lot of moving parts that could break, it's good to keep
4646
in mind that this is generally how Google sets up a stock Android device (instead of `ntfy.sh` you
47-
have Google Play services, etc.). The only _really_ different piece about this setup is MollySocket.
47+
have Google Play services, etc.). The only _really_ different piece about this setup is
48+
MollySocket.
4849

4950
This repository shows how to get a low-maintenance, free, [MollySocket](https://github.com/mollyim/mollysocket)
5051
instance running in "Air Gap mode" on [Fly.io](https://fly.io/). It handles the hardest part of the
51-
diagram above, making it much easier to get the [UnifiedPush flavor of Molly](https://github.com/mollyim/mollyim-android-unifiedpush)
52-
working properly.
52+
diagram above, making it much easier to get UnifiedPush for Molly working properly.
5353

5454
Next: [Getting Molly with UnifiedPush working](HOWTO.md)

fly.template.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ primary_region = "arn"
66
dockerfile = "Dockerfile"
77

88
[processes]
9-
worker = "server"
9+
worker = "mollysocket server"
1010

1111
[[mounts]]
1212
source = "mollysocket_data"

0 commit comments

Comments
 (0)