From 64b6154ef565ed18df52a721a4bdf64f14b6edac Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Mon, 26 Jun 2023 06:13:55 -0700 Subject: [PATCH] [Docs] Document how to build and deploy tunnelbroker Summary: After testing the deployment, document how it was able to be built and ran. Part of https://linear.app/comm/issue/ENG-4104 Test Plan: N/A. Documentation Reviewers: varun, ashoat, bartek Reviewed By: ashoat, bartek Subscribers: tomek Differential Revision: https://phab.comm.dev/D8312 --- docs/nix_dev_env.md | 5 ++++ docs/nix_services_deployment.md | 28 ++++++++++++++++++++++ services/tunnelbroker/make_docker_image.sh | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 docs/nix_services_deployment.md diff --git a/docs/nix_dev_env.md b/docs/nix_dev_env.md index 53273564f3..037589983a 100644 --- a/docs/nix_dev_env.md +++ b/docs/nix_dev_env.md @@ -127,6 +127,11 @@ Run `nix develop` to create a dev environment. Nix will handle the installation - [Committing a diff](./nix_shared_workflows.md#committing-a-diff) - [Final notes](./nix_shared_workflows.md#final-notes) +## Production workflows + +- [Services deployment](./nix_services_deployment.md) + - [Tunnelbroker](./nix_services_deployment.md#tunnelbroker) + ## Using alternate shells with Nix Alternate shells such as zsh or fish can also be used with Nix. To use an alternate shell, run: diff --git a/docs/nix_services_deployment.md b/docs/nix_services_deployment.md new file mode 100644 index 0000000000..81224ea10d --- /dev/null +++ b/docs/nix_services_deployment.md @@ -0,0 +1,28 @@ +# Services Deployment + +## Tunnelbroker + +Deploying Tunnelbroker consists of building its Docker image and deploying that image as a Docker container. + +### Building Tunnelbroker Image + +The Docker image for Tunnelbroker can be built using the following command from the project root: + +``` +docker build -f services/tunnelbroker -t commapp/tunnelbroker: . +# Alternatively, there's a script which creates a very small docker context before building +services/tunnelbroker/make_docker_image.sh -t commapp/tunnelbroker: . +``` + +### Running the container + +Tunnelbroker can be run in production using the following command: + +``` +docker run -d commapp/tunnelbroker: \ + -p 50051:50051 \ + -p 80:51001 \ + -v $HOME/.aws:/home/comm/.aws:ro \ + tunnelbroker \ + --amqp-uri= \ +``` diff --git a/services/tunnelbroker/make_docker_image.sh b/services/tunnelbroker/make_docker_image.sh index 0a58c397e4..a35507c1b0 100755 --- a/services/tunnelbroker/make_docker_image.sh +++ b/services/tunnelbroker/make_docker_image.sh @@ -16,4 +16,4 @@ cp -r "${SCRIPT_DIR}/../../shared/tunnelbroker_messages" \ cp -r "${SCRIPT_DIR}"/{Cargo.toml,Cargo.lock,build.rs,src} \ "$BUILD_DIR"/services/tunnelbroker/ -docker build -f "${SCRIPT_DIR}/Dockerfile" "$BUILD_DIR" +docker build "$@" -f "${SCRIPT_DIR}/Dockerfile" "$BUILD_DIR"