Skip to content

Commit

Permalink
Make planet and collaboration docker friendly.
Browse files Browse the repository at this point in the history
Signed-off-by: Chihurumnaya Ibiam <[email protected]>
  • Loading branch information
chimosky committed Oct 2, 2024
1 parent 0151970 commit a75949c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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"]
10 changes: 4 additions & 6 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 3 additions & 2 deletions js/collaboration/collaboration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions planet/js/ServerInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@
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) {
data["api-key"] = this.APIKey;

// eslint-disable-next-line no-unused-vars
const req = jQuery.ajax({
dataType: 'jsonp',
type: "POST",
url: this.ServerURL,
data: data
Expand Down

0 comments on commit a75949c

Please sign in to comment.