Skip to content

Commit d7ed7f3

Browse files
committed
Install: Implement suggestions by CodeRabbit
1 parent b7ef9cf commit d7ed7f3

File tree

10 files changed

+109
-70
lines changed

10 files changed

+109
-70
lines changed

docs/feature/cloud/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ needs.
6565

6666
:::{rubric} CrateDB Cloud
6767
:::
68-
- {ref}`cloud:index`
6968
- {ref}`Documentation <cloud:index>`
7069
- [Web Console]
7170

docs/install/cloud/aws/aws-terraform-setup.md

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

33
# Deploy using Terraform
44

5-
In {ref}`ec2_setup`, we elaborated on how to leverage EC2's functionality to set
5+
In {ref}`ec2-setup`, we elaborated on how to leverage EC2's functionality to set
66
up a CrateDB cluster. Here, we will explore how to automate this kind of setup.
77

88
[Terraform] is an infrastructure as code tool, often used as an abstraction

docs/install/cloud/aws/s3-setup.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ instances.
2525
2626
### Authentication
2727
28-
It is recommended to restrict the permissions of CrateDB on the S3 to only the
29-
required extend. First, an IAM role is required. This [AWS guide] gives a
30-
short description of how to create a policy offer using the CLI or the AWS
31-
management console. Further, access of the snapshot to the S3 bucket needs to
28+
It is recommended to restrict the permissions of CrateDB on S3 to only the
29+
required extent. First, an IAM role is required. This [AWS IAM policy guide]
30+
explains how to create a policy by using the CLI or the AWS Management Console.
31+
Further, access of the snapshot to the S3 bucket needs to
3232
be restricted. An example policy file granting anybody access to a bucket
3333
called `snaps.example.com` is attached below:
3434

@@ -92,7 +92,7 @@ within the policy:
9292
```
9393

9494
[amazon s3]: https://aws.amazon.com/s3/
95-
[aws guide]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
95+
[AWS IAM policy guide]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
9696
[aws policy examples]: https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html
9797
[aws principals]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html
9898
[iam roles]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html

docs/install/cloud/azure/terraform.md

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

33
# Deploy using Terraform
44

5-
In {ref}`azure_vm_setup`, we elaborated on how to leverage Azure's functionality to
5+
In {ref}`azure-vm-setup`, we elaborated on how to leverage Azure's functionality to
66
set up a CrateDB cluster. Here, we will explore how to automate this kind of
77
setup.
88

docs/install/cloud/azure/vm.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ under the *new* left hand panel of the Azure portal.
2323
### Create a network security group
2424

2525
CrateDB uses two ports, one for inter-node communication (`4300`) and one for
26-
it's http endpoint (`4200`), so access to these needs to be opened.
26+
its HTTP endpoint (`4200`), so access to these needs to be opened.
2727

2828
Create a *New Security Group*, giving it a name and assigning it to the
2929
'Resource Group' just created.
@@ -32,7 +32,7 @@ Create a *New Security Group*, giving it a name and assigning it to the
3232
:alt: Create New Security Group
3333
```
3434

35-
Find that security group in your resources list and open it's settings,
35+
Find that security group in your resources list and open its settings,
3636
navigating to the *Inbound security rules* section.
3737

