Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ USER="httpcvd"
RUN_DIR="/run/cuttlefish"
ORCHESTRATOR_BIN="/usr/lib/cuttlefish-common/bin/host_orchestrator"
ORCHESTRATOR_PIDFILE="${RUN_DIR}"/host_orchestrator.pid
ORCHESTRATOR_LOGFILE="${RUN_DIR}"/host_orchestrator.log
ASSET_DIR="/usr/share/cuttlefish-common/operator"

set_config_expr() {
Expand Down Expand Up @@ -75,8 +76,7 @@ start_orchestrator() {
mkdir -p "${orchestrator_cvd_artifacts_dir}"
chown "${USER}:" "${orchestrator_cvd_artifacts_dir}"

args=()

args=("--log_file=${ORCHESTRATOR_LOGFILE}")
if [[ -n "${orchestrator_http_port}" ]]; then
args+=("--http_port=${orchestrator_http_port}")
fi
Expand Down
3 changes: 2 additions & 1 deletion frontend/debian/cuttlefish-user.cuttlefish-operator.init
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ RUN_DIR="/run/cuttlefish"
ASSET_DIR="/usr/share/cuttlefish-common/operator"
DAEMON="/usr/lib/cuttlefish-common/bin/operator"
PIDFILE="${RUN_DIR}"/operator.pid
LOGFILE="${RUN_DIR}"/operator.log

gen_cert() {
operator_tls_cert_dir=${operator_tls_cert_dir:-/etc/cuttlefish-common/operator/cert}
Expand Down Expand Up @@ -68,7 +69,7 @@ start() {
chown _cutf-operator:cvdnetwork "${RUN_DIR}"
chmod 775 "${RUN_DIR}"

args=()
args=(--log_file="${LOGFILE}")
if [[ -n "${operator_http_port}" ]]; then
args+=(--http_port="${operator_http_port}")
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ server {
ssl_certificate /etc/cuttlefish-orchestration/ssl/cert/cert.pem;
ssl_certificate_key /etc/cuttlefish-orchestration/ssl/cert/key.pem;

location /hostlogs/cuttlefish-operator.service {
rewrite /hostlogs/cuttlefish-operator.service /entries?_SYSTEMD_UNIT=cuttlefish-operator.service break;
proxy_pass http://0.0.0.0:19531;
location = /hostlogs/cuttlefish-operator.service {
alias /run/cuttlefish/operator.log;
default_type "text/plain";
}
location /hostlogs/cuttlefish-host_orchestrator.service {
rewrite /hostlogs/cuttlefish-host_orchestrator.service /entries?_SYSTEMD_UNIT=cuttlefish-host_orchestrator.service break;
proxy_pass http://0.0.0.0:19531;
location = /hostlogs/cuttlefish-host_orchestrator.service {
alias /run/cuttlefish/host_orchestrator.log;
default_type "text/plain";
}
location /hostlogs/kernel {
rewrite /hostlogs/kernel /entries?_TRANSPORT=kernel break;
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ package main
import (
"flag"
"fmt"
"io"
"log"
"net/http"
"net/http/httputil"
"net/url"
"os"
"sync"

apiv1 "github.com/google/android-cuttlefish/frontend/src/liboperator/api/v1"
Expand Down Expand Up @@ -88,9 +90,20 @@ func main() {
tlsCertDir := flag.String("tls_cert_dir", DefaultTLSCertDir, "Directory where the TLS certificates are located.")
webUiUrlStr := flag.String("webui_url", DefaultWebUIUrl, "WebUI URL.")
address := flag.String("listen_addr", DefaultListenAddress, "IP address to listen for requests.")
logFile := flag.String("log_file", "", "Path to file to write logs to.")

flag.Parse()

if *logFile != "" {
f, err := os.OpenFile(*logFile, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("error opening log file %q: %v", *logFile, err)
}
defer f.Close()
w := io.MultiWriter(os.Stderr, f)
log.SetOutput(w)
}

certPath := *tlsCertDir + "/cert.pem"
keyPath := *tlsCertDir + "/key.pem"

Expand Down
Loading