Browse Source

Moving maps to their own container

outline
David Négrier 1 year ago
parent
commit
2484e4f1df
  1. 24
      .github/workflows/build-and-deploy.yml
  2. 3
      back/src/Controller/MapController.ts
  3. 8
      deeployer.libsonnet
  4. 2
      docker-compose.yaml
  5. BIN
      front/dist/resources/items/computer/computer.png
  6. 47
      front/dist/resources/items/computer/computer_atlas.json
  7. BIN
      front/dist/resources/items/computer/original/computer.png
  8. 47
      front/dist/resources/items/computer/original/computer_atlas.json
  9. BIN
      front/dist/resources/items/computer/unpack/computer_off.png
  10. BIN
      front/dist/resources/items/computer/unpack/computer_on1.png
  11. BIN
      front/dist/resources/items/computer/unpack/computer_on2.png
  12. 2
      front/src/Phaser/Items/Computer/computer.ts
  13. 0
      maps/.htaccess
  14. 9
      maps/Dockerfile
  15. 0
      maps/Floor0/floor0.json
  16. 0
      maps/Floor0/floortileset.png
  17. 0
      maps/Floor0/tilesets_deviant_milkian_1.png
  18. 0
      maps/Floor1/FloorTile_S.jpg
  19. 0
      maps/Floor1/floor1.json
  20. 0
      maps/Floor1/floortileset.png
  21. 0
      maps/Floor1/tilesets_deviant_milkian_1.png
  22. 0
      maps/Lyon/floortileset.png
  23. 0
      maps/Lyon/lyon.json
  24. 0
      maps/Lyon/tilesets_deviant_milkian_1.png
  25. 2
      maps/objects/computer.ts

24
.github/workflows/build-and-deploy.yml

@ -79,6 +79,30 @@ jobs:
tags: ${{ env.GITHUB_REF_SLUG }}
add_git_labels: true
build-maps:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Create a slugified value of the branch
- uses: rlespinasse/github-slug-action@master
- name: "Build and push front image"
uses: docker/build-push-action@v1
with:
dockerfile: maps/Dockerfile
path: maps/
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: thecodingmachine/workadventure-maps
tags: ${{ env.GITHUB_REF_SLUG }}
add_git_labels: true
deeploy:
needs:
- build-front

3
back/src/Controller/MapController.ts