3838
```{image} /_assets/img/install/cloud/azure-nsg-inbound.png
@@ -71,7 +71,7 @@ earlier to the subnet.
7171
### Create virtual machines
7272

7373
Next create virtual machines to act as your CrateDB nodes. In this tutorial, I
74-
chose two low-specification Ubuntu 14.04 servers, but you likely have your own
74+
chose two low-specification Ubuntu servers, but you likely have your own
7575
preferred configurations.
7676

7777
Most importantly, make sure you select the Virtual Network created earlier.
@@ -142,14 +142,14 @@ the same steps as for Azure and Linux.
142142
### Create virtual machines
143143

144144
Similar steps to creating Virtual Machines for Azure and Linux, but create the
145-
VM based on the 'Windows Server 2012 R2 Datacenter' image.
145+
VM based on a recent "Windows Server LTS" image.
146146

147147
### Install CrateDB
148148

149149
*Note that these instructions should be followed on each VM in your cluster.*
150150

151151
To install CrateDB on Windows Server, you will need a [Java JDK installed].
152-
Ensure that the `JAVA*HOME` environment variable is set.
152+
Ensure that the `JAVA_HOME` environment variable is set.
153153

154154
```{image} /_assets/img/install/cloud/azure-envvar.png
155155
:alt: Environment Variables
@@ -171,7 +171,7 @@ We need to allow the ports CrateDB uses through the Windows Firewall
171171
:alt: Firewall configuration
172172
```
173173

174-
Start crate by running `bin/crate`.
174+
Start CrateDB by running `.\bin\crate.bat` (PowerShell) or `bin\crate.bat` (CMD).
175175

176176
[3.3]: https://github.com/crate/crate/blob/3.3/blackbox/docs/config/cluster.rst#discovery
177177
[java jdk installed]: https://www.oracle.com/java/technologies/downloads/#java8

docs/install/container/docker.md

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ The official [CrateDB Docker image].
2222

2323
## Quick start
2424

25+
(container-create-cluster)=
26+
2527
### Creating a cluster
2628

2729
To get started with CrateDB and Docker, you will create a three-node cluster
@@ -38,8 +40,10 @@ sh$ docker network create crate
3840

3941
You should then be able to see something like this:
4042

41-
```text
43+
```shell
4244
sh$ docker network ls
45+
```
46+
```text
4347
NETWORK ID NAME DRIVER SCOPE
4448
1bf1b7acd66f bridge bridge local
4549
51cebbdf7d2b crate bridge local
@@ -55,7 +59,7 @@ container `crate03` will run cluster node `crate03`.
5559

5660
You can then create your first CrateDB container and node, like this:
5761

58-
```
62+
```shell
5963
sh$ docker run --rm -d \
6064
--name=crate01 \
6165
--net=crate \
@@ -82,25 +86,26 @@ Breaking the command down:
8286
- Defines the environment variable {ref}`CRATE_HEAP_SIZE <crate-reference:conf-env-heap-size>`,
8387
which is used by CrateDB to allocate 1 GB for its heap memory.
8488
- Runs the command `crate` inside the container with parameters:
85-
: - `network.host`: The `_site_` value results in the binding of the
86-
CrateDB process to a site-local IP address.
87-
- `node.name`: Defines the node's name as `crate01` (used by
88-
master election).
89-
- `discovery.seed_hosts`: This parameter lists the other hosts in the
90-
cluster. The format is a comma-separated list of `host:port` entries,
91-
where port defaults to setting `transport.tcp.port`. Each node must
92-
contain the name of all the other hosts in this list. Notice also that
93-
any node in the cluster might be started at any time, and this will
94-
create connection exceptions in the log files, however all nodes will
95-
eventually be running and interconnected.
96-
- `cluster.initial_master_nodes`: Defines the list of master-eligible
97-
node names which will participate in the vote of the first master
98-
(first bootstrap). If this parameter is not defined, then it is expected
99-
that the node will join an already formed cluster. This parameter is only
100-
relevant for the first election.
101-
- `gateway.expected_data_nodes` and `gateway.recover_after_data_nodes`:
102-
Specifies how many nodes you expect in the cluster and how many nodes must
103-
be discovered before the cluster state is recovered.
89+
90+
- `network.host`: The `_site_` value results in the binding of the
91+
CrateDB process to a site-local IP address.
92+
- `node.name`: Defines the node's name as `crate01` (used by
93+
master election).
94+
- `discovery.seed_hosts`: This parameter lists the other hosts in the
95+
cluster. The format is a comma-separated list of `host:port` entries,
96+
where port defaults to setting `transport.tcp.port`. Each node must
97+
contain the name of all the other hosts in this list. Notice also that
98+
any node in the cluster might be started at any time, and this will
99+
create connection exceptions in the log files, however all nodes will
100+
eventually be running and interconnected.
101+
- `cluster.initial_master_nodes`: Defines the list of master-eligible
102+
node names which will participate in the vote of the first master
103+
(first bootstrap). If this parameter is not defined, then it is expected
104+
that the node will join an already formed cluster. This parameter is only
105+
relevant for the first election.
106+
- `gateway.expected_data_nodes` and `gateway.recover_after_data_nodes`:
107+
Specifies how many nodes you expect in the cluster and how many nodes must
108+
be discovered before the cluster state is recovered.
104109

105110
:::{NOTE}
106111
If this command aborts with an error, consult the
@@ -250,10 +255,11 @@ The CrateDB Shell, `crash`, is bundled with the Docker image.
250255

251256
If you wanted to run `crash` inside a user-defined network called `crate`
252257
and connect to three hosts named `crate01`, `crate02`, and `crate03`
253-
(i.e. the example covered in the [Creating a Cluster] section) you could run:
258+
(i.e. the example covered in the {ref}`container-create-cluster` section)
259+
you could run:
254260

255261
```shell
256-
$ docker run --rm -ti \
262+
sh$ docker run --rm -ti \
257263
--net=crate crate \
258264
crash --hosts crate01 crate02 crate03
259265
```
@@ -266,7 +272,7 @@ Docker's Compose tool allows developers to define and run multi-container
266272
Docker applications that can be started with a single `docker-compose up`
267273
command.
268274

269-
Read about Docker Compose specifics [here](https://docs.docker.com/compose/).
275+
Read about Docker Compose specifics in the [Docker Compose documentation](https://docs.docker.com/compose/).
270276

271277
You can define the services that make up your app in a `docker-compose.yml`
272278
file. To recreate the three-node cluster in the previous example, you can
@@ -357,6 +363,11 @@ In the file above:
357363
- The start order of the containers is not deterministic and you want all
358364
three containers to be up and running before the election of the master node.
359365

366+
:::{NOTE}
367+
The `deploy` section is used by Docker Swarm (`docker stack deploy`) and is
368+
ignored by `docker compose up`.
369+
:::
370+
360371
## Best Practices
361372

362373
### One container per host
@@ -368,7 +379,7 @@ If you are running one container per machine, you can map the container ports
368379
to the host ports so that the host acts like a native installation. For example:
369380

370381
```shell
371-
$ docker run -d -p 4200:4200 -p 4300:4300 -p 5432:5432 --env CRATE_HEAP_SIZE=1g crate \
382+
sh$ docker run -d -p 4200:4200 -p 4300:4300 -p 5432:5432 --env CRATE_HEAP_SIZE=1g crate \
372383
crate -Cnetwork.host=_site_
373384
```
374385

@@ -380,7 +391,7 @@ this reason, you should mount a persistent `data` directory on your host
380391
machine to the `/data` directory inside the container:
381392

382393
```shell
383-
$ docker run -d -v /srv/crate/data:/data --env CRATE_HEAP_SIZE=1g crate \
394+
sh$ docker run -d -v /srv/crate/data:/data --env CRATE_HEAP_SIZE=1g crate \
384395
crate -Cnetwork.host=_site_
385396
```
386397

@@ -399,7 +410,7 @@ removed.
399410
Here is an example of how you could mount the `crate.yml` config file:
400411

401412
```shell
402-
$ docker run -d \
413+
sh$ docker run -d \
403414
-v /srv/crate/config/crate.yml:/crate/config/crate.yml \
404415
--env CRATE_HEAP_SIZE=1g crate \
405416
crate -Cnetwork.host=_site_
@@ -408,7 +419,7 @@ $ docker run -d \
408419
Here, `/srv/crate/config/crate.yml` is an example path, and should be
409420
replaced with the path to your host machine's `crate.yml` file.
410421

