diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..abf285b9f0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +name: musicblocks +services: + musicblocks: + build: https://github.com/sugarlabs/musicblocks.git#collaboration + ports: + - "3000:3000" + #command: ["python", "-m", "http.server", "3000", "--bind", "0.0.0.0"] + env_file: + - ./environment + #planet-server: + # build: + # dockerfile: ./planet-server/Dockerfile + #volumes: + # - planet-server/planet.sql: + collaboration-server: + #build: https://github.com/sugarlabs/collaboration-server.git + build: + dockerfile: ./collaboration-server/Dockerfile + volumes: + - .:/collaboration-server + environment: + NODE_ENV: development + #command: ["npm", "run", "server"] + command: ["npm", "run", "serve"] diff --git a/dockerfile b/dockerfile index 1c353f19e6..150467223c 100644 --- a/dockerfile +++ b/dockerfile @@ -1,16 +1,14 @@ # First stage: Build stage +FROM alpine:latest AS first +RUN git clone https://github.com/sugarlabs/planet-server.git + FROM python:latest AS build WORKDIR /app COPY . . -# Second stage: Final stage -FROM python:latest - -WORKDIR /app - -COPY --from=build /app /app +COPY --from=first /planet-server /app/planet-server EXPOSE 3000 diff --git a/js/collaboration/collaboration.js b/js/collaboration/collaboration.js index 1fe31b80d9..d1641fa015 100644 --- a/js/collaboration/collaboration.js +++ b/js/collaboration/collaboration.js @@ -24,7 +24,8 @@ class Collaboration { this.attempts = 0; this.socket = null; this.blockList = this.activity.blocks.blockList; - this.PORT = "http://localhost:8080/"; + this.HOST = process.env.COLLAB_HOST; + this.PORT = "8080"; this.hasCollaborationStarted = false; this.updatedProjectHtml = null; this.randomNames = [ @@ -63,7 +64,7 @@ class Collaboration { // Make calls to the socket server makeConnection = (room_id, name) => { // connect to the local server - const socket = io(this.PORT); + const socket = io(this.HOST.concat(";", this.PORT)); socket.on("connect", () => { this.socket = socket; try { diff --git a/planet/js/ServerInterface.js b/planet/js/ServerInterface.js index f6d202b05e..dcf8b28a82 100644 --- a/planet/js/ServerInterface.js +++ b/planet/js/ServerInterface.js @@ -24,9 +24,10 @@ class ServerInterface { constructor(Planet) { - this.ServerURL = "https://musicblocks.sugarlabs.org/planet-server/index.php"; + // this.ServerURL = "https://musicblocks.sugarlabs.org/planet-server/index.php"; + this.ServerURL = "http://localhost:3000/planet-server/index.php"); this.ConnectionFailureData = {"success": false, "error": "ERROR_CONNECTION_FAILURE"}; - this.APIKey = "3f2d3a4c-c7a4-4c3c-892e-ac43784f7381" ; + this.APIKey = process.env.API_KEY; } request (data, callback) { @@ -34,6 +35,7 @@ class ServerInterface { // eslint-disable-next-line no-unused-vars const req = jQuery.ajax({ + dataType: 'jsonp', type: "POST", url: this.ServerURL, data: data