@ -19,8 +19,9 @@ export class MapController {
// Returns a map mapping map name to file name of the map
getStartMap() {
this.App.get("/start-map", (req: Request, res: Response) => {
let url = req.headers.host?.replace('api.', 'maps.') + URL_ROOM_STARTED;
res.status(OK).send({
mapUrlStart: req.headers.host + "/map/files" + URL_ROOM_STARTED,
mapUrlStart: url,
startInstance: "global"
});
});

8
deeployer.libsonnet

@ -28,6 +28,14 @@
"API_URL": "api."+url
}
},
"maps": {
"image": "thecodingmachine/workadventure-maps:"+tag,
"host": {
"url": "maps."+url,
"https": "enable"
},
"ports": [80]
},
"website": {
"image": "thecodingmachine/workadventure-website:"+tag,
"host": {

2
docker-compose.yaml

@ -44,7 +44,7 @@ services:
DEBUG_MODE: "$DEBUG_MODE"
HOST: "0.0.0.0"
NODE_ENV: development
APACHE_DOCUMENT_ROOT: dist/
#APACHE_DOCUMENT_ROOT: dist/
#APACHE_EXTENSIONS: headers
#APACHE_EXTENSION_HEADERS: 1
STARTUP_COMMAND_0: sudo a2enmod headers

BIN
front/dist/resources/items/computer/computer.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

47
front/dist/resources/items/computer/computer_atlas.json

@ -0,0 +1,47 @@
{
"frames": [
{
"filename": "computer_off",
"frame": {
"w": 42,
"h": 40,
"x": 0,
"y": 0
},
"anchor": {
"x": 0.5,
"y": 0.5
}
},
{
"filename": "computer_on1",
"frame": {
"w": 42,
"h": 40,
"x": 0,
"y": 40
},
"anchor": {
"x": 0.5,
"y": 0.5
}
},
{
"filename": "computer_on2",
"frame": {
"w": 42,
"h": 40,
"x": 42,
"y": 0
},
"anchor": {
"x": 0.5,
"y": 0.5
}
}
],
"meta": {
"description": "Atlas generado con Atlas Packer Gamma V2",
"web": "https://gammafp.github.io/atlas-packer-phaser/"
}
}

BIN
front/dist/resources/items/computer/original/computer.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

47
front/dist/resources/items/computer/original/computer_atlas.json

@ -0,0 +1,47 @@
{
"frames": [
{
"filename": "computer_off",
"frame": {
"w": 42,
"h": 40,
"x": 0,
"y": 0
},
"anchor": {
"x": 0.5,
"y": 0.5
}
},
{
"filename": "computer_on1",
"frame": {
"w": 42,
"h": 40,
"x": 0,
"y": 40
},
"anchor": {
"x": 0.5,
"y": 0.5
}
},
{
"filename": "computer_on2",
"frame": {
"w": 42,
"h": 40,
"x": 42,
"y": 0
},
"anchor": {
"x": 0.5,
"y": 0.5
}
}
],
"meta": {
"description": "Atlas generado con Atlas Packer Gamma V2",
"web": "https://gammafp.github.io/atlas-packer-phaser/"
}
}

BIN
front/dist/resources/items/computer/unpack/computer_off.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

BIN
front/dist/resources/items/computer/unpack/computer_on1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

BIN
front/dist/resources/items/computer/unpack/computer_on2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

2
front/src/Phaser/Items/Computer/computer.ts

@ -8,7 +8,7 @@ import {ActionableItem} from "../ActionableItem";
export default {
preload: (loader: Phaser.Loader.LoaderPlugin): void => {
loader.atlas('computer', 'http://maps.workadventure.localhost/computer/computer.png', 'http://maps.workadventure.localhost/computer/computer_atlas.json');
loader.atlas('computer', '/resources/items/computer/computer.png', '/resources/items/computer/computer_atlas.json');
},
create: (scene: GameScene): void => {

0
maps/dist/.htaccess → maps/.htaccess

9
maps/Dockerfile

@ -0,0 +1,9 @@
# we are rebuilding on each deploy to cope with the API_URL environment URL
FROM thecodingmachine/nodejs:12-apache
COPY --chown=docker:docker . .
#RUN yarn install
#ENV NODE_ENV=production
#ENV STARTUP_COMMAND_1="yarn run build"
#ENV APACHE_DOCUMENT_ROOT=dist/

0
back/src/Assets/Maps/Floor0/floor0.json → maps/Floor0/floor0.json

0
back/src/Assets/Maps/Floor0/floortileset.png → maps/Floor0/floortileset.png

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

0
back/src/Assets/Maps/Floor0/tilesets_deviant_milkian_1.png → maps/Floor0/tilesets_deviant_milkian_1.png

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

0
back/src/Assets/Maps/Floor1/FloorTile_S.jpg → maps/Floor1/FloorTile_S.jpg

Before

Width:  |  Height:  |  Size: 671 KiB

After

Width:  |  Height:  |  Size: 671 KiB

0
back/src/Assets/Maps/Floor1/floor1.json → maps/Floor1/floor1.json

0
back/src/Assets/Maps/Floor1/floortileset.png → maps/Floor1/floortileset.png

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

0
back/src/Assets/Maps/Floor1/tilesets_deviant_milkian_1.png → maps/Floor1/tilesets_deviant_milkian_1.png

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

0
back/src/Assets/Maps/Lyon/floortileset.png → maps/Lyon/floortileset.png

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 85 KiB

0
back/src/Assets/Maps/Lyon/lyon.json → maps/Lyon/lyon.json

0
back/src/Assets/Maps/Lyon/tilesets_deviant_milkian_1.png → maps/Lyon/tilesets_deviant_milkian_1.png

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

2
maps/objects/computer.ts

@ -42,7 +42,7 @@ class MySprite extends Sprite {
export default {
preload: (loader: Phaser.Loader.LoaderPlugin) => {
loader.atlas('computer', 'http://maps.workadventure.localhost/computer/computer.png', 'http://maps.workadventure.localhost/computer/computer_atlas.json');
loader.atlas('computer', '/resources/items/computer/computer.png', '/resources/items/computer/computer_atlas.json');
},
create: (scene: Scene) => {

Loading…
Cancel
Save