ulogger-server/README.md

102 lines
6.3 KiB
Markdown
Raw Permalink Normal View History

2022-03-20 18:35:34 +01:00
# ![ulogger_logo_small](https://cloud.githubusercontent.com/assets/3366666/24080878/0288f046-0ca8-11e7-9ffd-753e5c417756.png)μlogger   [![Build Status](https://github.com/bfabiszewski/ulogger-server/workflows/Tests/badge.svg)](https://github.com/bfabiszewski/ulogger-server/actions)
2017-03-16 12:46:22 +01:00
2017-04-10 22:46:56 +02:00
This is a web application for real-time collection of geolocation data, tracks viewing and management.
2017-03-16 12:46:22 +01:00
Together with a dedicated [μlogger mobile client](https://github.com/bfabiszewski/ulogger-android) it may be used as a complete self hosted serverclient solution for logging and monitoring users' geolocation.
2013-06-19 13:27:14 +02:00
2017-03-16 12:46:22 +01:00
## Live demo:
2021-02-21 20:42:57 +01:00
- https://ulogger.lima.zone
2020-05-22 20:44:09 +02:00
- for testing track upload with Android app or track editing login with user: demo, password: demo
2021-02-21 20:42:57 +01:00
- hosted by lima-city.de
2013-06-19 13:27:14 +02:00
2020-02-19 19:26:19 +01:00
## Minimum requirements:
- PHP 5.5
2019-10-05 08:44:52 +02:00
- PHP extensions: ctype, json, pdo (with respective drivers), session, simplexml, xmlwriter, xdebug (only for tests)
2019-01-30 23:36:04 +01:00
- MySQL, PostgreSQL or SQLite (over PDO driver)
2013-06-23 23:53:19 +02:00
- browser with javascript enabled, cookies for authentication and saving preferences
2013-06-19 13:27:14 +02:00
2017-03-16 12:46:22 +01:00
## Features:
2013-06-19 13:27:14 +02:00
- simple
- allows live tracking
- track statistics
- altitudes graph
- multiple users
- user authentication
2019-02-22 20:22:27 +01:00
- Google Maps
- OpenLayers (OpenStreet and other layers)
2013-06-23 23:53:19 +02:00
- user preferences stored in cookies
2017-03-16 12:46:22 +01:00
- simple admin menu
2017-05-10 14:59:52 +02:00
- export tracks to gpx and kml
- import tracks from gpx
2013-06-19 13:27:14 +02:00
2017-04-04 17:03:58 +02:00
## Install
2017-04-17 13:15:44 +02:00
- Download zipped archive or clone the repository on your computer
- Move it to your web server directory (unzip if needed)
2020-01-08 21:01:53 +01:00
- Fix folder permissions: `uploads` folder (for uploaded images) should be writeable by PHP scripts
- In case of development version it is necessary to build javascript bundle from source files. You will need to install `npm` and run `npm install` and `npm run build` in root folder
2019-10-05 08:44:52 +02:00
- Create database and database user (at least SELECT, INSERT, UPDATE, DELETE privileges, CREATE, DROP for setup script, SEQUENCES for postgreSQL)
2017-04-17 13:15:44 +02:00
- Create a copy of `config.default.php` and rename it to `config.php`. Customize it and add database credentials
- Edit `scripts/setup.php` script, enable it by setting [$enabled](https://github.com/bfabiszewski/ulogger-server/blob/master/scripts/setup.php#L21) value to `true`
2019-02-22 20:22:27 +01:00
- Make sure you have a web server running with PHP and chosen database
2017-04-17 13:15:44 +02:00
- Open http://YOUR_HOST/ulogger-server/scripts/setup.php page in your browser
- Follow instructions in setup script. It will add database tables and set up your μlogger user
- **Remember to remove or disable `scripts/setup.php` script**
- Log in with your new user on http://YOUR_HOST/ulogger-server/
2020-05-22 20:44:09 +02:00
- You may also want to set your new user as an [admin in config file](https://github.com/bfabiszewski/ulogger-server/blob/v0.2/config.default.php#L67)
- Folders `.docker/` and `.tests/` as well as composer files are needed only for development. May be safely removed
2017-04-04 17:03:58 +02:00
2020-02-17 18:51:27 +01:00
## Upgrade to version 1.x
2020-05-20 17:12:07 +02:00
- Incompatible changes include database and config file changes
- Upgrading manually:
- for database changes, see MySQL example script in `scripts/migrate_to_1_x.mysql`
- set `admin` column in `users` table to true for admin users
- edit configuration from application settings dialog
- Upgrading with migration script from version 0.6:
- create database backup
- replace all project files with new ones, but keep old local config file: `config.php`
- change directory to application root folder and run migration script from the console: `php scripts/migrate_to_1_x.php`
- the script will update database schema and save old config variables to database
- Additional tasks after manual or script update:
- edit your `config.php` file and remove all variables except database settings, see [config.default.php](https://github.com/bfabiszewski/ulogger-server/blob/master/config.default.php) for valid values
- make sure `uploads` folder (for images uploaded from client app) is writable by PHP
- clear browser cache and restart web page
2020-02-17 18:51:27 +01:00
2017-08-08 18:47:43 +02:00
## Docker
2020-05-22 20:44:09 +02:00
- Run `docker run --name ulogger -p 8080:80 -d bfabiszewski/ulogger` and access `http://localhost:8080` in your browser. Log in with `admin`:`admin` credentials and change default password
- Optional configuration options with ENV variables, for list see [Dockerfile](https://github.com/bfabiszewski/ulogger-server/blob/master/Dockerfile). The variables correspond to main μlogger configuration parameteres
- For example: `docker run --name ulogger -e ULOGGER_LANG="pl" -p 8080:80 -d bfabiszewski/ulogger`
- You may also build the image yourself. Run `docker build .` from the root folder where `Dockerfile` reside. There are optional build-time arguments that allow you to set default database passwords for root and ulogger users
- For example: `docker build --build-arg DB_ROOT_PASS=secret1 --build-arg DB_USER_PASS=secret2 --build-arg DB_DRIVER=sqlite .`
2021-04-22 19:47:52 +02:00
- Docker was created to facilitate development and testing. It is not production ready. If you want to use it in production, you will have to adjust it to your needs.
2017-08-08 18:47:43 +02:00
2017-09-06 22:12:49 +02:00
## Tests
2021-04-22 19:47:52 +02:00
- Install tests dependecies. PHP tests require PHP >= 7.3.
2017-09-06 22:12:49 +02:00
- `composer install`
2020-01-08 21:01:53 +01:00
- `npm install`
2020-05-22 20:44:09 +02:00
- Integration tests may be run against docker image. We need exposed http and optionally database ports (eg. mapped to localhost 8080 and 8081). Below example for MySQL setup
2017-09-06 22:12:49 +02:00
- `docker build -t ulogger .`
2019-10-05 08:44:52 +02:00
- `docker run -d --name ulogger -p 8080:80 -p 8081:3306 --expose 3306 -e ULOGGER_ENABLE_SETUP=1 ulogger`
2017-09-06 22:12:49 +02:00
- Use environment variables (or create `.env` file in `.tests/` folder) to set up connection details (below database credentials are docker defaults)
- `DB_DSN="mysql:host=127.0.0.1;port=8081;dbname=ulogger;charset=utf8"`
2017-09-06 22:12:49 +02:00
- `DB_USER=ulogger`
- `DB_PASS=secret2`
- `ULOGGER_URL="http://127.0.0.1:8080"`
2020-01-08 21:01:53 +01:00
- PHP tests
2021-04-22 19:47:52 +02:00
- `XDEBUG_MODE=coverage ./vendor/bin/phpunit -c .tests/phpunit.xml`
2020-01-08 21:01:53 +01:00
- JS tests
- `npm test`
- Other tests
- `npm run lint:js`
- `npm run lint:css`
2013-06-19 13:27:14 +02:00
2019-01-30 22:03:58 +01:00
## Translations
2020-05-22 20:44:09 +02:00
- translations may be contributed via [Transifex](https://www.transifex.com/bfabiszewski/ulogger/)
2019-05-23 14:14:40 +02:00
## Donate
2019-05-23 14:18:33 +02:00
[![Donate paypal](https://img.shields.io/badge/donate-paypal-green.svg)](https://www.paypal.me/bfabiszewski)
![Donate bitcoin](https://img.shields.io/badge/donate-bitcoin-green.svg) `bc1qt3uwhze9x8tj6v73c587gprhufg9uur0rzxhvh`
![Donate ethereum](https://img.shields.io/badge/donate-ethereum-green.svg) `0x100C31C781C8124661413ed6d1AA9B1e2328fFA2`
2019-01-30 22:03:58 +01:00
2017-03-16 12:46:22 +01:00
## License
2013-06-19 13:27:14 +02:00
- GPL
2017-04-10 22:46:56 +02:00
- most icons come from [iconmonstr](https://iconmonstr.com)