Skip to content

Commit

Permalink
elastic-search
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed Feb 5, 2025
1 parent bd2cae4 commit 5f4e9d8
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 13 deletions.
4 changes: 3 additions & 1 deletion ix-dev/stable/elastic-search/app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
annotations:
min_scale_version: '25.04'
app_version: 8.17.1
capabilities: []
categories:
Expand Down Expand Up @@ -29,4 +31,4 @@ sources:
- https://www.elastic.co/guide/en/elasticsearch/reference/master/docker.html#docker-configuration-methods
title: Elastic Search
train: stable
version: 1.2.9
version: 1.3.0
4 changes: 4 additions & 0 deletions ix-dev/stable/elastic-search/migrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
migrations:
- file: ip_port_migration
target:
min_version: 1.3.0
23 changes: 23 additions & 0 deletions ix-dev/stable/elastic-search/migrations/ip_port_migration
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/python3

import os
import sys
import yaml


def migrate(values):
values["network"]["web_port"] = {
"port_number": values["network"]["web_port"],
"bind_mode": "published",
"host_ips": [],
}
return values


if __name__ == "__main__":
if len(sys.argv) != 2:
exit(1)

if os.path.exists(sys.argv[1]):
with open(sys.argv[1], "r") as f:
print(yaml.dump(migrate(yaml.safe_load(f.read()))))
50 changes: 44 additions & 6 deletions ix-dev/stable/elastic-search/questions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,51 @@ questions:
attrs:
- variable: web_port
label: WebUI Port
description: The port for Elastic Search WebUI
schema:
type: int
default: 30003
required: true
$ref:
- definitions/port
type: dict
attrs:
- variable: bind_mode
label: Port Bind Mode
description: |
The port bind mode.</br>
- Publish: The port will be published on the host for external access.</br>
- Expose: The port will be exposed for inter-container communication.</br>
- None: The port will not be exposed or published.</br>
Note: If the Dockerfile defines an EXPOSE directive,
the port will still be exposed for inter-container communication regardless of this setting.
schema:
type: string
default: "published"
enum:
- value: "published"
description: Publish port on the host for external access
- value: "exposed"
description: Expose port for inter-container communication
- value: ""
description: None
- variable: port_number
label: Port Number
schema:
type: int
show_if: [["bind_mode", "!=", ""]]
default: 30003
required: true
$ref:
- definitions/port
- variable: host_ips
label: Host IPs
description: IPs on the host to bind this port
schema:
type: list
default: []
items:
- variable: host_ip
label: Host IP
schema:
type: string
required: true
$ref:
- definitions/node_bind_ip
- variable: host_network
label: Host Network
description: |
Expand Down
8 changes: 4 additions & 4 deletions ix-dev/stable/elastic-search/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
{% do c1.set_user(values.consts.user_id, values.consts.group_id) %}

{% do c1.healthcheck.set_test("curl", {
"port": values.network.web_port, "path": "/_cluster/health?local=true",
"port": values.network.web_port.port_number, "path": "/_cluster/health?local=true",
"scheme": proto, "headers": [("Authorization", tpl.funcs.basic_auth_header("elastic", values.elastic.password))]
}) %}

{% do c1.environment.add_env("ES_HEAP_SIZE", values.elastic.heap_size) %}
{% do c1.environment.add_env("ELASTIC_PASSWORD", values.elastic.password) %}
{% do c1.environment.add_env("ES_SETTING_HTTP_PORT", values.network.web_port) %}
{% do c1.environment.add_env("ES_SETTING_HTTP_PORT", values.network.web_port.port_number) %}
{% do c1.environment.add_env("ES_SETTING_NODE_NAME", values.elastic.node_name) %}
{% do c1.environment.add_env("ES_SETTING_DISCOVERY_TYPE", "single-node") %}
{% do c1.environment.add_env("ES_SETTING_XPACK_SECURITY_ENABLED", true) %}
Expand All @@ -34,7 +34,7 @@
{% endif %}

{% do c1.environment.add_user_envs(values.elastic.additional_envs) %}
{% do c1.ports.add_port(values.network.web_port, values.network.web_port) %}
{% do c1.add_port(values.network.web_port) %}

{% do c1.add_storage("/usr/share/elasticsearch/config/certs", {"type": "anonymous"}) %}

Expand All @@ -51,7 +51,7 @@
{% do c1.depends.add_dependency(values.consts.perms_container_name, "service_completed_successfully") %}
{% endif %}

{% do tpl.portals.add_portal({"port": values.network.web_port, "schema": proto}) %}
{% do tpl.portals.add_portal({"port": values.network.web_port.port_number, "scheme": proto}) %}
{% do tpl.notes.set_body(values.consts.notes_body) %}

{{ tpl.render() | tojson }}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ elastic:
additional_envs: []
network:
host_network: false
web_port: 8080
web_port:
bind_mode: published
port_number: 8080
certificate_id:

ix_volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ elastic:
additional_envs: []
network:
host_network: false
web_port: 8080
web_port:
bind_mode: published
port_number: 8080
certificate_id: "2"

ix_volumes:
Expand Down

0 comments on commit 5f4e9d8

Please sign in to comment.