Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions authy/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
59 changes: 51 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
services:
postgres:
image: postgres:latest
ports:
ports:
- "5434:5432"
volumes:
- db_data:/var/lib/postgresql/data
- ./postgres-init.sql:/docker-entrypoint-initdb.d/init.sql
environment:
- POSTGRES_PASSWORD=admin
- POSTGRES_USER=admin
mongodb:
image: mongodb/mongodb-community-server:latest
ports:
ports:
- "27017:27017"
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
Expand All @@ -22,7 +23,7 @@ services:
- "1025:1025"
usernator:
build: ./usernator
ports:
ports:
- "3001:3000"
- "3004:3001"
environment:
Expand All @@ -40,12 +41,20 @@ services:
depends_on:
- postgres
- maildev
restart: on-failure:3
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s

authy:
build:
context: ./authy
args:
- ARCH=aarch64
ports:
ports:
- "3002:3000"
environment:
- JWT_SECRET=secret
Expand All @@ -54,18 +63,26 @@ services:
depends_on:
- usernator
- tasky
restart: on-failure:3
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s

tasky:
build:
context: ./tasky
args:
- ARCH=aarch64
ports:
ports:
- "3005:3000"
- "3006:3001"
environment:
- DB_NAME=tasky
- DB_USERNAME=tasky
- DB_PASSWORD=tasky
- DB_USERNAME=usernator
- DB_PASSWORD=usernator
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use other user credentials here?

- DB_HOST=postgres:5432
- USERNATOR_GRPC=http://usernator:3001
- MONGO_HOST="mongodb:27017"
Expand All @@ -76,6 +93,14 @@ services:
depends_on:
- usernator
- postgres
restart: on-failure:3
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s

executor:
build: ./executor
ports:
Expand All @@ -102,5 +127,23 @@ services:
- BACKEND_URL=http://executor:8000
depends_on:
- executor


web:
build:
context: web/
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
- API_URL=http://localhost:3002
- EXECUTOR_UI_URL=http://localhost:3007
depends_on:
- authy
- executor_ui
- tasky
- usernator


volumes:
db_data:
db_data:
16 changes: 16 additions & 0 deletions postgres-init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
CREATE USER usernator WITH PASSWORD 'usernator';
CREATE DATABASE usernator;
GRANT ALL PRIVILEGES ON DATABASE usernator TO usernator;

CREATE USER tasky WITH PASSWORD 'tasky';
CREATE DATABASE tasky;
GRANT ALL PRIVILEGES ON DATABASE tasky TO tasky;

CREATE USER executor WITH PASSWORD 'executor';
CREATE DATABASE executor;
GRANT ALL PRIVILEGES ON DATABASE executor TO executor;


ALTER USER usernator WITH SUPERUSER;
ALTER USER tasky WITH SUPERUSER;
ALTER USER executor WITH SUPERUSER;
3 changes: 2 additions & 1 deletion tasky/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.env
.env
target/
2 changes: 1 addition & 1 deletion tasky/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN rm ./target/release/deps/tasky*
ENV IS_DOCKER="true"
RUN cargo build --release

FROM busybox:1.35.0-uclibc as busybox
FROM busybox:1.35.0-uclibc AS busybox

FROM gcr.io/distroless/cc-debian12
ARG ARCH=x86_64
Expand Down
2 changes: 2 additions & 0 deletions web/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.next/
7 changes: 5 additions & 2 deletions web/components/solution/ExecutorUIDisplay.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { Modal } from "@mantine/core";
import getConfig from "next/config";

export interface ExecutorUIDisplayProps {
jobId: string;
onClose: () => void;
}

const ExecutorUIDisplay = ({ jobId, onClose }: ExecutorUIDisplayProps) => {
const apiUrl = process.env.NODE_ENV === "production" ? "https://executor.code-canvas.app" : "http://localhost:3007";

const apiUrl =
getConfig().publicRuntimeConfig.EXECUTOR_UI_URL === ""
? "http://localhost:3008"
: getConfig().publicRuntimeConfig.EXECUTOR_UI_URL;
return (
<Modal opened onClose={onClose} size="100%">
<iframe
Expand Down
6 changes: 5 additions & 1 deletion web/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone'
output: "standalone",
publicRuntimeConfig: {
EXECUTOR_UI_URL: process.env.EXECUTOR_UI_URL,
API_URL: process.env.API_URL,
},
};

export default nextConfig;
17 changes: 11 additions & 6 deletions web/service/ApiService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { GetStudentsResponse, User } from "@/service/types/usernator";
import ApiError from "@/service/types/error";
import getConfig from "next/config";
import {
Assignment,
AssignmentLanguage,
Expand All @@ -26,7 +27,11 @@ class ApiService {
private apiUrl: string;

constructor() {
this.apiUrl = process.env.NODE_ENV === "production" ? "https://api.code-canvas.app" : "http://localhost:3002";
//this.apiUrl = process.env.NODE_ENV === "production" ? "https://api.code-canvas.app" : "http://localhost:3002";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this comment.


this.apiUrl = getConfig().publicRuntimeConfig.API_URL
? getConfig().publicRuntimeConfig.API_URL
: "http://localhost:3001";
}

public async self(): Promise<User | string> {
Expand All @@ -52,7 +57,7 @@ class ApiService {
}

public async createGroup(title: string): Promise<Group> {
return await this.post<Group>(`/tasky/create_group`, {title});
return await this.post<Group>(`/tasky/create_group`, { title });
}

public async getGroups(): Promise<GroupsResponse> {
Expand Down Expand Up @@ -268,10 +273,10 @@ class ApiService {
);
} else {
formData.set(
"answers",
new Blob(["{}"], {
type: "application/json",
}),
"answers",
new Blob(["{}"], {
type: "application/json",
}),
);
}
const resp = await fetch(
Expand Down
Loading