Fix //scouting/deploy
The deployed binary currently prints the following error:
ERROR: cannot find bazel_tools/tools/bash/runfiles/runfiles.bash
This is a side effect of Iaac8b3fbe76182859962e0d60a68fe3de0fe34cb
which started using the runfiles API. The final deployed binary did
not have the same runfiles layout. The `pkg_tar` rule unfortunately
does not recreate the same runfiles tree. The workaround here is to
fake it with some symlinks.
The scouting server starts up again.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I8312dfd88d1c37223885a115dbe0b6d006d1e802
diff --git a/scouting/deploy/BUILD b/scouting/deploy/BUILD
index ed4b9cd..2bf4b4e 100644
--- a/scouting/deploy/BUILD
+++ b/scouting/deploy/BUILD
@@ -17,6 +17,15 @@
include_runfiles = True,
package_dir = "opt/frc971/scouting_server",
strip_prefix = ".",
+ # The "include_runfiles" attribute creates a runfiles tree as seen from
+ # within the workspace directory. But what we really want is the runfiles
+ # tree as seen from the root of the runfiles tree (i.e. one directory up).
+ # So we work around it by manually adding some symlinks that let us pretend
+ # that we're at the root of the runfiles tree.
+ symlinks = {
+ "opt/frc971/scouting_server/org_frc971": ".",
+ "opt/frc971/scouting_server/bazel_tools": "external/bazel_tools",
+ },
)
pkg_tar(
diff --git a/scouting/deploy/scouting.service b/scouting/deploy/scouting.service
index b22a57d..5aa64b0 100644
--- a/scouting/deploy/scouting.service
+++ b/scouting/deploy/scouting.service
@@ -7,6 +7,7 @@
Group=www-data
Type=simple
WorkingDirectory=/opt/frc971/scouting_server
+Environment=RUNFILES_DIR=/opt/frc971/scouting_server
ExecStart=/opt/frc971/scouting_server/scouting/scouting \
-port 8080 \
-db_config /var/frc971/scouting/db_config.json \