411-
## Troubleshooting
422+
## Healthcheck troubleshooting
412423

413424
The official [CrateDB Docker image] ships with a liveness [healthcheck]
414425
configured.
@@ -468,9 +479,9 @@ memory, with a heap size of 1 GB, you could configure everything at once. For
468479
example:
469480

470481
```shell
471-
$ docker run -d \
482+
sh$ docker run -d \
472483
--cpus 1.5 \
473-
--memory 1g \
484+
--memory 2g \
474485
--env CRATE_HEAP_SIZE=1g \
475486
crate \
476487
crate -Cnetwork.host=_site_

docs/install/container/kubernetes/kubernetes.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
CrateDB and Kubernetes are a great match.
77
:::
88

9-
CrateDB’s [horizontally scalable] `shared-nothing architecture` lends itself
9+
CrateDB’s [horizontally scalable] [shared-nothing architecture] lends itself
1010
well to [containerization].
1111

1212
[Kubernetes] is an open-source container orchestration system for the
@@ -15,8 +15,8 @@ management, deployment, and scaling of containerized systems.
1515
Together, Docker and Kubernetes are a fantastic way to deploy and scale CrateDB.
1616

1717
:::{NOTE}
18-
While Kubernetes works with a variety of container technologies, this
19-
document only covers its use with Docker.
18+
While Kubernetes supports multiple container runtimes, this document
19+
uses Docker-compatible container images.
2020
:::
2121

2222
:::{SEEALSO}
@@ -41,7 +41,7 @@ You can create a resource like so:
4141

4242
```console
4343
sh$ kubectl create -f crate-controller.yaml --namespace crate
44-
statefulset.apps/crate-controller created
44+
statefulset.apps/crate created
4545
```
4646

4747
Here, we are creating a [StatefulSet] controller in the `crate` namespace
@@ -149,6 +149,12 @@ load balancers.
149149
For local development, [Minikube] provides a LoadBalancer service.
150150
:::
151151
152+
:::{WARNING}
153+
Ensure proper network controls and authentication are in place before
154+
exposing ports 4200 (HTTP) and 5432 (PostgreSQL) via a LoadBalancer.
155+
Restrict source IPs and configure users/roles to avoid unauthorized access.
156+
:::
157+
152158
### Controller
153159
154160
A Kubernetes [pod] is a group of one or more containers. Pods are designed to
@@ -213,7 +219,7 @@ spec:
213219
# Use the CrateDB 5.1.1 Docker image.
214220
image: crate:5.1.1
215221
# Pass in configuration to CrateDB via command-line options.
216-
# We are setting the name of the node's explicitly, which is
222+
# We are setting the node name explicitly, which is
217223
# needed to determine the initial master nodes. These are set to
218224
# the name of the pod.
219225
# We are using the SRV records provided by Kubernetes to discover
@@ -228,9 +234,9 @@ spec:
228234
- -Cgateway.expected_data_nodes=${EXPECTED_NODES}
229235
- -Cpath.data=/data
230236
volumeMounts:
231-
# Mount the `/data` directory as a volume named `data`.
237+
# Mount the volume named `cratedb-data` to the `/data` directory.
232238
- mountPath: /data
233-
name: data
239+
name: cratedb-data
234240
resources:
235241
limits:
236242
# How much memory each pod gets.
@@ -247,7 +253,7 @@ spec:
247253
name: postgres
248254
# Environment variables passed through to the container.
249255
env:
250-
# This is variable is detected by CrateDB.
256+
# This variable is detected by CrateDB.
251257
- name: CRATE_HEAP_SIZE
252258
value: "256m"
253259
# The rest of these variables are used in the command-line
@@ -267,7 +273,7 @@ spec:
267273
volumeClaimTemplates:
268274
# Use persistent storage.
269275
- metadata:
270-
name: data
276+
name: cratedb-data
271277
spec:
272278
accessModes:
273279
- ReadWriteOnce
@@ -333,34 +339,31 @@ You can then use this in your controller configuration with something like this:
333339
[...]
334340
volumeClaimTemplates:
335341
- metadata:
336-
name: persistant-data
342+
name: cratedb-data
337343
spec:
338344
# This will create one 100GB read-write Azure Managed Disks volume
339345
# for every CrateDB pod.
340346
accessModes: [ "ReadWriteOnce" ]
341347
storageClassName: crate-premium
342348
resources:
343349
requests:
344-
storage: 100g
350+
storage: 100Gi
345351
```
346352

