| OLD | NEW |
| 1 # Running the engine in a Docker container | 1 # Running the engine in a Docker container |
| 2 | 2 |
| 3 For local development and testing, you can run the engine in a Docker | 3 For local development and testing, you can run the engine in a Docker |
| 4 container. | 4 container. |
| 5 | 5 |
| 6 The steps are: | 6 The steps are: |
| 7 | 7 |
| 8 1. Bundle the engine and its dependencies. | 8 1. Bundle the engine and its dependencies. |
| 9 | 9 |
| 10 1. Build a Docker image. | 10 1. Build a Docker image. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 dependencies. | 52 dependencies. |
| 53 | 53 |
| 54 ## Build Docker Image | 54 ## Build Docker Image |
| 55 | 55 |
| 56 Using the tarfile you can create a Docker image: | 56 Using the tarfile you can create a Docker image: |
| 57 | 57 |
| 58 ```bash | 58 ```bash |
| 59 docker build -t blimp_engine - < ./out-linux/Debug/blimp_engine_bundle.tar | 59 docker build -t blimp_engine - < ./out-linux/Debug/blimp_engine_bundle.tar |
| 60 ``` | 60 ``` |
| 61 | 61 |
| 62 ## Create Docker Container | 62 ## Running the Engine in a Docker Container |
| 63 | 63 |
| 64 From the Docker image you can create a Docker container (i.e. run the engine): | 64 After building the Docker image you can launch the engine inside the Docker |
| 65 container. |
| 66 |
| 67 ### Setting up an Environment |
| 68 |
| 69 A little prep work is necessary to enable the engine to start as it requires a |
| 70 few files that are not provided by the container, namely the client token file |
| 71 and a key/cert pair for stunnel to start up. This should be a one-time |
| 72 operation, and you can use the same directory for subsequent runs of the engine. |
| 65 | 73 |
| 66 ```bash | 74 ```bash |
| 67 docker run blimp_engine | 75 CONFIG_DIR=/path/to/dir |
| 76 mkdir -p -m 0755 $CONFIG_DIR |
| 77 cd $CONFIG_DIR |
| 78 openssl genrsa -out tmp.key 2048 |
| 79 openssl req -subj "/CN=domain.com/O=Blimp/C=US" \ |
| 80 -new -key tmp.key -days 365 -nodes -x509 -out stunnel.pem |
| 81 cat tmp.key >> stunnel.pem && rm tmp.key |
| 82 echo "token" > $CONFIG_DIR/client_token |
| 83 chmod 644 stunnel.pem client_token |
| 68 ``` | 84 ``` |
| 69 | 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 ``` |
| 70 You can also pass additional flags: | 94 You can also pass additional flags: |
| 71 | 95 |
| 72 ```bash | 96 ```bash |
| 73 docker run blimp_engine --with-my-flags | 97 docker run ... blimp_engine --with-my-flags |
| 74 ``` | 98 ``` |
| 75 | |
| 76 See the [blimp engine `Dockerfile`](../engine/Dockerfile) to find out what flags | 99 See the [blimp engine `Dockerfile`](../engine/Dockerfile) to find out what flags |
| 77 are passed by default. | 100 are passed by default. |
| 78 | 101 |
| 79 ### Mapping Volumes into the Docker Container | |
| 80 | |
| 81 If you need to map a directory into the Docker container (eg. for necessary | |
| 82 files): | |
| 83 | |
| 84 ```bash | |
| 85 docker run -v /path/to/srcdir:/path/to/docker/destdir blimp_engine | |
| 86 ``` | |
| 87 | |
| 88 NB: The permissions of the directory and the files outside of the Docker | |
| 89 container will be carried over into the container. | |
| OLD | NEW |