Find My Device
An open source app that remote controls by sms and web interface the android device by means of getting the curent location, the location history,make it ring,get stats,or completely wipe/factory rreset it.
At its core, FMD is just a binary that you can run directly.
here we will see how to selfhost the server running the service with systemd but also athe docker-compose implemntation
Systemd
1) requires go lang installed on the host machine
i had to install it over aur on manjaro arm
sudo pacman -S yay
yay install -S go
debian
sudo apt install golang-go
or if you dont like package manager from source
https://golang.org/doc/install
2) clone the repo
git clone https://gitlab.com/Nulide/findmydeviceserver.git
or download and extract the source
https://gitlab.com/Nulide/findmydeviceserver/-/releases
3) navigate on the apropriate cloned/extracted folder
cd ~/findmydeviceserver/src
4) build the project
sudo go build fmdserver.go
5) test that it runs smooth
~/findmydeviceserver/src/fmdserver
6) navigate to localhost:1020
7) stop the server
ctrl + c
8) edit the .service file
nano etc/systemd/system/fmdserver.service
replace the executable filepath
ExecStart=/home/user/findmydeviceserver/src/fmdserver
filepath have to be ansolute . replace user with your username
9) copy file to systemd
sudo cp /home/ippo/findmydeviceserver/src/etc/systemd/system/fmdserver.service /usr/lib/systemd/system/fmdserver.service
10) start the service
sudo systemctl start fmdserver
11) enable the service
sudo systemctl enable fmdserver
12) for https i am using caddy and reverse proxying the unsecure 1020 port with another port as caddy adds automaticly the certificate and encryption
sudo nano /etc/caddy/Caddyfile
add
your.domain.name:an.open.router.port {
reverse_proxy localhost:1020
}
so if lets say you have a ddns names ippo.cratis.net and have opened 8000 port on your router and port forwording that port on your raspberry/linux machine that caddyfile should look like
ippo.cratis.net:8000 {
reverse_proxy localhost:1020
}
now you can saffely access your fmd server froom ippo.cratis.net:8000
Docker Compose
1
2
3
4
5
6
7
8
9
10
11
12
docker-compose.yml
version: '3'
services:
fmd:
build: https://gitlab.com/Nulide/findmydeviceserver.git#v0.4.0
container_name: fmd
ports:
- 127.0.0.1:8080:8080
volumes:
- './data:/fmd/objectbox/'
restart: unless-stopped
Replace the version with the latest release.
- Persisting storage:
-
FMD has a database and needs to persist it across container restarts. You need to mount a Docker volume at /fmd/objectbox/ inside the container. It must be readable and writable by uid 1000 (ideally it is owned by uid 1000). This example mounts a folder named ./data (in the current directory outside the container).
-
Networking: FMD Server listens for HTTP connections on port 8080. This example has a port mapping from “127.0.0.1:8080” (on the host) to port 8080 (inside the container).
- Reverse Proxy
With Caddy:
Caddyfile
fmd.example.com {
reverse_proxy localhost:8080
}
Caddy will automatically create a Let’s Encrypt certificate for you.