Skip to content

Commit 7206b67

Browse files
authored
Merge pull request #69 from dbeaver/devel
Devel
2 parents bbefe93 + 3cbfade commit 7206b67

26 files changed

Lines changed: 458 additions & 20 deletions

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CLOUDBEAVER_VERSION_TAG=25.1.0
1+
CLOUDBEAVER_VERSION_TAG=25.2.0
22
IMAGE_SOURCE=dbeaver
33
PODMAN_IMAGE_SOURCE=docker.io/dbeaver
44
COMPOSE_PROJECT_NAME=dbeaver

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ values.yaml
44
/.idea
55
trusted-cacerts/*
66
.env
7-
variables.tf
7+
variables.tf
8+
k8s/ingressSsl/

AWS/aws-eks/README.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# CloudBeaver Enterprise Edition - AWS EKS Deployment
2+
3+
## Prerequisites
4+
5+
- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html) installed and configured
6+
- [eksctl](https://eksctl.io/installation/) installed
7+
- [Helm](https://helm.sh/docs/intro/install/) installed
8+
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/) installed
9+
- [Terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) installed
10+
- Access to an existing **EKS cluster**
11+
12+
Policy required:
13+
- [AmazonElasticFileSystemFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonElasticFileSystemFullAccess.html)
14+
15+
## AWS volumes configuration for Kubernetes deployment
16+
17+
To store CloudBeaver EE data in the cloud, you need to configure cloud volumes. For example, you can store connection configurations and user information in AWS EFS.
18+
19+
### Step 1: Associate IAM OIDC Provider
20+
21+
Associate the IAM OIDC provider with your EKS cluster to enable IAM roles for service accounts.
22+
23+
```bash
24+
eksctl utils associate-iam-oidc-provider \
25+
--region=<your-region> \
26+
--cluster=<your-cluster-name> \
27+
--approve
28+
```
29+
30+
### Step 2: Install AWS EFS and EBS CSI Drivers
31+
32+
Install the AWS EFS and EBS CSI drivers using Helm.
33+
34+
```bash
35+
helm repo add aws-efs-csi-driver https://kubernetes-sigs.github.io/aws-efs-csi-driver/
36+
helm repo add aws-ebs-csi-driver https://kubernetes-sigs.github.io/aws-ebs-csi-driver/
37+
helm repo update
38+
39+
helm install aws-efs-csi-driver aws-efs-csi-driver/aws-efs-csi-driver --namespace kube-system
40+
helm install aws-ebs-csi-driver aws-ebs-csi-driver/aws-ebs-csi-driver --namespace kube-system
41+
```
42+
43+
### Step 3: Configure EFS via Terraform
44+
45+
1. Navigate to directory `cloudbeaver-deploy/AWS/aws-eks`
46+
2. Open the `main.tf` file in a text editor.
47+
3. Update the following variables with your AWS region and EKS cluster name:
48+
```
49+
variable "region" {
50+
description = "Region for AWS EFS"
51+
default = "<your-region>"
52+
}
53+
variable "cluster_name" {
54+
description = "EKS cluster name"
55+
default = "<your-cluster-name>"
56+
}
57+
```
58+
4. Run `terraform init`.
59+
5. Next, run `terraform apply`, which will output `efs_file_system_id`.
60+
6. Open the file `cloudbeaver-deploy/k8s/values.yaml` and update the `fileSystemId` parameter with the value of `efs_file_system_id` obtained in the previous step.
61+
7. Fill in the other parameters as shown in the example:
62+
63+
```yaml
64+
cloudProvider: aws
65+
storage:
66+
type: efs
67+
storageClassName: "efs-sc"
68+
efs:
69+
fileSystemId: "<your-efs-id>"
70+
```
71+
72+
Once this is set up, you can deploy CloudBeaver EE by following [this guide](../../k8s/README.md).
73+
74+
## AWS ALB configuration for Kubernetes deployment
75+
76+
This deployment option can use Nginx, HAProxy, or AWS ALB as an ingress controller. If you want to use [AWS Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html), follow the steps below.
77+
78+
Install `AWS CLI`: If `AWS CLI` is not installed yet, follow the instructions on the [official AWS CLI website](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html).
79+
80+
Install `eksctl`: `eksctl` is a command-line utility for creating and managing EKS clusters. Install eksctl by following the instructions on the [official eksctl website](https://eksctl.io/installation/).
81+
82+
Policy required for eksctl to work:
83+
84+
- [CloudFormation Full Access](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSCloudFormationFullAccess.html)
85+
- [EKS Full Access](https://docs.aws.amazon.com/eks/latest/userguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-console)
86+
- [EC2 and EC2 Auto Scaling Full Access](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonEC2FullAccess.html)
87+
- [IAM Full Access](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/IAMFullAccess.html)
88+
- [Systems Manager](https://docs.aws.amazon.com/systems-manager/latest/userGuide/security_iam_id-based-policy-examples.html)
89+
90+
1. OIDC Provider Association:
91+
92+
```bash
93+
eksctl utils associate-iam-oidc-provider --region=<your-region> --cluster=<your-cluster-name> --approve
94+
```
95+
96+
2. Create IAM role and link policy:
97+
98+
Create policy IAM:
99+
```bash
100+
curl -o iam_policy.json https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/main/docs/install/iam_policy.json
101+
aws iam create-policy --policy-name AWSLoadBalancerControllerIAMPolicy --policy-document file://iam_policy.json
102+
```
103+
104+
Create IAM role and link policy:
105+
```bash
106+
eksctl create iamserviceaccount \
107+
--cluster <your-cluster-name> \
108+
--region <your-region> \
109+
--namespace kube-system \
110+
--name aws-load-balancer-controller \
111+
--attach-policy-arn arn:aws:iam::<your-account-id>:policy/AWSLoadBalancerControllerIAMPolicy \
112+
--approve
113+
```
114+
115+
3. Install AWS Load Balancer Controller using Helm:
116+
117+
```bash
118+
helm repo add eks https://aws.github.io/eks-charts
119+
helm repo update
120+
121+
helm install aws-load-balancer-controller eks/aws-load-balancer-controller \
122+
-n kube-system \
123+
--set clusterName=<your-cluster-name> \
124+
--set serviceAccount.create=false \
125+
--set region=<your-region> \
126+
--set vpcId=<your-vpc-id> \
127+
--set serviceAccount.name=aws-load-balancer-controller
128+
```
129+
130+
Once this is set up, you can deploy CloudBeaver EE by following [this guide](../../k8s/README.md).

AWS/aws-eks/efs.tf

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
data "aws_vpc" "vpc" {
2+
id = data.aws_eks_cluster.eks_cluster.vpc_config[0].vpc_id
3+
}
4+
5+
data "aws_subnets" "subnets" {
6+
filter {
7+
name = "vpc-id"
8+
values = [data.aws_vpc.vpc.id]
9+
}
10+
}
11+
12+
data "aws_security_group" "eks_security_group" {
13+
id = data.aws_eks_cluster.eks_cluster.vpc_config[0].cluster_security_group_id
14+
}
15+
16+
data "aws_subnet" "subnet_info" {
17+
for_each = toset(data.aws_subnets.subnets.ids)
18+
id = each.value
19+
}
20+
21+
locals {
22+
subnets_by_az = { for subnet in data.aws_subnet.subnet_info : subnet.availability_zone => subnet.id... }
23+
unique_subnet_ids = [for az, subnet_ids in local.subnets_by_az : subnet_ids[0]]
24+
}
25+
26+
resource "aws_efs_file_system" "efs" {
27+
creation_token = var.efs_name
28+
performance_mode = "generalPurpose"
29+
throughput_mode = "bursting"
30+
31+
tags = {
32+
Name = var.efs_name
33+
CloudBeaver-EE = "true"
34+
}
35+
}
36+
37+
resource "aws_efs_mount_target" "efs_mount_target" {
38+
for_each = toset(local.unique_subnet_ids)
39+
file_system_id = aws_efs_file_system.efs.id
40+
subnet_id = each.key
41+
security_groups = [data.aws_security_group.eks_security_group.id]
42+
}
43+
44+
resource "aws_efs_access_point" "efs_access_point" {
45+
file_system_id = aws_efs_file_system.efs.id
46+
47+
posix_user {
48+
gid = 8978
49+
uid = 8978
50+
}
51+
52+
root_directory {
53+
path = "/"
54+
creation_info {
55+
owner_gid = 8978
56+
owner_uid = 8978
57+
permissions = "775"
58+
}
59+
}
60+
}
61+
62+
output "efs_file_system_id" {
63+
value = aws_efs_file_system.efs.id
64+
description = "EFS file system ID for CloudBeaver EE"
65+
}

AWS/aws-eks/iam.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
data "aws_eks_node_groups" "nodegroups" {
2+
cluster_name = var.cluster_name
3+
}
4+
5+
data "aws_eks_node_group" "nodegroup" {
6+
for_each = toset(data.aws_eks_node_groups.nodegroups.names)
7+
8+
cluster_name = var.cluster_name
9+
node_group_name = each.value
10+
}
11+
12+
resource "aws_iam_role_policy_attachment" "ebs_csi_policy_attachment" {
13+
for_each = data.aws_eks_node_group.nodegroup
14+
15+
role = basename(each.value.node_role_arn)
16+
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEBSCSIDriverPolicy"
17+
}
18+
19+
resource "aws_iam_role_policy_attachment" "efs_csi_policy_attachment" {
20+
for_each = data.aws_eks_node_group.nodegroup
21+
22+
role = basename(each.value.node_role_arn)
23+
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEFSCSIDriverPolicy"
24+
}
25+

AWS/aws-eks/main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
provider "aws" {
2+
region = var.region
3+
}
4+
5+
variable "region" {
6+
description = "Region for AWS EFS"
7+
default = ""
8+
}
9+
10+
variable "cluster_name" {
11+
description = "EKS cluster name"
12+
default = ""
13+
}
14+
15+
variable "efs_name" {
16+
description = "Name for EFS"
17+
default = "CloudBeaver-EKS-EFS"
18+
}
19+
20+
data "aws_eks_cluster" "eks_cluster" {
21+
name = var.cluster_name
22+
}

AWS/aws-eks/versions.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 1.0"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 5.0"
8+
}
9+
}
10+
}

AWS/ecs-fargate/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
![alt text](images/image-1.png)
3535

3636
- Ensure that the `alb_certificate_Identifier` variable contains the ID from [AWS Certificate Manager](#importing-an-ssl-certificate-in-aws) corresponding to the domain name specified in the `CLOUDBEAVER_PUBLIC_URL` variable within variables.tf. The domain name in `CLOUDBEAVER_PUBLIC_URL` must match the domain for which the certificates have been issued.
37-
- You can customize the deployment version by updating the `cloudbeaver_version` environment variable. The default version is `25.0.0`.
37+
- You can customize the deployment version by updating the `cloudbeaver_version` environment variable. The default version is `25.2.0`.
3838

3939
6. Run `terraform init` and then `terraform apply` in `ecs-fargate` directory to create the ECS cluster and complete the deployment.
4040

AWS/ecs-fargate/efs.tf

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,20 @@ resource "aws_efs_mount_target" "cloudbeaver_data_mt" {
1616
file_system_id = aws_efs_file_system.cloudbeaver_data.id
1717
subnet_id = aws_subnet.private_subnets[count.index].id
1818
security_groups = [aws_security_group.cloudbeaver_efs.id]
19-
}
19+
}
20+
21+
resource "aws_efs_file_system" "api_tokens" {
22+
creation_token = "api_tokens"
23+
performance_mode = "generalPurpose"
24+
throughput_mode = "bursting"
25+
encrypted = "false"
26+
27+
tags = merge(var.common_tags, { Name = "Cloudbeaver API token EFS" })
28+
}
29+
30+
resource "aws_efs_mount_target" "api_tokens_mt" {
31+
count = length(aws_subnet.private_subnets)
32+
file_system_id = aws_efs_file_system.api_tokens.id
33+
subnet_id = aws_subnet.private_subnets[count.index].id
34+
security_groups = [aws_security_group.cloudbeaver_efs.id]
35+
}

AWS/ecs-fargate/main.tf

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ resource "aws_ecs_task_definition" "cloudbeaver-task" {
4848
root_directory = "/"
4949
}
5050
}
51+
volume {
52+
name = "api_tokens"
53+
efs_volume_configuration {
54+
file_system_id = aws_efs_file_system.api_tokens.id
55+
root_directory = "/"
56+
}
57+
}
5158

5259
container_definitions = jsonencode([{
5360
name = "${var.task_name}"
@@ -63,10 +70,16 @@ resource "aws_ecs_task_definition" "cloudbeaver-task" {
6370
"awslogs-stream-prefix": "cb"
6471
}
6572
}
66-
mountPoints = [{
67-
"containerPath": "/opt/cloudbeaver/workspace",
68-
"sourceVolume": "cloudbeaver_data"
69-
}]
73+
mountPoints = [
74+
{
75+
containerPath = "/opt/cloudbeaver/workspace",
76+
sourceVolume = "cloudbeaver_data"
77+
},
78+
{
79+
containerPath = "/opt/cloudbeaver/conf/keys/"
80+
sourceVolume = "api_tokens"
81+
}
82+
]
7083
portMappings = [{
7184
name = "${var.task_name}"
7285
protocol = "tcp"

0 commit comments

Comments
 (0)