Đổi tên phần mềm từ lidar_manager_app thành robot_app
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(lidar_manager_web LANGUAGES CXX)
|
||||
project(robot_app LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
@@ -29,9 +29,9 @@ endif()
|
||||
|
||||
find_package(SQLite3 REQUIRED)
|
||||
|
||||
add_executable(lidar_manager_web
|
||||
add_executable(robot_app
|
||||
src/main.cpp
|
||||
src/app/lidar_manager_app.cpp
|
||||
src/app/robot_app.cpp
|
||||
src/util/file_util.cpp
|
||||
src/util/string_util.cpp
|
||||
src/util/id_util.cpp
|
||||
@@ -75,18 +75,18 @@ add_executable(lidar_manager_web
|
||||
src/server/api_dashboard_routes.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(lidar_manager_web PRIVATE Threads::Threads SQLite::SQLite3)
|
||||
target_link_libraries(robot_app PRIVATE Threads::Threads SQLite::SQLite3)
|
||||
|
||||
target_include_directories(lidar_manager_web PRIVATE
|
||||
target_include_directories(robot_app PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
)
|
||||
|
||||
target_include_directories(lidar_manager_web SYSTEM PRIVATE
|
||||
target_include_directories(robot_app SYSTEM PRIVATE
|
||||
"${cpp_httplib_SOURCE_DIR}"
|
||||
"${nlohmann_json_SOURCE_DIR}/single_include"
|
||||
)
|
||||
|
||||
target_compile_definitions(lidar_manager_web PRIVATE
|
||||
target_compile_definitions(robot_app PRIVATE
|
||||
_DEFAULT_SOURCE
|
||||
)
|
||||
|
||||
@@ -112,24 +112,24 @@ if(BUILD_TESTING)
|
||||
src/validation/sensor_validator.cpp
|
||||
)
|
||||
|
||||
add_executable(lidar_manager_tests
|
||||
add_executable(robot_app_tests
|
||||
tests/test_mission_enqueue.cpp
|
||||
tests/test_mission_store.cpp
|
||||
tests/test_sensor_validator.cpp
|
||||
${LM_TEST_LIB_SOURCES}
|
||||
)
|
||||
|
||||
target_include_directories(lidar_manager_tests PRIVATE
|
||||
target_include_directories(robot_app_tests PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
||||
)
|
||||
target_include_directories(lidar_manager_tests SYSTEM PRIVATE
|
||||
target_include_directories(robot_app_tests SYSTEM PRIVATE
|
||||
"${nlohmann_json_SOURCE_DIR}/single_include"
|
||||
)
|
||||
target_compile_definitions(lidar_manager_tests PRIVATE
|
||||
target_compile_definitions(robot_app_tests PRIVATE
|
||||
TEST_FIXTURE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/tests/fixtures/data"
|
||||
)
|
||||
target_link_libraries(lidar_manager_tests PRIVATE GTest::gtest_main SQLite::SQLite3)
|
||||
target_link_libraries(robot_app_tests PRIVATE GTest::gtest_main SQLite::SQLite3)
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(lidar_manager_tests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_test(NAME unit COMMAND lidar_manager_tests)
|
||||
gtest_discover_tests(robot_app_tests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_test(NAME unit COMMAND robot_app_tests)
|
||||
endif()
|
||||
|
||||
@@ -30,12 +30,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /src/build/lidar_manager_web /app/lidar_manager_web
|
||||
COPY --from=build /src/build/robot_app /app/robot_app
|
||||
COPY www ./www
|
||||
|
||||
RUN mkdir -p data/maps data/sounds data/recordings
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["/app/lidar_manager_web"]
|
||||
ENTRYPOINT ["/app/robot_app"]
|
||||
CMD ["8080", "/app/www", "/app/data/RBS.db"]
|
||||
|
||||
@@ -21,13 +21,13 @@ cmake --build build -j
|
||||
Chạy mặc định port 8080, phục vụ static từ `www/`, dữ liệu SQLite tại `data/RBS.db`:
|
||||
|
||||
```bash
|
||||
./build/lidar_manager_web
|
||||
./build/robot_app
|
||||
```
|
||||
|
||||
Hoặc chỉ định:
|
||||
|
||||
```bash
|
||||
./build/lidar_manager_web 8080 ./www ./data/RBS.db
|
||||
./build/robot_app 8080 ./www ./data/RBS.db
|
||||
```
|
||||
|
||||
Mở trình duyệt: `http://localhost:8080/`
|
||||
@@ -64,7 +64,7 @@ Trang web **bắt buộc đăng nhập**. Hai tab: tên/mật khẩu hoặc **M
|
||||
|
||||
PIN 4 chữ số chỉ dùng được với user thuộc nhóm **Users** sau khi admin gán PIN (`PUT /api/users/:id`).
|
||||
|
||||
Tắt auth cho dev/test: `LM_AUTH_DISABLED=1 ./build/lidar_manager_web …`
|
||||
Tắt auth cho dev/test: `LM_AUTH_DISABLED=1 ./build/robot_app …`
|
||||
Tài liệu đầy đủ: [`docs/Reference_guide.md` §2.1](docs/Reference_guide.md#21-signing-in).
|
||||
|
||||
## Docker (giới hạn 2 CPU, 4 GB RAM)
|
||||
@@ -131,7 +131,7 @@ ctest --test-dir build --output-on-failure
|
||||
Chỉ API smoke (server đang chạy, dùng fixture `tests/fixtures/data/`):
|
||||
|
||||
```bash
|
||||
./build/lidar_manager_web 18080 www tests/fixtures/data/state.json &
|
||||
./build/robot_app 18080 www tests/fixtures/data/state.json &
|
||||
./scripts/lm.sh test smoke http://127.0.0.1:18080
|
||||
```
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
name: rbs
|
||||
|
||||
services:
|
||||
lidar-manager:
|
||||
robot-app:
|
||||
build: .
|
||||
image: lidar-manager-web:RBS
|
||||
container_name: lidar-manager-limited
|
||||
image: robot-app:RBS
|
||||
container_name: robot-app-limited
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
|
||||
@@ -38,6 +38,6 @@ scripts/
|
||||
|------|----------|---------|
|
||||
| `LM_URL` | `http://127.0.0.1:8080` | URL container |
|
||||
| `LM_TEST_PORT` | `18080` | Port server tạm khi `test run` |
|
||||
| `LM_CONTAINER` | `lidar-manager-limited` | Tên container |
|
||||
| `LM_CONTAINER` | `robot-app-limited` | Tên container |
|
||||
| `TEST_BASE_URL` | — | Base URL cho pytest |
|
||||
| `BENCH_REQUESTS` | `100` | Số request mỗi endpoint benchmark |
|
||||
|
||||
@@ -13,5 +13,5 @@ echo
|
||||
bench_http_suite "$BASE"
|
||||
echo
|
||||
echo "=== Process ==="
|
||||
ps -C lidar_manager_web -o pid,rss,vsz,pcpu,pmem,etime,cmd 2>/dev/null \
|
||||
|| pgrep -af '[./]lidar_manager_web' | grep -v pgrep || true
|
||||
ps -C robot_app -o pid,rss,vsz,pcpu,pmem,etime,cmd 2>/dev/null \
|
||||
|| pgrep -af '[./]robot_app' | grep -v pgrep || true
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
_lm_lib_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
LM_ROOT="$(cd "$_lm_lib_dir/../.." && pwd)"
|
||||
LM_SCRIPTS="$(cd "$_lm_lib_dir/.." && pwd)"
|
||||
LM_CONTAINER="${LM_CONTAINER:-lidar-manager-limited}"
|
||||
LM_CONTAINER="${LM_CONTAINER:-robot-app-limited}"
|
||||
LM_URL="${LM_URL:-http://127.0.0.1:8080}"
|
||||
LM_TEST_PORT="${LM_TEST_PORT:-18080}"
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ source "$(dirname "$0")/../lib/common.sh"
|
||||
cd "$LM_ROOT"
|
||||
PORT="${TEST_PORT:-$LM_TEST_PORT}"
|
||||
BASE="http://127.0.0.1:${PORT}"
|
||||
BIN="${LM_ROOT}/build/lidar_manager_web"
|
||||
BIN="${LM_ROOT}/build/robot_app"
|
||||
DATA_DIR="$(mktemp -d)"
|
||||
SERVER_PID=""
|
||||
|
||||
@@ -28,7 +28,7 @@ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON
|
||||
cmake --build build -j
|
||||
|
||||
echo "==> C++ unit tests (GTest)"
|
||||
./build/lidar_manager_tests
|
||||
./build/robot_app_tests
|
||||
|
||||
echo "==> Prepare isolated data directory"
|
||||
cp -a tests/fixtures/data/. "$DATA_DIR/"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "app/lidar_manager_app.hpp"
|
||||
#include "app/robot_app.hpp"
|
||||
|
||||
#include "auth/auth_service.hpp"
|
||||
#include "io/io_module_service.hpp"
|
||||
@@ -46,14 +46,12 @@ std::filesystem::path resolveDataPath(std::filesystem::path data_path)
|
||||
|
||||
} // namespace
|
||||
|
||||
LidarManagerApp::LidarManagerApp(int port,
|
||||
std::filesystem::path www_root,
|
||||
std::filesystem::path data_path)
|
||||
RobotApp::RobotApp(int port, std::filesystem::path www_root, std::filesystem::path data_path)
|
||||
: port_(port), www_root_(std::move(www_root)), data_path_(std::move(data_path))
|
||||
{
|
||||
}
|
||||
|
||||
int LidarManagerApp::run()
|
||||
int RobotApp::run()
|
||||
{
|
||||
data_path_ = resolveDataPath(data_path_);
|
||||
const std::filesystem::path data_dir = data_path_.parent_path();
|
||||
@@ -128,7 +126,7 @@ int LidarManagerApp::run()
|
||||
StaticFileServer::mount(svr, www_root_);
|
||||
|
||||
std::fprintf(stderr,
|
||||
"lidar_manager_web listening on http://0.0.0.0:%d (www=%s, db=%s, maps=%s, sounds=%s)\n",
|
||||
"robot_app listening on http://0.0.0.0:%d (www=%s, db=%s, maps=%s, sounds=%s)\n",
|
||||
port_,
|
||||
www_root_.string().c_str(),
|
||||
database.dbPath().string().c_str(),
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
namespace lm {
|
||||
|
||||
class LidarManagerApp
|
||||
class RobotApp
|
||||
{
|
||||
public:
|
||||
LidarManagerApp(int port, std::filesystem::path www_root, std::filesystem::path data_path);
|
||||
RobotApp(int port, std::filesystem::path www_root, std::filesystem::path data_path);
|
||||
|
||||
int run();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "app/lidar_manager_app.hpp"
|
||||
#include "app/robot_app.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
@@ -10,6 +10,6 @@ int main(int argc, char** argv)
|
||||
const std::filesystem::path data_path =
|
||||
(argc >= 4) ? std::filesystem::path(argv[3]) : std::filesystem::path("data/RBS.db");
|
||||
|
||||
lm::LidarManagerApp app(port, www_root, data_path);
|
||||
lm::RobotApp app(port, www_root, data_path);
|
||||
return app.run();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Integration tests for lidar_manager_web REST API."""
|
||||
"""Integration tests for robot_app REST API."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user