Skip to content

Commit

Permalink
Got grafana working
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenewald committed Oct 4, 2024
1 parent 7a3e63d commit 68feb11
Show file tree
Hide file tree
Showing 64 changed files with 32 additions and 25,100 deletions.
2 changes: 1 addition & 1 deletion docker/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ services:
restart: unless-stopped
build:
context: ../..
dockerfile: exchange/docker/linter/LinterDockerfile
dockerfile: exchange/docker/linter/Dockerfile
args:
firebase_emulator: "false"

Expand Down
14 changes: 11 additions & 3 deletions docker/dev/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,28 @@ http {
'' close;
}

upstream webserver {
server webserver:16124;
}

upstream grafana {
server grafana:3000;
}

server {
listen 80;

location /webserver/ {
rewrite ^/webserver(/.*)$ $1 break;
proxy_pass http://webserver:16124;
proxy_pass http://webserver;
proxy_set_header Host $host;
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
}

location / {
proxy_pass http://grafana:3000;
proxy_pass http://grafana;
proxy_set_header Host $host;
}

Expand All @@ -37,7 +45,7 @@ http {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_pass http://grafana:3000;
proxy_pass http://grafana;
}
}
}
2 changes: 1 addition & 1 deletion exchange/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ target_link_libraries(LINTER_spawner_lib PRIVATE boost::boost)
add_executable(LINTER_exe src/linter/main.cpp)
add_executable(LINTER::exe ALIAS LINTER_exe)

set_property(TARGET LINTER_exe PROPERTY OUTPUT_NAME linter)
set_property(TARGET LINTER_exe PROPERTY OUTPUT_NAME LINTER)

target_compile_features(LINTER_exe PRIVATE cxx_std_20)

Expand Down
Binary file modified exchange/docker/dev/grafana_data/grafana.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,21 @@ COPY ./exchange/CMakePresets.json /app/exchange
COPY ./exchange/cmake /app/exchange/cmake
COPY ./exchange/test /app/exchange/test

ARG firebase_emulator=false

RUN if [ "$firebase_emulator" = "false" ]; then \
cmake --preset=ci-docker; \
else \
cmake --preset=ci-docker -DLOCAL_DEV=ON; \
fi
RUN cmake --preset=ci-docker

RUN cmake --build build --config Release -j

ENV NUTC_LINTER_SPAWNER_BINARY_PATH="/bin/LINTER_spawner"
RUN mv /app/exchange/build/LINTER_spawner /app/LINTER_spawner
RUN mv /app/exchange/build/LINTER /app/LINTER

RUN mv /app/exchange/build/LINTER_spawner /bin/LINTER_spawner
RUN mv /app/exchange/build/linter /bin/LINTER
ENV NUTC_LINTER_SPAWNER_BINARY_PATH="/app/LINTER_spawner"

RUN chmod +x /bin/LINTER
RUN chmod +x /bin/LINTER_spawner
RUN chmod +x /app/LINTER
RUN chmod +x /app/LINTER_spawner

COPY ./exchange/template.cpp /app/template.cpp
ENV NUTC_CPP_TEMPLATE_PATH="/app/template.cpp"

EXPOSE 18081

CMD LINTER
CMD /app/LINTER
18 changes: 6 additions & 12 deletions exchange/docker/sandbox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,24 @@ COPY ./exchange/CMakePresets.json /app/exchange
COPY ./exchange/cmake /app/exchange/cmake
COPY ./exchange/test /app/exchange/test

ARG firebase_emulator=false

RUN if [ "$firebase_emulator" = "false" ]; then \
cmake --preset=ci-docker; \
else \
cmake --preset=ci-docker -DLOCAL_DEV=ON; \
fi
RUN cmake --preset=ci-docker

RUN cmake --build build --config Release -j

RUN mv /app/exchange/build/NUTC /usr/bin/NUTC-exchange
RUN mv /app/exchange/build/WRAPPER /usr/bin/WRAPPER
RUN mv /app/exchange/build/NUTC /app/NUTC
RUN mv /app/exchange/build/WRAPPER /app/WRAPPER

# Todo: make default?
COPY ./exchange/config.yml /app/exchange/config.yml

RUN chmod +x /usr/bin/NUTC-exchange /usr/bin/WRAPPER
RUN chmod +x /app/NUTC /app/WRAPPER

COPY ./exchange/template.cpp /app/template.cpp

ENV NUTC_WRAPPER_BINARY_PATH="/usr/bin/WRAPPER"
ENV NUTC_WRAPPER_BINARY_PATH="/app/WRAPPER"
ENV NUTC_CONFIG_FILE="/app/exchange/config.yml"
ENV NUTC_CPP_TEMPLATE_PATH="/app/template.cpp"

EXPOSE 4152 18080

ENTRYPOINT ["/usr/bin/NUTC-exchange"]
ENTRYPOINT ["/app/NUTC"]
4 changes: 2 additions & 2 deletions exchange/src/exchange/sandbox_server/crow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ CrowServer::CrowServer() :
std::string algorithm_data = req.body;
add_pending_trader_(algo_id, language_enum, algorithm_data);
return res;
} catch (...) {
log_e(sandbox_server, "Failed to spawn algorithm");
} catch (const std::exception& e) {
log_e(sandbox_server, "Failed to spawn algorithm: {}", e.what());
return crow::response(500);
}
}
Expand Down
10 changes: 0 additions & 10 deletions exchange/src/linter/spawner/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,10 @@ main(int argc, char* argv[])
return 1;
}

std::cerr << "TESTING" << std::endl;

std::string algo_code_base64;
std::getline(std::cin, algo_code_base64);
std::cerr << "gotline" << std::endl;

std::string algo_code = nutc::common::base64_decode(algo_code_base64);
std::cerr << "decoded\n" << algo_code << std::endl;

nutc::lint::lint_result lint_result;
std::string flag = argv[1];
Expand All @@ -63,14 +59,10 @@ main(int argc, char* argv[])
lint_result = nutc::lint::lint(runtime);
}
else if (flag == "-cpp") {
std::cerr << "cpprun" << std::endl;
nutc::lint::CppRuntime runtime(
algo_code, mock_limit_func, mock_market_func, mock_cancel_func
);
std::cerr << "cpplint" << std::endl;
lint_result = nutc::lint::lint(runtime);
std::cerr << "lint output" << std::endl << lint_result.message << std::endl;
std::cerr << "cpplintdone" << std::endl;
}
else {
std::cout << "[linter] no language provided\n";
Expand All @@ -79,11 +71,9 @@ main(int argc, char* argv[])

auto output = glz::write_json(lint_result);
if (output) {
std::cerr << "output" << *output << std::endl;
std::cout << *output << std::endl;
}
else {
std::cerr << "error" << std::endl;
std::cout << fmt::format(
"[linter] ERROR WRITING LINT RESULT: {}", glz::format_error(output.error())
) << std::endl;
Expand Down
3 changes: 0 additions & 3 deletions web-old/.eslintrc.json

This file was deleted.

5 changes: 0 additions & 5 deletions web-old/.firebaserc

This file was deleted.

43 changes: 0 additions & 43 deletions web-old/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions web-old/app/app-rejected/layout.tsx

This file was deleted.

93 changes: 0 additions & 93 deletions web-old/app/app-rejected/page.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions web-old/app/app-submitted/layout.tsx

This file was deleted.

33 changes: 0 additions & 33 deletions web-old/app/app-submitted/page.tsx

This file was deleted.

Binary file removed web-old/app/assets/background.png
Binary file not shown.
Loading

0 comments on commit 68feb11

Please sign in to comment.