├── Readme.md ├── docker ├── .env ├── Readme.md ├── docker-compose-traefik.yml ├── docker-compose.yml ├── dockerfile-nginx ├── dockerfile-php ├── dockerfile-tcp-udp-bridge └── nginx.conf ├── mqtt-bridge ├── Readme.md ├── config │ ├── Readme.md │ ├── accesscontrol.txt │ ├── mosquitto.conf │ └── password.txt ├── docker-compose.yml ├── dockerfile-mqtt-bridge └── src │ └── mqtt-bridge.go ├── tcp_udp_http_bridge ├── Readme.md ├── devices.config ├── encrypt_psk.config ├── gps_utils.go ├── http_client.go └── tcp_udp_server.go └── webapp ├── .htaccess ├── admin ├── .htaccess └── index.php ├── auth ├── .htaccess └── .htpasswd ├── css └── gpstracker.css ├── db └── .htaccess ├── html ├── .htaccess ├── admin_html.template ├── confirm_html.template ├── getid_html.template └── gpxviewer_html.template ├── icons ├── favicon.ico ├── icon.svg ├── icon_180.png ├── icon_192.png └── icon_512.png ├── index.php ├── js └── readme.txt └── scripts ├── .htaccess ├── admin.php ├── cmdline.php ├── config.php ├── db.php ├── gpstracker.php ├── tcp_service.php ├── utils.php └── webpages.php /Readme.md: -------------------------------------------------------------------------------- 1 | Simple GPS Data Server 2 | ====================== 3 | 4 | Collect the GPS position from devices (smart phone, GPS tracker), store in a SQLite database and allow to display on a map (OSM or Google). 5 | - Data are received from the device either via HTTPS (PHP) or a tcp/udp packet (GO server) 6 | - Stored tracks can be downloaded as a GPX file 7 | - Simple admin interface to add and edit new devices 8 | 9 | Requirements 10 | ------------ 11 | - Webserver (Apache or similar), which supports authentification (for the admin page) 12 | - PHP with SQLITE3 API (e.g. php-sqlite3 package ) and sockets (e.g. package php-sockets) installed 13 | - GO compiler for TCP/UDP-HTTP bridge (only needed for commercial tracking devices like TK103 or GPS Logger in UDP mode). 14 | Extra package golang.org/x/crypto is required. Install with "go get golang.org/x/crypto" 15 | - java script GPXViewer by Jürgen Berkemeier (folder js/GM_utils/) 16 | 17 | Installation 18 | ------------ 19 | * Using Docker 20 | * Copy the folder `docker` to your server (rename for example to `gps-server`) 21 | * Copy the folder `webapp` (and if needed `tcp_udp_http_bridge`) into the `gps-server` directory 22 | * Follow the instructions in [the docker folder](docker/Readme.md) 23 | * Install each component separately 24 | * Copy all files in the webapp folder to the web space folder (in the following ./gpstracker/ is assumed) 25 | * Create corresponding entry in webserver config to allow web access and php to run 26 | * Adjust the top level .htaccess file (Apache), or limit access in Nginx configuration ([example nginx.conf](docker/nginx.conf)) 27 | * Set the authentification for the admin interface 28 | * In the file auth/.htpasswd a single user admin with the password changeme is included 29 | * The path to the .htpasswd file has to be adjusted in admin/.htaccess. The absolute path is required! 30 | * Update .htpasswd with new users/passwords. Best use the command line
htpasswd /path-to-htpasswd-file/.htpasswd myusername mypassword or an online generator 31 | * Edit scripts/config.php: adjust settings 32 | * Define timezone, which map to use, date/time format 33 | * Specify the time span w/o movement to be recognized as a pause 34 | * Specify the time w/o movement to start a new track 35 | * Enable or disable the start of the tcp/udp bridge GO server 36 | * Get the javascript GPXViewer from https://www.j-berkemeier.de/GPXViewer/ and copy the folder GM_Utils to gpstracker/js/ 37 | * In order to use Google maps, an API key is required search for google maps api key application 38 | * Edit the file ./js/GM_Utils/GPX2GM_Defs.js and uncomment the line containing JB.GPX2GM.GM_Api_key and add the API key as the value 39 | * TCP/UDP-HTTP-Bridge 40 | * enable/disable in scripts/config.php 41 | * compile code with GO in tcp_udp_http_bridge (go build) 42 | * copy executable to exe directory on webspace 43 | * adjust config.php accordingly (name and path of/to executable) 44 | * call admin interface to start server 45 | * add a crontab entry to check once per hour, if the server is running (requires "wget")
46 | 1 * * * * /usr/bin/wget -O /dev/null -o /dev/null https://servername/gpstracker?checkserver=SECRETKEY >/dev/null 2>&1 47 | * The database file will be created automatically 48 | 49 | Enter tracking devices 50 | ---------------------- 51 | - open page https://servername/gpstracker/admin and fill out the form 52 | 53 | View data 54 | --------- 55 | * open page https://servername/gpstracker?id=ID-of-device 56 | * optional parameter to select the time span: dt=