|
1 | | -# nuodb-compose |
| 1 | +# nuodb-compose # |
2 | 2 | Docker compose files for starting a nuodb database on the local host. |
3 | 3 |
|
4 | 4 | These docker compose files will create: |
5 | 5 | * a new docker network specifically for this database; |
6 | | -* separate AP (admin), TE, and SM containers for each NuoDB process; |
| 6 | +* separate AP (admin), TE, and SM containers - one for each NuoDB process; |
7 | 7 | * a separate CD (collector) container for each engine container - to enable NuoDB Insights; |
8 | | -* an influxdb and grafana container to host the NuoDB Insights dashboards. |
| 8 | +* influxdb and grafana containers to host the NuoDB Insights dashboards. |
9 | 9 |
|
10 | 10 | Note that the container names will have the `project` name embedded - which is the name of the directory (`nuodb`), or set with the `-p` option to `docker-compose`. |
11 | 11 |
|
12 | | -# Instructions |
13 | | -0. clone the repo; |
14 | | -1. cd to the `nuodb` directory; |
15 | | -2. edit the `.env` file |
16 | | - - if you want to use the a specific SQL engine, you will need an image that supports that engine; |
17 | | - - if you want to access the database from outside the `docker network` then set `EXTERNAL_ADDRESS` |
18 | | - -- either in the `.env` file, _or_ by setting `EXTERNAL_ADDRESS` on the `docker-compose up` command-line; |
19 | | - - if you want to import initial state from a backup into the new database, set `IMPORT_SOURCE` to a path |
20 | | - on the _local_ machine. The SM container will mount this file as a volume and extract (untar) it into the |
| 12 | +# Instructions # |
| 13 | +## Creating the database ## |
| 14 | +0. clone the repo. |
| 15 | + |
| 16 | +1. cd to the `nuodb` directory. |
| 17 | + |
| 18 | +2. copy the `env-default` file to `.env` (this step is _NOT_ optional). |
| 19 | + |
| 20 | +3. edit the `.env` file: |
| 21 | + - if you want to use a specific SQL engine - for example `scalar` - you will need an image that supports that engine; |
| 22 | + - if you want to access the database from outside the `docker network` - for example from an app running direcly on the local host - then set `EXTERNAL_ADDRESS`; |
| 23 | + - either in the `.env` file, _or_ by setting `EXTERNAL_ADDRESS` on the `docker-compose up` command-line; |
| 24 | + - if you want to import initial state from a database backup into the new database, set `IMPORT_SOURCE` to a path |
| 25 | + on the _local_ machine. The SM container will mount this file as a volume and extract (`untar`) it into the |
21 | 26 | archive dir prior to starting the SM process; |
22 | | - (only if the archive dir is empty - so the SM container can be stopped and restarted without being reinitialised.) |
23 | | - -- if you have set `IMPORT_SOURCE` _and_ it is a large file that takes multiple minutes to extract, you _may_ need to |
24 | | - set `STARTUP_TIMEOUT` to a larger value, to stop the starup from timeing our _before_ the IMPORT has completed. |
25 | | -3. create and start the nuodb database with `docker-compose up -d`; |
26 | | -4. stop and delete everything with `docker-compose down`; |
27 | | - |
28 | | -To specify env vars on the command-line, specify them _before_ the `docker-compose` command. |
29 | | -Ex: `IMPORT_SOURCE=./mydb.bak.tgz STARTUP_TIMEOUT=300 docker-compose up -d` |
| 27 | + - this is only done only when the archive dir is _empty_ - so the SM container can be stopped and restarted without being reinitialised. |
| 28 | + - if you have set `IMPORT_SOURCE` _and_ it is a large file that takes multiple minutes to extract, you _will_ need to |
| 29 | + set `STARTUP_TIMEOUT` to a larger value, to stop the startup from timing out before the IMPORT has completed. |
| 30 | + |
| 31 | +4. create and start the nuodb database with `docker-compose up -d`. |
| 32 | + |
| 33 | +## Stopping the database ## |
| 34 | +1. To stop all containers, but retain all stored state including the database contents: |
| 35 | + - cd to the `nuodb` directory; |
| 36 | + - execute `docker-compose down` |
| 37 | + |
| 38 | +2. To restart a stopped database - complete with the database contents: |
| 39 | + - cd to the `nuodb` directory; |
| 40 | + - execute `docker-compose start`. |
| 41 | + |
| 42 | +## Deleting the database and all its storage ## |
| 43 | +1. To stop all containers, and delete all resources - including the stored state and database contents: |
| 44 | + - cd to the `nuodb` directory; |
| 45 | + - execute `docker-compose down`. |
| 46 | + |
| 47 | +## Notes ## |
| 48 | +1. You can specify env vars on the command-line in linux or MacOS, by setting them _before_ the `docker-compose` command. |
| 49 | +- Ex: `$ IMPORT_SOURCE=./mydb.bak.tgz STARTUP_TIMEOUT=300 docker-compose up -d` |
| 50 | + |
| 51 | +## What could possibly go wrong?? ## |
| 52 | + |
| 53 | +1. If you get an error in the form: |
| 54 | +``` |
| 55 | + WARNING: The NUODB_IMAGE variable is not set. Defaulting to a blank string. |
| 56 | + WARNING: The PEER_ADDRESS variable is not set. Defaulting to a blank string. |
| 57 | + WARNING: The IMPORT_SOURCE variable is not set. Defaulting to a blank string. |
| 58 | + ... |
| 59 | + ERROR: Couldn't find env file: /a/b/c/nuodb/.env |
| 60 | + ``` |
| 61 | +- then you have most likely forgotten to copy the `env-default` file to `.env`; |
| 62 | +- or (less popular) create your own `.env` file from scratch. |
| 63 | + |
| 64 | +2. If an error causes only part of the database to be deployed, you can start the remaining containers - after fixing the error - by simply running `docker-compose up -d` again. The `up` command only starts those containers that are missing. |
0 commit comments