Skip to content

Commit 74cd371

Browse files
authored
Merge pull request #58 from KnowWhereGraph/deployment-fixes
Deployment fixes
2 parents 1d646ee + dbee2ce commit 74cd371

14 files changed

Lines changed: 209 additions & 121 deletions

File tree

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
nginx/logs/
12
.DS_STORE
2-
nginx/logs
33
graphdb/license/
4-
nginx/local-certs/
4+
nginx/letsencrypt/local-certs/*
55
nginx/sites/faceted-search/
66
nginx/sites/kw-panels/
77
nginx/sites/node-browser/
8+
kwg-api/
89
services/
910
graphdb/nginx/*
1011
grafana/persistent_config
1112
*drawio.bkp
12-
*.png.bkp
13+
*.png.bkp

architecture/architecture.drawio

Lines changed: 148 additions & 45 deletions
Large diffs are not rendered by default.

elasticsearch/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
Text search & ranking for KnowWhereGraph
44

5-
## Deploying
6-
7-
The docker-compose file is used for deploying the service. Before deploying, set the password in the docker-compose file.
8-
95
## Credentials
106

11-
```
7+
Credentials need to be set for Elasticsearch before the stack is deployed. Set this in the docker-compose.yaml file.
8+
9+
```text
1210
user: elastic
1311
pass: <refer to docker-compose.yaml>
1412
```

grafana/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,15 @@ The dashboards are taken from pre-designed packages, which are available on the
3737
- [Node Exporter](https://grafana.com/grafana/dashboards/1860-node-exporter-full/)
3838
- [NGINX](https://grafana.com/grafana/dashboards/14900-nginx/)
3939
- KWG-API: Custom
40+
41+
## Data Sources
42+
43+
Grafana makes use of two data sources
44+
45+
### Prometheus
46+
47+
Prometheus stores the metrics data and requires the prometheus user/pass to connect. This is set in the datasource yaml file, and the credentials should match the prometheus docker-compose credentials.
48+
49+
### Loki
50+
51+
Loki is the log data source. The communication with this service is unauthenticated.

graphdb/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,10 @@ There are *six* docker-compose files here. The two main flavors are
1111
1. Preloading: These compose files are used to the first upload of data. There are three (local/stage/prod)
1212
2. Running: These compose files are used when running GraphDB to serve content. There are three (local/stage/prod)
1313

14-
15-
1614
## Data Persistence
1715

1816
Data is persisted on the host machine, _not_ the container. This is achieved by a volume mount between the host and GraphDB's repository data directory which is set in the docker-compose file. Graph DB stores its repository, configuration, and logging data under `/opt/graphdb/home`. This path can be mounted to the local system, persisting the data. When a new container is launched, it will reference the persisted data and load it.
1917

20-
## Deploying
21-
22-
GraphDB deployments should be managed by the repositories root Makefile. Run `make help` for a description of commands and follow the documentation below to learn more about loading data & deploying.
23-
2418
### Initial Data Load
2519

2620
GraphDB's initial database is constructed using the `importrdf` tool from Ontotext. This runs with GraphDB offline and offers much faster data loading than other options. In this process, GraphDB creates a new repository and inserts data into it. To account for this, separate docker-compose files are needed to manage the offline instances.

loki/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3"
22

33
services:
44
loki:
5-
image: grafana/loki:3.2.2
5+
image: grafana/loki:2.9.11
66
container_name: loki
77
ports:
88
- "3100:3100"

makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ repository-setup: # Fetches the GitHub repos needed & configures them
3434
git clone https://github.com/KnowWhereGraph/kwg-faceted-search.git nginx/sites/kwg-faceted-search
3535
git clone https://github.com/KnowWhereGraph/kwg-api.git kwg-api/
3636
git clone https://github.com/KnowWhereGraph/kwg-ontologies.git nginx/sites/onto/
37-
cp nginx/robots.txt nginx/sites/robots.txt
37+
mkdir nginx/sites/robots/
38+
cp nginx/robots.txt nginx/sites/robots/robots.txt
3839
validate-deployment: # Checks the local deployment files
39-
sh validate.sh
40+
sh scripts/validate.sh

nginx/README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ KnowWhereGraph has a handful of services that require networking capabilities. T
88

99
The NGINX configuration files are templated with environment variables, which can be customized in the docker-compose file. For more information on how the configuration files are generated from the templates refer to [this](https://github.com/docker-library/docs/tree/master/nginx#using-environment-variables-in-nginx-configuration-new-in-119) documentation page.
1010

11-
## Deploying
11+
## Certificates
1212

13-
Deploying nginx without using the make command is *not* recommended and most likely not necessary. If you know what you're doing and need to, you can with
13+
Certificates are mounted into the nginx container from the local filesystem. Non-local deployments work the same way: the `/etc/letsencrypt` files are mounted into the container.
1414

15-
`docker-compose up`
15+
### Staging
1616

17-
To bring the service down, run
17+
New certs can be generated with
1818

19-
`docker-compose down`
19+
`sudo certbot certonly --webroot --webroot-path nginx/data/certbot/www/ -d staging.knowwheregraph.org`
2020

21-
## Certificates
21+
A common problem is that the certs may have different permissions for mounting into the nginx container.
22+
23+
### Local
2224

2325
Certificates for local development need to be manually generated and added to the `local-certs` directory.
2426

@@ -39,7 +41,7 @@ https://javorszky.co.uk/2019/11/06/get-firefox-to-trust-your-self-signed-certifi
3941

4042
## Logging
4143

42-
The NGINX logs are found in the container's /var/logs/nginx, which is mounted locally at `./nginx/logs`. For more verbose logging, refer to the NGINX Docker image documentation and modify the deployment script to include any additional flags.
44+
The NGINX logs should be checked through grafana or by inspecting the container's logs.
4345

4446
## Metrics
4547

nginx/data/certbot/www/.gitkeep

Whitespace-only changes.

nginx/docker-compose.local.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ services:
99
- 'variables.env'
1010
volumes:
1111
- ./nginx/templates:/etc/nginx/templates # NGINX config file
12-
- ./nginx/logs:/var/log/nginx # NGINX logs
1312
- ./nginx/sites:/usr/share/nginx/html # Static sites
1413
- ./nginx/local-certs:/etc/letsencrypt/live/localhost # Local certificates
1514
depends_on: # These services need to exist for the nginx config to validate

0 commit comments

Comments
 (0)