Pőcze Bence
345cf31bb3
All checks were successful
mapguesser/pipeline/pr-develop This commit looks good
|
||
---|---|---|
.vscode | ||
cache | ||
database | ||
docker | ||
multi | ||
public | ||
scripts | ||
src | ||
tests/Util | ||
views | ||
.env.example | ||
.gitattributes | ||
.gitignore | ||
bitbucket-pipelines.yml | ||
composer.json | ||
composer.lock | ||
docker-compose.yml | ||
Jenkinsfile | ||
LICENSE.md | ||
main.php | ||
mapg | ||
phpstan.neon | ||
README.md | ||
USED_SOFTWARE | ||
web.php |
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
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. Check .env.example
for reference.
Important: DEV
should NOT be set for production! See section Development if you want to use the application in development mode.
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="© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
Docker Compose
Create a docker-compose.yml
file. The example code below assumes that .env
is placed in the same folder.
version: '3'
services:
app:
image: git.esoko.eu/esoko/mapguesser:latest
depends_on:
mariadb:
condition: service_healthy
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:
Execute the following command:
docker compose up -d
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:
./mapg user:add EMAIL USERNAME PASSWORD admin
Development
Set environment variables
.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
Execute the following command from the repo root:
docker compose up -d
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.
License: GNU AGPL 3.0. Full license text can be found in file LICENSE
.