Go to file
Pőcze Bence ee144f7277
Some checks failed
mapguesser/pipeline/pr-develop There was a failure building this commit
default-pipeline default-pipeline #13
add Jenkinsfile and Dockerfile-test
2021-12-22 01:44:54 +01:00
.vscode MAPG-203 add debugger config for NodeJS 2021-03-20 19:44:48 +01:00
cache MAPG-89 add cache folder that can hold cache files 2020-06-27 00:44:38 +02:00
database MAPG-235 added time limit type field to the challenge 2021-05-19 14:52:49 +02:00
docker add Jenkinsfile and Dockerfile-test 2021-12-22 01:44:54 +01:00
mail MAPG-185 consolidation of email templates 2020-07-05 17:37:02 +02:00
multi fix typo 2021-04-29 00:58:20 +02:00
public MAPG-235 replaced explicit margin-top and margin-bottom with marginTop and marginBottom classes 2021-05-28 08:36:45 +02:00
scripts create the first user during installation in development mode 2021-04-29 20:02:00 +02:00
src MAPG-240 add use for PlaceInChallenge (used in MapAdminController::deleteChallenge) 2021-05-29 00:57:59 +02:00
tests MAPG-199 move test views to another folder to prevent code analysis errors 2020-07-05 23:18:57 +02:00
views MAPG-235 replaced explicit margin-top and margin-bottom with marginTop and marginBottom classes 2021-05-28 08:36:45 +02:00
.env.example MAPG-143 make it possible to disable game for guests (default is disable) 2021-05-10 19:10:09 +02:00
.gitattributes MAPG-81 update .gitattributes to store PNG files with Git LFS 2020-05-30 23:16:31 +02:00
.gitignore MAPG-203 add node_modules to gitignore 2021-03-17 23:09:07 +01:00
bitbucket-pipelines.yml MAPG-2020 run PHPStan with 1G memory limit 2021-01-01 22:34:32 +01:00
composer.json MAPG-203 add new Composer packages 2021-03-20 19:44:47 +01:00
composer.lock MAPG-203 add new Composer packages 2021-03-20 19:44:47 +01:00
docker-compose.yml MAPG-203 restructure Docker stack 2021-03-20 19:44:48 +01:00
Jenkinsfile add Jenkinsfile and Dockerfile-test 2021-12-22 01:44:54 +01:00
LICENSE.md MAPG-78 change license to AGPL and include the license 2020-05-30 01:42:14 +02:00
main.php MAPG-142 redefine tokens and increase OAuth security with nonce 2020-07-05 14:24:05 +02:00
mapg MAPG-185 rename migrate database command 2020-07-05 16:45:38 +02:00
phpstan.neon MAPG-199 add static code analysis step to pipeline 2020-07-05 22:51:36 +02:00
README.md give example for LEAFLET_TILESERVER_ATTRIBUTION 2021-05-09 17:11:51 +02:00
USED_SOFTWARE MAPG-73 add license of Boostrap Icons 2020-05-30 17:39:45 +02:00
web.php MAPG-235 new challenge can be created and is prepared 2021-05-12 13:51:06 +02:00

MapGuesser

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.

Installation

Clone the Git repository

The first step is obviously cloning the repository to your machine:

git clone https://gitea.e5tv.hu/esoko/mapguesser.git

All the commands listed here should be executed from the repository root.

The easiest way to build up a fully working application with web server and database is to use Docker Compose with the included docker-compose.yml.

All you have to do is executing the following command:

docker-compose up -d

Attach shell to the container of mapguesser_app:

docker exec -it mapguesser_app_1 bash

All of the following commands should be executed there.

Manual setup (alternative)

If you don't use the Docker stack you need to install your environment manually. Check docker-compose.yml and docker/Dockerfile to see the system requirements.

Initialize project

This command installes all of the Composer requirements and creates a copy of the example .env file.

composer create-project

Set environment variables

The .env file contains several environment variables that are needed by the application to work properly. These should be configured for your environment.

One very important variable is DEV. This indicates that the application operates in development (staging) and not in production mode.

Hint: If you install the application in the Docker stack for development (staging) environment, only the variables for external dependencies (API keys, map attribution, etc.) should be adapted. All other variables (for DB connection, static root, mailing, multiplayer, etc.) are fine with the default value.

API keys

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/

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

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"

(Production only) Create cron job

To maintain database (delete inactive users, old sessions etc.), the command db:maintain should be regularly executed. It is recommended to create a cron job that runs every hour:

0 * * * * /path/to/your/installation/mapg db:maintain >>/var/log/cron-mapguesser.log 2>&1

Finalize installation

After you followed the above steps, execute the following command:

scripts/install.sh

Warning: Because of a known issue the image mapguesser_multi fails to run without the installation steps. You have to relauch docker-compose up -d after you finished the installation process.

And you are done! The application is ready to use and develop. In development mode an administrative user is also created by the installation script, email is mapg@mapg.dev, password is 123456. In production mode you should create the first administrative user with the following command:

./mapg user:add EMAIL PASSWORD admin

If you installed it in the Docker stack, you can reach it 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.


License: GNU AGPL 3.0. Full license text can be found in file LICENSE.