diff --git a/.github/workflows/unix.yml b/.github/workflows/unix.yml index e628efd81..60b25de71 100644 --- a/.github/workflows/unix.yml +++ b/.github/workflows/unix.yml @@ -336,7 +336,10 @@ jobs: - name: Compile Web Interface if: matrix.config.webui == 'On' - run: cmake --build build --target motis-web-ui + run: | + cmake --build build --target motis-web-ui + rm -r ui/web/elm-stuff + rm -r ui/web/src - name: Create Distribution if: matrix.config.artifact diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5983eda70..db6622e6c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -91,7 +91,10 @@ jobs: # ==== DISTRIBUTION ==== - name: Compile Web Interface if: matrix.config.webui == 'On' - run: cmake --build build --target motis-web-ui + run: | + cmake --build build --target motis-web-ui + rm -r ui/web/elm-stuff + rm -r ui/web/src - name: Move Profiles if: matrix.config.mode == 'Release' diff --git a/.pkg b/.pkg index c5d3d5fcd..dd3c79e65 100644 --- a/.pkg +++ b/.pkg @@ -9,7 +9,7 @@ [conf] url=git@github.com:motis-project/conf.git branch=master - commit=b7d42aa063dd815cee6157bd27dce0caa82d2fa6 + commit=4c809244b10de534f4423ce4b27aa1a371610e96 [ctx] url=git@github.com:motis-project/ctx.git branch=master diff --git a/Dockerfile b/Dockerfile index 9595afe3a..3f1c3b2be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,33 @@ FROM alpine:3.14 ARG TARGETARCH ADD motis-linux-$TARGETARCH/motis-linux-$TARGETARCH.tar.bz2 / -RUN addgroup -S motis && adduser -S motis -G motis +RUN addgroup -S motis && adduser -S motis -G motis && \ + mkdir /data && \ + chown motis:motis /data && \ + echo -e "\ +server.static_path=/motis/web \ +\ +intermodal.router=tripbased \ +\ +[import] \ +paths=schedule:/input/schedule \ +paths=osm:/input/osm.pbf \ +data_dir=/data \ +\ +[tiles] \ +profile=/motis/tiles-profiles/background.lua \ +\ +[osrm] \ +profiles=/motis/osrm-profiles/car.lua \ +profiles=/motis/osrm-profiles/bike.lua \ +profiles=/motis/osrm-profiles/bus.lua \ +\ +[ppr] \ +profile=/motis/ppr-profiles/default.json \ +" > /system_config.ini EXPOSE 8080 VOLUME ["/data"] +VOLUME ["/input"] WORKDIR /motis USER motis -CMD ["/motis/motis", "-c", "/data/config.ini"] +CMD ["/motis/motis", "--system_config", "/system_config.ini", "-c", "/input/config.ini"] diff --git a/base/loader/include/motis/loader/loader_options.h b/base/loader/include/motis/loader/loader_options.h index 4d6bc02bf..0518d6e59 100644 --- a/base/loader/include/motis/loader/loader_options.h +++ b/base/loader/include/motis/loader/loader_options.h @@ -12,6 +12,7 @@ namespace motis::loader { struct loader_options { std::pair interval() const; std::string graph_path(std::string const& data_dir) const; + std::string fbs_schedule_path(std::string const& data_dir, size_t id) const; std::vector dataset_{"rohdaten"}; std::string schedule_begin_{"TODAY"}; diff --git a/base/loader/include/motis/loader/parser.h b/base/loader/include/motis/loader/parser.h index 9c0cf1c01..7df37ecd1 100644 --- a/base/loader/include/motis/loader/parser.h +++ b/base/loader/include/motis/loader/parser.h @@ -11,8 +11,6 @@ namespace flatbuffers64 { class FlatBufferBuilder; // NOLINT(readability-identifier-naming) } // namespace flatbuffers64 -constexpr auto const SCHEDULE_FILE = "schedule.raw"; - namespace motis::loader { struct format_parser { diff --git a/base/loader/src/loader.cc b/base/loader/src/loader.cc index 62f22c0ce..2109e0495 100644 --- a/base/loader/src/loader.cc +++ b/base/loader/src/loader.cc @@ -85,11 +85,10 @@ schedule_ptr load_schedule(loader_options const& opt, std::vector mem; mem.reserve(opt.dataset_.size()); for (auto const& [i, path] : utl::enumerate(opt.dataset_)) { - auto const binary_schedule_file = fs::path(path) / SCHEDULE_FILE; + auto const binary_schedule_file = opt.fbs_schedule_path(data_dir, i); if (fs::is_regular_file(binary_schedule_file)) { - mem.emplace_back( - cista::mmap{binary_schedule_file.generic_string().c_str(), - cista::mmap::protection::READ}); + mem.emplace_back(cista::mmap{binary_schedule_file.c_str(), + cista::mmap::protection::READ}); continue; } @@ -127,7 +126,11 @@ schedule_ptr load_schedule(loader_options const& opt, } if (opt.write_serialized_) { - utl::file(binary_schedule_file.string().c_str(), "w+") + auto const schedule_dir = fs::path{binary_schedule_file}.parent_path(); + if (!schedule_dir.empty()) { + fs::create_directories(schedule_dir); + } + utl::file(binary_schedule_file.c_str(), "w+") .write(builder.GetBufferPointer(), builder.GetSize()); } diff --git a/base/loader/src/loader_options.cc b/base/loader/src/loader_options.cc index 716f01cb4..818736d8a 100644 --- a/base/loader/src/loader_options.cc +++ b/base/loader/src/loader_options.cc @@ -42,4 +42,15 @@ std::string loader_options::graph_path(std::string const& data_dir) const { } } +std::string loader_options::fbs_schedule_path(std::string const& data_dir, + size_t const id) const { + if (dataset_prefix_.empty()) { + return (fs::path{data_dir} / "schedule" / "schedule.raw").generic_string(); + } else { + return (fs::path{data_dir} / "schedule" / + (dataset_prefix_.at(id) + "_schedule.raw")) + .generic_string(); + } +} + } // namespace motis::loader