Skip to content
Merged
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
7 changes: 7 additions & 0 deletions docker/serverless/Dockerfile.with_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Serverless ESP docker image with build-in service config
FROM _SERVERLESS_IMAGE

ENV ENDPOINTS_SERVICE_PATH /etc/nginx/service.json
COPY service.json ${ENDPOINTS_SERVICE_PATH}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, where this service.json is generated?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I will have a separate PR to submit a shell script to use "gcloud" cli to download it and build the image.


ENTRYPOINT ["/env-start-esp.py"]
26 changes: 17 additions & 9 deletions docker/serverless/env-start-esp.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,29 @@ def main():
assert_env_var("PORT")
ARGS.append("--http_port={}".format(os.environ["PORT"]))

try:
assert_env_var("ENDPOINTS_SERVICE_NAME")
except KeyError as error:
serve_error_msg(error.message)
ARGS.append("--service={}".format(os.environ["ENDPOINTS_SERVICE_NAME"]))

if "ENDPOINTS_SERVICE_VERSION" in os.environ:
if "ENDPOINTS_SERVICE_PATH" in os.environ:
ARGS.extend(
[
"--rollout_strategy=fixed",
"--version={}".format(os.environ["ENDPOINTS_SERVICE_VERSION"]),
"--service_json_path={}".format(os.environ["ENDPOINTS_SERVICE_PATH"]),
]
)
else:
ARGS.append("--rollout_strategy=managed")
try:
assert_env_var("ENDPOINTS_SERVICE_NAME")
except KeyError as error:
serve_error_msg(error.message)
ARGS.append("--service={}".format(os.environ["ENDPOINTS_SERVICE_NAME"]))

if "ENDPOINTS_SERVICE_VERSION" in os.environ:
ARGS.extend(
[
"--rollout_strategy=fixed",
"--version={}".format(os.environ["ENDPOINTS_SERVICE_VERSION"]),
]
)
else:
ARGS.append("--rollout_strategy=managed")

if "CORS_PRESET" in os.environ:
ARGS.append("--cors_preset={}".format(os.environ["CORS_PRESET"]))
Expand Down
2 changes: 0 additions & 2 deletions start_esp/start_esp.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,8 +968,6 @@ def enforce_conflict_args(args):
return "Flag --enable_backend_routing cannot be used together with --service_control_url_override."
if args.metadata != METADATA_ADDRESS:
return "Flag --enable_backend_routing cannot be used together with --metadata."
if args.service_json_path:
Comment thread
nareddyt marked this conversation as resolved.
return "Flag --enable_backend_routing cannot be used together with --service_json_path."
if args.worker_processes != DEFAULT_WORKER_PROCESSES:
return "Flag --enable_backend_routing cannot be used together with --worker_processes."
if args.rewrite:
Expand Down