Skip to content

Commit

Permalink
ix-app
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed Feb 5, 2025
1 parent ddc843b commit 7110e2a
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 13 deletions.
4 changes: 3 additions & 1 deletion ix-dev/stable/ix-app/app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
annotations:
min_scale_version: '25.04'
app_version: 1.0.0
capabilities: []
categories:
Expand All @@ -19,4 +21,4 @@ screenshots: []
sources: []
title: iX App
train: stable
version: 1.1.9
version: 1.2.0
4 changes: 4 additions & 0 deletions ix-dev/stable/ix-app/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.2.0
32 changes: 32 additions & 0 deletions ix-dev/stable/ix-app/migrations/ip_port_migration
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/python3

import os
import sys
import yaml


def migrate(values):
new_ports = []
for port in values.get("ports", []):
new_ports.append(
{
"bind_mode": "published",
"port_number": port["published"],
"container_port": port["target"],
"protocol": port["protocol"],
"host_ips": [],
}
)

values["ports"] = new_ports

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()))))
51 changes: 40 additions & 11 deletions ix-dev/stable/ix-app/questions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,32 +262,61 @@ questions:
schema:
type: dict
attrs:
- variable: target
label: Container Port
- 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>
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
- variable: port_number
label: Host Port
schema:
type: int
required: true
min: 1
max: 65535
- variable: published
label: Host Port
$ref:
- definitions/port
- variable: container_port
label: Container Port
schema:
type: int
default: 15000
min: 1
max: 65535
required: true
$ref:
- "definitions/port"
- definitions/port
- variable: protocol
label: Protocol
schema:
type: string
default: tcp
required: true
default: "tcp"
enum:
- value: tcp
- value: "tcp"
description: TCP
- value: udp
- value: "udp"
description: UDP
- 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: dns_config
label: Custom DNS Setup
Expand Down
2 changes: 1 addition & 1 deletion ix-dev/stable/ix-app/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
{% do c1.set_network_mode("host") %}
{% else %}
{% for port in values.ports %}
{% do c1.ports.add_port(port.published, port.target, {"protocol": port.protocol}) %}
{% do c1.add_port(port) %}
{% endfor %}
{% endif %}

Expand Down

0 comments on commit 7110e2a

Please sign in to comment.