mapguesser/README.md

113 lines
4.3 KiB
Markdown
Raw Normal View History

# MapGuesser
2023-09-25 21:23:36 +02:00
[![Build Status](https://ci.esoko.eu/job/mapguesser/job/develop/badge/icon)](https://ci.esoko.eu/job/mapguesser/job/develop/)
2021-12-22 02:21:22 +01:00
2020-06-25 15:21:58 +02:00
This is the MapGuesser Application project. This is a game about guessing where you are based on a street view panorama - inspired by existing applications.
2020-06-25 15:21:58 +02:00
## Installation
### Set environment variables
2023-09-16 23:06:39 +02:00
The `.env` file contains several environment variables that are needed by the application to work properly. These should be configured for your environment. Check `.env.example` for reference.
2020-06-25 15:21:58 +02:00
2023-09-16 23:06:39 +02:00
**Important: `DEV` should NOT be set for production! See section Development if you want to use the application in development mode.**
2021-04-29 19:50:23 +02:00
#### API keys
2020-06-25 15:21:58 +02:00
2021-04-29 19:50:23 +02:00
**You should set the API keys that enable playing the game. Without these API keys the application cannot work well. To get Google API keys visit this page: https://console.developers.google.com/**
2020-06-25 15:21:58 +02:00
2021-04-29 19:50:23 +02:00
Required Google APIs:
* **Maps JavaScript API**: for the interactive maps and street views
* **Maps Static API**: for the static map images
* **Street View Static API**: for the backend metadata requests
Required API keys:
* **GOOGLE_MAPS_SERVER_API_KEY**: this it used by the backend and should have access to **Street View Static API**
* **GOOGLE_MAPS_JS_API_KEY**: this is used by the frontend and should have access to **Maps JavaScript API** and **Maps Static API**
2021-05-08 18:30:37 +02:00
Additionally, a tile provider is also needed for map editor. This should be configured by `LEAFLET_TILESERVER_URL`, `LEAFLET_TILESERVER_SUBDOMAINS` and `LEAFLET_TILESERVER_ATTRIBUTION`. You can find some providers here: https://wiki.openstreetmap.org/wiki/Tile_servers. OpenStreetMap's tile server is fine for testing.
Example:
```
LEAFLET_TILESERVER_URL=https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
LEAFLET_TILESERVER_SUBDOMAINS=abc
LEAFLET_TILESERVER_ATTRIBUTION="&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
2021-05-08 18:30:37 +02:00
```
2020-06-25 15:21:58 +02:00
2023-09-16 23:06:39 +02:00
### Docker Compose
Create a `docker-compose.yml` file. The example code below assumes that `.env` is placed in the same folder.
2020-07-05 17:52:13 +02:00
2023-09-16 23:06:39 +02:00
```yml
version: '3'
services:
app:
image: git.esoko.eu/esoko/mapguesser:latest
depends_on:
mariadb:
condition: service_healthy
2023-09-26 21:39:49 +02:00
environment:
- USER_UID=<runner user uid>
- USER_GID=<runner user gid>
2023-09-16 23:06:39 +02:00
ports:
- 80:80
- 8090:8090
volumes:
- .env:/var/www/mapguesser/.env
mariadb:
image: mariadb:10.3
volumes:
- mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: 'root'
MYSQL_DATABASE: 'mapguesser'
MYSQL_USER: 'mapguesser'
MYSQL_PASSWORD: 'mapguesser'
healthcheck:
test: ["CMD-SHELL", "mysqladmin -u $$MYSQL_USER -p$$MYSQL_PASSWORD ping -h localhost || exit 1"]
start_period: 5s
start_interval: 1s
interval: 5s
timeout: 5s
retries: 5
volumes:
mysql:
2020-07-05 17:52:13 +02:00
```
2023-09-16 23:06:39 +02:00
Execute the following command:
```bash
docker compose up -d
2020-07-05 17:52:13 +02:00
```
2020-06-25 15:21:58 +02:00
2023-09-16 23:06:39 +02:00
**And you are done!** The application is ready to use. You can create the first administrative user with the following command after attaching to the `app` container:
2020-06-25 15:21:58 +02:00
```
2023-09-25 21:24:10 +02:00
./mapg user:add EMAIL USERNAME PASSWORD admin
2020-06-25 15:21:58 +02:00
```
2023-09-16 23:06:39 +02:00
## Development
2021-04-29 19:50:23 +02:00
2023-09-16 23:06:39 +02:00
### Set environment variables
2021-04-29 19:50:23 +02:00
2023-09-16 23:06:39 +02:00
`.env.example` should be copied to `.env` into the repo root. Only the variables for external dependencies (API keys, map attribution, etc.) should be adapted in. All other variables (for DB connection, static root, mailing, multiplayer, etc.) are fine with the default value. **`DEV=1` should be set for development!**
### Docker Compose
2023-09-26 21:39:49 +02:00
Set the following environment variables in your shell:
* `USER_UID`: your user ID
* `USER_GID`: your user's group ID
2023-09-16 23:06:39 +02:00
Execute the following command from the repo root:
```bash
docker compose up -d
2021-04-29 19:50:23 +02:00
```
2020-06-25 15:21:58 +02:00
2023-09-16 23:06:39 +02:00
**And you are done!** You can reach the application on http://localhost. The mails that are sent by the application can be found on http://localhost:8080. If needed, the database server can be directly reached on localhost:3306, or you can use Adminer web interface on http://localhost:9090
You might have to attach to the `app` container, e.g. for creating users, `composer update`, etc.
2020-06-25 15:21:58 +02:00
---
*License: **GNU AGPL 3.0**. Full license text can be found in file `LICENSE`.*