347353
[azure managed disks]: https://azure.microsoft.com/en-us/pricing/details/managed-disks/
348354
[configuration]: https://kubernetes.io/docs/concepts/configuration/overview/
349355
[containerization]: https://www.docker.com/resources/what-container
350356
[cratedb docker image]: https://hub.docker.com/_/crate/
351-
[docker]: https://www.docker.com/
352357
[horizontally scalable]: https://en.wikipedia.org/wiki/Scalability#Horizontal_(scale_out)_and_vertical_scaling_(scale_up)
353358
[ingress]: https://kubernetes.io/docs/concepts/services-networking/ingress/
354359
[kubernetes]: https://kubernetes.io/
355360
[loadbalancer]: https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer
356361
[managed]: https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/
357362
[minikube]: https://kubernetes.io/docs/setup/minikube/
358-
[persistent volume]: https://kubernetes.io/docs/concepts/storage/persistent-volumes/
359363
[persistent volumes]: https://kubernetes.io/docs/concepts/storage/persistent-volumes/
360364
[pod]: https://kubernetes.io/docs/concepts/workloads/pods/
361365
[rolling update strategy]: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#rolling-updates
362366
[service]: https://kubernetes.io/docs/concepts/services-networking/service/
363-
[services]: https://kubernetes.io/docs/concepts/services-networking/service/
364367
[setting up your first cratedb cluster on kubernetes]: https://cratedb.com/blog/run-your-first-cratedb-cluster-on-kubernetes-part-one
365368
[shared-nothing architecture]: https://en.wikipedia.org/wiki/Shared-nothing_architecture
366369
[statefulset]: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/

0 commit comments

Comments
 (0)