From 69ff15ff7155fd4cec62adff81b2474a8d11860f Mon Sep 17 00:00:00 2001 From: Malte Riechmann Date: Fri, 29 Jan 2021 21:45:01 +0100 Subject: [PATCH 1/7] Run containers in the background using detached mode --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index faafed98..1ca5a48a 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Install Docker. Run: ``` -docker-compose up +docker-compose up -d ``` The environment will start. From 16daf7332a869d4d2aea930c065f942f63a34e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 16 Apr 2021 21:29:05 +0200 Subject: [PATCH 2/7] Adding the ability to display "Text" objects from Tiled I honestly don't believe text objects look good on map, and in real maps, I think text should be written on tiles. However, for a variety of use cases (like in test maps in the /maps/test directory, it can be useful to be able to display some text easily on a map. This PR adds the ability to display this text. Note: the "font" support cannot work correctly, as Tiled is listing fonts from the local system, and those fonts are not available in a browser. --- front/src/Phaser/Components/TextUtils.ts | 45 ++++++ front/src/Phaser/Game/GameScene.ts | 17 ++- front/src/Phaser/Map/ITiledMap.ts | 14 ++ maps/tests/text_object.json | 179 +++++++++++++++++++++++ 4 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 front/src/Phaser/Components/TextUtils.ts create mode 100644 maps/tests/text_object.json diff --git a/front/src/Phaser/Components/TextUtils.ts b/front/src/Phaser/Components/TextUtils.ts new file mode 100644 index 00000000..0161f52d --- /dev/null +++ b/front/src/Phaser/Components/TextUtils.ts @@ -0,0 +1,45 @@ +import {ITiledMapObject} from "../Map/ITiledMap"; +import Text = Phaser.GameObjects.Text; +import {GameScene} from "../Game/GameScene"; +import TextStyle = Phaser.GameObjects.TextStyle; + +export class TextUtils { + public static createTextFromITiledMapObject(scene: GameScene, object: ITiledMapObject): void { + if (object.text === undefined) { + throw new Error('This object has not textual representation.'); + } + const options: {font?: string} = {}; + let font = ''; + if (object.text.italic) { + font += 'italic '; + } + // Note: there is no support for "strikeout" and "underline" + let fontSize: number = 16; + if (object.text.pixelsize) { + font += object.text.pixelsize+'px '; + fontSize = object.text.pixelsize; + } else { + font += '16px '; + } + if (object.text.fontfamily) { + font += '"'+object.text.fontfamily+'"'; + } + if (font !== '') { + options.font = font; + } + const textElem = scene.add.text(object.x, object.y, object.text.text, options); + textElem.setFontSize(fontSize); + let color = '#000000'; + if (object.text.color !== undefined) { + color = object.text.color; + } + textElem.setColor(color); + if (object.text.wrap) { + textElem.setWordWrapWidth(textElem.width); + } + textElem.setAngle(object.rotation); + if (object.text.halign !== undefined) { + textElem.setAlign(object.text.halign); + } + } +} diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 08afca58..d97c6dbc 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -18,7 +18,14 @@ import { RESOLUTION, ZOOM_LEVEL } from "../../Enum/EnvironmentVariable"; -import {ITiledMap, ITiledMapLayer, ITiledMapLayerProperty, ITiledMapObject, ITiledTileSet} from "../Map/ITiledMap"; +import { + ITiledMap, + ITiledMapLayer, + ITiledMapLayerProperty, + ITiledMapObject, + ITiledText, + ITiledTileSet +} from "../Map/ITiledMap"; import {AddPlayerInterface} from "./AddPlayerInterface"; import {PlayerAnimationDirections} from "../Player/Animation"; import {PlayerMovement} from "./PlayerMovement"; @@ -81,6 +88,7 @@ import DOMElement = Phaser.GameObjects.DOMElement; import {Subscription} from "rxjs"; import {worldFullMessageStream} from "../../Connexion/WorldFullMessageStream"; import { lazyLoadCompanionResource } from "../Companion/CompanionTexturesLoadingManager"; +import {TextUtils} from "../Components/TextUtils"; export interface GameSceneInitInterface { initPosition: PointInterface|null, @@ -398,6 +406,13 @@ export class GameScene extends ResizableScene implements CenterListener { if (layer.type === 'objectgroup' && layer.name === 'floorLayer') { depth = 10000; } + if (layer.type === 'objectgroup') { + for (const object of layer.objects) { + if (object.text) { + TextUtils.createTextFromITiledMapObject(this, object); + } + } + } } if (depth === -2) { throw new Error('Your map MUST contain a layer of type "objectgroup" whose name is "floorLayer" that represents the layer characters are drawn at.'); diff --git a/front/src/Phaser/Map/ITiledMap.ts b/front/src/Phaser/Map/ITiledMap.ts index 39e0a1f5..c3f9d10b 100644 --- a/front/src/Phaser/Map/ITiledMap.ts +++ b/front/src/Phaser/Map/ITiledMap.ts @@ -94,6 +94,20 @@ export interface ITiledMapObject { * Polyline points */ polyline: {x: number, y: number}[]; + + text?: ITiledText +} + +export interface ITiledText { + text: string, + wrap?: boolean, + fontfamily?: string, + pixelsize?: number, + color?: string, + underline?: boolean, + italic?: boolean, + strikeout?: boolean, + halign?: "center"|"right"|"justify"|"left" } export interface ITiledTileSet { diff --git a/maps/tests/text_object.json b/maps/tests/text_object.json new file mode 100644 index 00000000..2c3612f0 --- /dev/null +++ b/maps/tests/text_object.json @@ -0,0 +1,179 @@ +{ "compressionlevel":-1, + "height":10, + "infinite":false, + "layers":[ + { + "data":[1, 1, 1, 1, 1, 1, 23, 23, 23, 23, 1, 1, 1, 1, 1, 1, 23, 23, 23, 23, 1, 1, 1, 1, 1, 1, 23, 23, 23, 23, 1, 1, 1, 1, 1, 1, 23, 23, 23, 23, 1, 1, 1, 1, 1, 1, 23, 23, 23, 23, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + "height":10, + "id":1, + "name":"floor", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":10, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + "height":10, + "id":2, + "name":"start", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":10, + "x":0, + "y":0 + }, + { + "draworder":"topdown", + "id":3, + "name":"floorLayer", + "objects":[ + { + "height":154.708861498919, + "id":1, + "name":"", + "rotation":0, + "text": + { + "color":"#ffff00", + "fontfamily":"Sans Serif", + "text":"A yellow text that wraps automatically.\n\nIt is 16px high.", + "wrap":true + }, + "type":"", + "visible":true, + "width":127.701300455634, + "x":192.052147832817, + "y":5.45414451778726 + }, + { + "height":19, + "id":3, + "name":"", + "rotation":0, + "text": + { + "text":"Default text", + "wrap":true + }, + "type":"", + "visible":true, + "width":113.494863163736, + "x":1.76065884397454, + "y":8.44497342134471 + }, + { + "height":19, + "id":5, + "name":"", + "rotation":0, + "text": + { + "text":"A very long text with no world wrap so it keeps going" + }, + "type":"", + "visible":true, + "width":349.4375, + "x":1.01295161808517, + "y":168.828173374613 + }, + { + "height":19, + "id":6, + "name":"", + "rotation":45, + "text": + { + "text":"A rotated text" + }, + "type":"", + "visible":true, + "width":117.607252906128, + "x":62.3249441410129, + "y":41.3440913604766 + }, + { + "height":48.1605818096851, + "id":7, + "name":"", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "italic":true, + "pixelsize":27, + "strikeout":true, + "text":"Italic 27px", + "underline":true + }, + "type":"", + "visible":true, + "width":337.807030930545, + "x":6.6207558122554, + "y":209.952070798528 + }, + { + "height":40, + "id":9, + "name":"", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "halign":"center", + "pixelsize":15, + "text":"This text should appear below the plant and be centered", + "wrap":true + }, + "type":"", + "visible":true, + "width":317.4375, + "x":0.78125, + "y":269.5 + }], + "opacity":1, + "type":"objectgroup", + "visible":true, + "x":0, + "y":0 + }, + { + "data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 79, 80, 0, 0, 0, 0, 0, 0, 0, 89, 90, 91, 0, 0, 0, 0, 0, 0, 0, 100, 101, 102, 0, 0, 0, 0], + "height":10, + "id":8, + "name":"over", + "opacity":1, + "type":"tilelayer", + "visible":true, + "width":10, + "x":0, + "y":0 + }], + "nextlayerid":9, + "nextobjectid":10, + "orientation":"orthogonal", + "renderorder":"right-down", + "tiledversion":"2021.03.23", + "tileheight":32, + "tilesets":[ + { + "columns":11, + "firstgid":1, + "image":"tileset1.png", + "imageheight":352, + "imagewidth":352, + "margin":0, + "name":"tileset1", + "spacing":0, + "tilecount":121, + "tileheight":32, + "tilewidth":32 + }], + "tilewidth":32, + "type":"map", + "version":1.5, + "width":10 +} \ No newline at end of file From 110511461a2c4df4ef3a7383bc91c68fb1cff494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Sat, 17 Apr 2021 18:55:39 +0200 Subject: [PATCH 3/7] Fixing WorkWrap --- front/src/Phaser/Components/TextUtils.ts | 42 ++++++++++++++---------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/front/src/Phaser/Components/TextUtils.ts b/front/src/Phaser/Components/TextUtils.ts index 0161f52d..beee840a 100644 --- a/front/src/Phaser/Components/TextUtils.ts +++ b/front/src/Phaser/Components/TextUtils.ts @@ -8,38 +8,46 @@ export class TextUtils { if (object.text === undefined) { throw new Error('This object has not textual representation.'); } - const options: {font?: string} = {}; - let font = ''; + const options: { + fontStyle?: string, + fontSize?: string, + fontFamily?: string, + color?: string, + align?: string, + wordWrap?: { + width: number, + useAdvancedWrap?: boolean + } + } = {}; if (object.text.italic) { - font += 'italic '; + options.fontStyle = 'italic'; } // Note: there is no support for "strikeout" and "underline" let fontSize: number = 16; if (object.text.pixelsize) { - font += object.text.pixelsize+'px '; fontSize = object.text.pixelsize; - } else { - font += '16px '; } + options.fontSize = fontSize + 'px'; if (object.text.fontfamily) { - font += '"'+object.text.fontfamily+'"'; + options.fontFamily = '"'+object.text.fontfamily+'"'; } - if (font !== '') { - options.font = font; - } - const textElem = scene.add.text(object.x, object.y, object.text.text, options); - textElem.setFontSize(fontSize); let color = '#000000'; if (object.text.color !== undefined) { color = object.text.color; } - textElem.setColor(color); - if (object.text.wrap) { - textElem.setWordWrapWidth(textElem.width); + options.color = color; + if (object.text.wrap === true) { + options.wordWrap = { + width: object.width, + //useAdvancedWrap: true + } } - textElem.setAngle(object.rotation); if (object.text.halign !== undefined) { - textElem.setAlign(object.text.halign); + options.align = object.text.halign; } + + console.warn(options); + const textElem = scene.add.text(object.x, object.y, object.text.text, options); + textElem.setAngle(object.rotation); } } From 94317be1aedff4c4c3ffab705974cfffa42f210a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Sat, 17 Apr 2021 21:31:09 +0200 Subject: [PATCH 4/7] Improving test cases This PR improves test cases by adding a "index.html" webpage listing test maps and by adding text in the map, explaining what needs to be tested. --- maps/tests/iframe_api.json | 33 +++++++++++------ maps/tests/index.html | 63 ++++++++++++++++++++++++++++++++ maps/tests/jitsi_config.json | 33 +++++++++++------ maps/tests/jitsi_custom_url.json | 33 +++++++++++------ maps/tests/script.js | 4 +- maps/tests/script_api.json | 49 ++++++++++++++++++++----- 6 files changed, 170 insertions(+), 45 deletions(-) create mode 100644 maps/tests/index.html diff --git a/maps/tests/iframe_api.json b/maps/tests/iframe_api.json index 96d92423..fa138500 100644 --- a/maps/tests/iframe_api.json +++ b/maps/tests/iframe_api.json @@ -1,11 +1,4 @@ { "compressionlevel":-1, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":10, "infinite":false, "layers":[ @@ -60,7 +53,25 @@ "draworder":"topdown", "id":3, "name":"floorLayer", - "objects":[], + "objects":[ + { + "height":141, + "id":1, + "name":"", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "pixelsize":11, + "text":"Test:\nWalk on carpet, an iframe open, click the \"Send chat message\" button\nResult:\nThe chat opens and a \"Hello world!\" message is displayed.\nTest:\nEnter something in the chat\nResult:\nThe message is displayed in the iframe", + "wrap":true + }, + "type":"", + "visible":true, + "width":316.770833333333, + "x":0.28125, + "y":187.833333333333 + }], "opacity":1, "type":"objectgroup", "visible":true, @@ -68,10 +79,10 @@ "y":0 }], "nextlayerid":6, - "nextobjectid":1, + "nextobjectid":3, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.3.3", + "tiledversion":"2021.03.23", "tileheight":32, "tilesets":[ { @@ -89,6 +100,6 @@ }], "tilewidth":32, "type":"map", - "version":1.2, + "version":1.5, "width":10 } \ No newline at end of file diff --git a/maps/tests/index.html b/maps/tests/index.html new file mode 100644 index 00000000..f53bbae9 --- /dev/null +++ b/maps/tests/index.html @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ResultTest
+ Success Failure Pending + + Testing Jitsi special config parameters +
+ Success Failure Pending + + Testing jitsiUrl property +
+ Success Failure Pending + + Testing scripting API with an iFrame +
+ Success Failure Pending + + Testing scripting API with a script +
+ + + + + diff --git a/maps/tests/jitsi_config.json b/maps/tests/jitsi_config.json index d806b751..9a812cc8 100644 --- a/maps/tests/jitsi_config.json +++ b/maps/tests/jitsi_config.json @@ -1,11 +1,4 @@ { "compressionlevel":-1, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":10, "infinite":false, "layers":[ @@ -70,7 +63,25 @@ "draworder":"topdown", "id":3, "name":"floorLayer", - "objects":[], + "objects":[ + { + "height":83.6666666666666, + "id":1, + "name":"", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "pixelsize":13, + "text":"Test:\nWalk on the carpet and press space\nResult:\nJitsi opens, background in green and audio\/video is muted", + "wrap":true + }, + "type":"", + "visible":true, + "width":315.4375, + "x":2.28125, + "y":235.166666666667 + }], "opacity":1, "type":"objectgroup", "visible":true, @@ -78,10 +89,10 @@ "y":0 }], "nextlayerid":6, - "nextobjectid":1, + "nextobjectid":2, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.4.3", + "tiledversion":"2021.03.23", "tileheight":32, "tilesets":[ { @@ -99,6 +110,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":1.5, "width":10 } \ No newline at end of file diff --git a/maps/tests/jitsi_custom_url.json b/maps/tests/jitsi_custom_url.json index 65e3be9f..637796a1 100644 --- a/maps/tests/jitsi_custom_url.json +++ b/maps/tests/jitsi_custom_url.json @@ -1,11 +1,4 @@ { "compressionlevel":-1, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":10, "infinite":false, "layers":[ @@ -60,7 +53,25 @@ "draworder":"topdown", "id":3, "name":"floorLayer", - "objects":[], + "objects":[ + { + "height":94.6489098314831, + "id":1, + "name":"", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "pixelsize":11, + "text":"Test:\nWalk on the carpet and press space\nResult:\nJitsi opens on meet.jit.si (check this in the network tab). Note: this test only makes sense if the default configured Jitsi instance is NOT meet.jit.si (check your .env file)", + "wrap":true + }, + "type":"", + "visible":true, + "width":317.361946929159, + "x":2.32853056864467, + "y":224.602707451482 + }], "opacity":1, "type":"objectgroup", "visible":true, @@ -68,10 +79,10 @@ "y":0 }], "nextlayerid":6, - "nextobjectid":1, + "nextobjectid":2, "orientation":"orthogonal", "renderorder":"right-down", - "tiledversion":"1.3.3", + "tiledversion":"2021.03.23", "tileheight":32, "tilesets":[ { @@ -89,6 +100,6 @@ }], "tilewidth":32, "type":"map", - "version":1.2, + "version":1.5, "width":10 } \ No newline at end of file diff --git a/maps/tests/script.js b/maps/tests/script.js index 5c129f1e..25e47249 100644 --- a/maps/tests/script.js +++ b/maps/tests/script.js @@ -3,8 +3,8 @@ console.log('SCRIPT LAUNCHED'); var isFirstTimeTuto = false; var textFirstPopup = 'Hey ! This is how to open start a discussion with someone ! You can be 4 max in a booble'; var textSecondPopup = 'You can also use the chat to communicate ! '; -var targetObjectTutoBubble ='tutoBobble'; -var targetObjectTutoChat ='tutoChat'; +var targetObjectTutoBubble ='myPopup1'; +var targetObjectTutoChat ='myPopup2'; var popUpExplanation = undefined; function launchTuto (){ WA.openPopup(targetObjectTutoBubble, textFirstPopup, [ diff --git a/maps/tests/script_api.json b/maps/tests/script_api.json index 54d93819..73ef9d01 100644 --- a/maps/tests/script_api.json +++ b/maps/tests/script_api.json @@ -1,11 +1,4 @@ { "compressionlevel":-1, - "editorsettings": - { - "export": - { - "target":"." - } - }, "height":10, "infinite":false, "layers":[ @@ -95,6 +88,42 @@ "width":125.735549178518, "x":13.649632619596, "y":50.8502491249093 + }, + { + "height":67, + "id":3, + "name":"", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "pixelsize":11, + "text":"Test:\nWalk on top carpet\nResult:\nA message \"Don't step on my carpet\" is displayed", + "wrap":true + }, + "type":"", + "visible":true, + "width":252.4375, + "x":2.78125, + "y":2.5 + }, + { + "height":67, + "id":4, + "name":"", + "rotation":0, + "text": + { + "fontfamily":"Sans Serif", + "pixelsize":11, + "text":"Test:\nWalk on bottom carpet\nResult:\nA series of 2 popups open. A bubble opens. The player cannot move until popup closes.\nWhen the player leaves the zone, the bubble closes.", + "wrap":true + }, + "type":"", + "visible":true, + "width":252.438, + "x":-1.71899999999999, + "y":163.5 }], "opacity":1, "type":"objectgroup", @@ -103,7 +132,7 @@ "y":0 }], "nextlayerid":8, - "nextobjectid":3, + "nextobjectid":5, "orientation":"orthogonal", "properties":[ { @@ -112,7 +141,7 @@ "value":"script.js" }], "renderorder":"right-down", - "tiledversion":"1.4.3", + "tiledversion":"2021.03.23", "tileheight":32, "tilesets":[ { @@ -130,6 +159,6 @@ }], "tilewidth":32, "type":"map", - "version":1.4, + "version":1.5, "width":10 } \ No newline at end of file From 1e42de9155c18800854cb977d144b95c3e56bb17 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Apr 2021 23:28:10 +0000 Subject: [PATCH 5/7] Bump ssri from 6.0.1 to 6.0.2 in /front Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/npm/ssri/releases) - [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md) - [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2) Signed-off-by: dependabot[bot] --- front/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/front/yarn.lock b/front/yarn.lock index 739e713e..b3b73dc5 100644 --- a/front/yarn.lock +++ b/front/yarn.lock @@ -4647,9 +4647,9 @@ sprintf-js@~1.0.2: integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= ssri@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.1.tgz#2a3c41b28dd45b62b63676ecb74001265ae9edd8" - integrity sha512-3Wge10hNcT1Kur4PDFwEieXSCMCJs/7WvSACcrMYrNp+b8kDL1/0wJch5Ni2WrtwEa2IO8OsVfeKIciKCDx/QA== + version "6.0.2" + resolved "https://registry.yarnpkg.com/ssri/-/ssri-6.0.2.tgz#157939134f20464e7301ddba3e90ffa8f7728ac5" + integrity sha512-cepbSq/neFK7xB6A50KHN0xHDotYzq58wWCa5LeWqnPrHG8GzfEjO/4O8kpmcGW+oaxkvhEJCWgbgNk4/ZV93Q== dependencies: figgy-pudding "^3.5.1" From d29dee3bd4f5a65c6976085e0e8744f8d9052f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Thu, 29 Apr 2021 09:42:15 +0200 Subject: [PATCH 6/7] Adding templater call to single domain startup The docker-compose.single-domain.yaml was missing a call to the templater script. As a result, the first run would fail unless docker-compose.yaml was started before. Closes #947 Closes #957 --- docker-compose.single-domain.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.single-domain.yaml b/docker-compose.single-domain.yaml index 1a390f4c..73668cc9 100644 --- a/docker-compose.single-domain.yaml +++ b/docker-compose.single-domain.yaml @@ -30,7 +30,8 @@ services: UPLOADER_URL: /uploader ADMIN_URL: /admin MAPS_URL: /maps - STARTUP_COMMAND_1: yarn install + STARTUP_COMMAND_1: ./templater.sh + STARTUP_COMMAND_2: yarn install TURN_SERVER: "turn:localhost:3478,turns:localhost:5349" # Use TURN_USER/TURN_PASSWORD if your Coturn server is secured via hard coded credentials. # Advice: you should instead use Coturn REST API along the TURN_STATIC_AUTH_SECRET in the Back container From 7bd524ba5563d7a6c6236e16838792fcb0efe7c8 Mon Sep 17 00:00:00 2001 From: kharhamel Date: Thu, 29 Apr 2021 14:44:41 +0200 Subject: [PATCH 7/7] FIX: fixed the deploy workflow to also build images on new releases --- .github/workflows/build-and-deploy.yml | 25 ++++++++++++++----------- .github/workflows/cleanup.yml | 1 + deeployer.libsonnet | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 5c09de3e..7de6a8b3 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -1,6 +1,8 @@ name: Build, push and deploy Docker image on: + release: + types: [released] pull_request: types: [ labeled, synchronize ] @@ -12,7 +14,7 @@ env: jobs: build-front: - if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }} + if: ${{ github.event.release || contains(github.event.pull_request.labels.*.name, 'deploy') }} runs-on: ubuntu-latest steps: @@ -32,11 +34,11 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: thecodingmachine/workadventure-front - tags: ${{ env.GITHUB_HEAD_REF_SLUG }} + tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF }} add_git_labels: true build-back: - if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }} + if: ${{ github.event.release || contains(github.event.pull_request.labels.*.name, 'deploy') }} runs-on: ubuntu-latest steps: @@ -55,11 +57,11 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: thecodingmachine/workadventure-back - tags: ${{ env.GITHUB_HEAD_REF_SLUG }} + tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF }} add_git_labels: true build-pusher: - if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }} + if: ${{ github.event.release || contains(github.event.pull_request.labels.*.name, 'deploy') }} runs-on: ubuntu-latest steps: @@ -78,11 +80,11 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: thecodingmachine/workadventure-pusher - tags: ${{ env.GITHUB_HEAD_REF_SLUG }} + tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF }} add_git_labels: true build-uploader: - if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }} + if: ${{ github.event.release || contains(github.event.pull_request.labels.*.name, 'deploy') }} runs-on: ubuntu-latest steps: @@ -101,11 +103,11 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: thecodingmachine/workadventure-uploader - tags: ${{ env.GITHUB_HEAD_REF_SLUG }} + tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF }} add_git_labels: true build-maps: - if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }} + if: ${{ github.event.release || contains(github.event.pull_request.labels.*.name, 'deploy') }} runs-on: ubuntu-latest steps: @@ -125,7 +127,7 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} repository: thecodingmachine/workadventure-maps - tags: ${{ env.GITHUB_HEAD_REF_SLUG }} + tags: ${{ github.event.pull_request && env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF }} add_git_labels: true deeploy: @@ -136,6 +138,7 @@ jobs: - build-maps - build-uploader runs-on: ubuntu-latest + if: ${{ contains(github.event.pull_request.labels.*.name, 'deploy') }} steps: - name: Checkout @@ -153,12 +156,12 @@ jobs: JITSI_URL: ${{ secrets.JITSI_URL }} SECRET_JITSI_KEY: ${{ secrets.SECRET_JITSI_KEY }} TURN_STATIC_AUTH_SECRET: ${{ secrets.TURN_STATIC_AUTH_SECRET }} + DEPLOY_REF: ${{ env.GITHUB_HEAD_REF_SLUG }} with: namespace: workadventure-${{ env.GITHUB_HEAD_REF_SLUG }} - name: Add a comment in PR uses: unsplash/comment-on-pr@v1.2.0 - if: ${{ env.GITHUB_HEAD_REF_SLUG != 'master' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index ab39978b..ffa8273f 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -18,6 +18,7 @@ jobs: - uses: rlespinasse/github-slug-action@3.1.0 - name: Cleanup + continue-on-error: true uses: thecodingmachine/deeployer-cleanup-action@master env: KUBE_CONFIG_FILE: ${{ secrets.KUBE_CONFIG_FILE }} diff --git a/deeployer.libsonnet b/deeployer.libsonnet index f94f4e69..7ed9db8c 100644 --- a/deeployer.libsonnet +++ b/deeployer.libsonnet @@ -1,6 +1,6 @@ { local env = std.extVar("env"), - local namespace = env.GITHUB_HEAD_REF_SLUG, + local namespace = env.DEPLOY_REF, local tag = namespace, local url = if namespace == "master" then "workadventu.re" else namespace+".test.workadventu.re", // develop branch does not use admin because of issue with SSL certificate of admin as of now.