OLD | NEW |
| (Empty) |
1 # Running the engine in a Docker container | |
2 | |
3 For local development and testing, you can run the engine in a Docker | |
4 container. | |
5 | |
6 The steps are: | |
7 | |
8 1. Bundle the engine and its dependencies. | |
9 | |
10 1. Build a Docker image. | |
11 | |
12 1. Create a Docker container. | |
13 | |
14 | |
15 ## About Docker | |
16 | |
17 To get a high-level overview of Docker, please read [Understand the | |
18 architecture](https://docs.docker.com/introduction/understanding-docker/). | |
19 Optional reading includes reference guides for | |
20 [`docker run`](https://docs.docker.com/reference/run/) and | |
21 [Dockerfile](https://docs.docker.com/reference/builder/). | |
22 | |
23 | |
24 ### Installation | |
25 | |
26 For Googlers running Goobuntu wanting to install Docker, see | |
27 [go/installdocker](https://goto.google.com/installdocker). For other | |
28 contributors using Ubuntu, see [official Docker | |
29 installation instructions](https://docs.docker.com/installation/ubuntulinux/). | |
30 | |
31 | |
32 ## Bundle Engine | |
33 | |
34 The `blimp/engine:blimp_engine_bundle` build target will bundle the engine and | |
35 its dependencies into a tarfile, which can be used to build a Docker image. | |
36 This target is always built as part of the top-level `blimp/blimp` meta-target. | |
37 | |
38 ### Manually checking dependencies | |
39 | |
40 `gen/engine-manifest.txt` is a list of the engine's runtime | |
41 dependencies. This list is automatatically generated in the build, but can | |
42 be manually replicated for debugging and investigation. Use | |
43 `blimp/tools/generate-target-manifest.py` to manually generate the manifest | |
44 after building blimp target to generate the runtime deps file: | |
45 | |
46 ```bash | |
47 ./blimp/tools/generate-target-manifest.py \ | |
48 --blacklist blimp/tools/engine-manifest-blacklist.txt \ | |
49 --output out-linux/Debug/engine-manifest.txt \ | |
50 --runtime-deps-file out-linux/Debug/gen/blimp-engine.runtime_deps | |
51 ``` | |
52 | |
53 You can compare the output at `out-linux/Debug/engine-manifest.txt` with the | |
54 generated target `out-linux/Debug/gen/engine-manifest.txt`. | |
55 | |
56 ## Build Docker Image | |
57 | |
58 Using the tarfile you can create a Docker image: | |
59 | |
60 ```bash | |
61 docker build -t base - < ./blimp/tools/Dockerfile.base | |
62 docker build -t blimp_engine - < ./out-linux/Debug/blimp_engine_bundle.tar.gz | |
63 ``` | |
64 | |
65 ## Running the Engine in a Docker Container | |
66 | |
67 After building the Docker image you can launch the engine inside the Docker | |
68 container. | |
69 | |
70 ### Setting up an Environment | |
71 | |
72 A little prep work is necessary to enable the engine to start as it requires a | |
73 few files that are not provided by the container. You need: | |
74 | |
75 * A directory (`$CONFIG_DIR`) with permissions of 0755 (ie. world accessable) | |
76 * `$CONFIG_DIR/stunnel.pem`: A PEM encoded file with a private key and a | |
77 public certificate. Permissions should be set to 644. | |
78 * `$CONFIG_DIR/client_token`: A file with a non-empty string used as the | |
79 client token (the shared secret between the client and the engine). | |
80 Permissions should also be set to 644. See [running](running.md) for how | |
81 to get the default token from the source code. | |
82 | |
83 This setup step is only required once and can be reused for all the rest of the | |
84 runs of the engine. | |
85 | |
86 ### Running the Engine | |
87 | |
88 Once the `$CONFIG_DIR` is set up, you can launch the engine in the Docker | |
89 container: | |
90 | |
91 ```bash | |
92 docker run -v $CONFIG_DIR:/engine/data -p 443:25466 blimp_engine | |
93 ``` | |
94 You can also pass additional flags: | |
95 | |
96 ```bash | |
97 docker run ... blimp_engine --with-my-flags | |
98 ``` | |
99 See the [blimp engine `Dockerfile`](../engine/Dockerfile) to find out what flags | |
100 are passed by default. | |
OLD | NEW |