Skip to content
Merged
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 .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ jobs:
export SENTRY_DSN="${{ secrets.SENTRY_DSN }}"
export GIT_CLIENT_ID="${{ secrets.GIT_CLIENT_ID }}"
export GIT_CLIENT_SECRET="${{ secrets.GIT_CLIENT_SECRET }}"
export SANDBOX_URL="${{ secrets.SANDBOX_URL }}"
cd ~/app
bash deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -47,9 +48,11 @@ public class RepositoryRunService {
private final FileNodeRepository fileNodeRepository;
private final FileContentRepository fileContentRepository;
private final RunningContainerRepository runningContainerRepository;
private final String sandboxBaseUrl = "http://localhost:9090";
private final RestTemplate restTemplate;

@Value("${sandbox.api.base-url}")
private String sandboxBaseUrl;

@Transactional
public RepositoryExecuteResponse executeRepository(Long repositoryId, Long userId) {
log.info("Starting repository execution - repositoryId: {}, userId: {}", repositoryId, userId);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.deepdirect.deepwebide_be.sandbox.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
Expand All @@ -16,10 +17,13 @@ public class SandboxLogController {

private final RestTemplate restTemplate = new RestTemplate();

@Value("${sandbox.api.base-url}")
private String sandboxBaseUrl;

@GetMapping("/logs/{uuid}")
public ResponseEntity<String> getContainerLogs(@PathVariable String uuid) {
String containerId = "sandbox-" + uuid;
String sandboxUrl = "http://localhost:9090/api/sandbox/logs/" + containerId;
String sandboxUrl = sandboxBaseUrl + "/api/sandbox/logs/" + containerId;

try {
ResponseEntity<String> response = restTemplate.getForEntity(sandboxUrl, String.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class SandboxService {

private final RestTemplate restTemplate;

@Value("${sandbox.api.base-url:http://localhost:9090}")
@Value("${sandbox.api.base-url}")
private String sandboxBaseUrl;

public SandboxExecutionResponse requestExecution(SandboxExecutionRequest request) {
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,8 @@ logging:
io:
sentry: INFO
com:
deepdirect: DEBUG
deepdirect: DEBUG

sandbox:
api:
base-url: ${SANDBOX_URL}