Merge branch 'develop' into feature/google-maps-in-mapeditor-added
This commit is contained in:
commit
ac9b106c65
45
README.md
45
README.md
@ -14,7 +14,7 @@ git clone https://gitea.e5tv.hu/esoko/mapguesser.git
|
|||||||
|
|
||||||
All the commands listed here should be executed from the repository root.
|
All the commands listed here should be executed from the repository root.
|
||||||
|
|
||||||
### (Optional) Setup Docker stack
|
### Setup Docker stack (recommended)
|
||||||
|
|
||||||
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`.
|
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`.
|
||||||
|
|
||||||
@ -24,9 +24,17 @@ All you have to do is executing the following command:
|
|||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
Attach shell to the container of `mapguesser_app`. All of the following commands should be executed there.
|
Attach shell to the container of `mapguesser_app`:
|
||||||
|
|
||||||
**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.**
|
```
|
||||||
|
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
|
### Initialize project
|
||||||
|
|
||||||
@ -40,15 +48,28 @@ composer create-project
|
|||||||
|
|
||||||
The `.env` file contains several environment variables that are needed by the application to work properly. These should be configured for your environment.
|
The `.env` file contains several environment variables that are needed by the application to work properly. These should be configured for your environment.
|
||||||
|
|
||||||
**You should set here 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/**
|
One very important variable is `DEV`. This indicates that the application operates in development (staging) and not in production mode.
|
||||||
|
|
||||||
One very important variable is `DEV`. This indicates that the application operates in development (staging) and not in produciton 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.
|
||||||
|
|
||||||
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, 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` 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.
|
||||||
|
|
||||||
### (Production only) Create cron job
|
### (Production only) Create cron job
|
||||||
|
|
||||||
To maintain database (delete inactive users, old sessions etc.), the command `db:maintain` should be regularly executed. It is recommened to create a cron job that runs every hour:
|
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
|
0 * * * * /path/to/your/installation/mapg db:maintain >>/var/log/cron-mapguesser.log 2>&1
|
||||||
@ -56,13 +77,19 @@ To maintain database (delete inactive users, old sessions etc.), the command `db
|
|||||||
|
|
||||||
### Finalize installation
|
### Finalize installation
|
||||||
|
|
||||||
After you set the environment variables in the `.env` file, execute the following command:
|
After you followed the above steps, execute the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
scripts/install.sh
|
scripts/install.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
**And you are done!** The application is ready to use and develop.
|
**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.
|
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.
|
||||||
|
|
||||||
|
5
public/static/img/compass.svg
Normal file
5
public/static/img/compass.svg
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
||||||
|
<polygon id="needleNorth" points="50,0 33,50 66,50" style="fill:red;stroke:black;stroke-width:1" />
|
||||||
|
<polygon id="needleSouth" points="50,100 33,50 66,50" style="fill:white;stroke:black;stroke-width:1" />
|
||||||
|
Sorry, your browser does not support inline SVG.
|
||||||
|
</svg>
|
After Width: | Height: | Size: 328 B |
@ -387,6 +387,10 @@
|
|||||||
document.getElementById('currentRound').innerHTML = String(Game.rounds.length) + '/' + String(Game.NUMBER_OF_ROUNDS);
|
document.getElementById('currentRound').innerHTML = String(Game.rounds.length) + '/' + String(Game.NUMBER_OF_ROUNDS);
|
||||||
|
|
||||||
Game.loadPano(Game.panoId, Game.pov);
|
Game.loadPano(Game.panoId, Game.pov);
|
||||||
|
|
||||||
|
// update the compass
|
||||||
|
const heading = Game.panorama.getPov().heading;
|
||||||
|
document.getElementById("compass").style.transform = "translateY(-50%) rotate(" + heading + "deg)";
|
||||||
},
|
},
|
||||||
|
|
||||||
handleErrorResponse: function (error) {
|
handleErrorResponse: function (error) {
|
||||||
@ -863,6 +867,9 @@
|
|||||||
|
|
||||||
Game.panorama.addListener('pov_changed', function () {
|
Game.panorama.addListener('pov_changed', function () {
|
||||||
Game.rewriteGoogleLink();
|
Game.rewriteGoogleLink();
|
||||||
|
|
||||||
|
const heading = Game.panorama.getPov().heading;
|
||||||
|
document.getElementById("compass").style.transform = "translateY(-50%) rotate(" + heading + "deg)";
|
||||||
});
|
});
|
||||||
|
|
||||||
if (COOKIES_CONSENT) {
|
if (COOKIES_CONSENT) {
|
||||||
@ -950,4 +957,8 @@
|
|||||||
document.getElementById('returnToStart').onclick = function () {
|
document.getElementById('returnToStart').onclick = function () {
|
||||||
Game.loadPano(Game.panoId, Game.pov);
|
Game.loadPano(Game.panoId, Game.pov);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.getElementById('compassContainer').onclick = function () {
|
||||||
|
Game.panorama.setPov({ heading: 0, pitch: Game.panorama.getPov().pitch });
|
||||||
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -27,6 +27,9 @@ if [ -z "${DEV}" ] || [ "${DEV}" -eq "0" ]; then
|
|||||||
|
|
||||||
echo "Linking view files..."
|
echo "Linking view files..."
|
||||||
(cd ${ROOT_DIR} && ./mapg view:link)
|
(cd ${ROOT_DIR} && ./mapg view:link)
|
||||||
|
else
|
||||||
|
echo "Creating the first user..."
|
||||||
|
(cd ${ROOT_DIR} && ./mapg user:add mapg@mapg.dev 123456 admin)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
touch ${ROOT_DIR}/installed
|
touch ${ROOT_DIR}/installed
|
||||||
|
@ -60,6 +60,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="navigation">
|
<div id="navigation">
|
||||||
|
<div id="compassContainer" class="navigationItem">
|
||||||
|
<div>
|
||||||
|
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="circleBackground" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<img id="compass" src="<?= $_ENV['STATIC_ROOT'] ?>/img/compass.svg?rev=<?= REVISION ?>" alt="compass icon" class="navigationIcon" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div id="returnToStart" class="navigationItem">
|
<div id="returnToStart" class="navigationItem">
|
||||||
<div>
|
<div>
|
||||||
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="circleBackground" />
|
<img src="<?= $_ENV['STATIC_ROOT'] ?>/img/circle_background.svg?rev=<?= REVISION ?>" alt="Circle Background" class="circleBackground" />
|
||||||
|
Loading…
Reference in New Issue
Block a user