Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate apps to support host-ip per port #1550

Draft
wants to merge 36 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion ix-dev/community/actual-budget/app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
annotations:
min_scale_version: '25.04'
app_version: 25.2.1
capabilities: []
categories:
Expand Down Expand Up @@ -32,4 +34,4 @@ sources:
- https://hub.docker.com/r/actualbudget/actual-server
title: Actual Budget
train: community
version: 1.2.13
version: 1.3.0
6 changes: 6 additions & 0 deletions ix-dev/community/actual-budget/migrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
migrations:
- file: ip_port_migration
# from:
# max_version: "FIXME:"
target:
min_version: 1.3.0
23 changes: 23 additions & 0 deletions ix-dev/community/actual-budget/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/community/actual-budget/questions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,51 @@ questions:
attrs:
- variable: web_port
label: WebUI Port
description: The port for Actual Budget WebUI
schema:
type: int
default: 31012
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: 31012
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
6 changes: 3 additions & 3 deletions ix-dev/community/actual-budget/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% do c1.set_user(values.run_as.user, values.run_as.group) %}
{% do c1.healthcheck.set_custom_test("NPM_CONFIG_UPDATE_NOTIFIER=false NODE_TLS_REJECT_UNAUTHORIZED=0 npm run health-check") %}

{% do c1.environment.add_env("ACTUAL_PORT", values.network.web_port) %}
{% do c1.environment.add_env("ACTUAL_PORT", values.network.web_port.port_number) %}
{% do c1.environment.add_env("ACTUAL_HOSTNAME", "0.0.0.0") %}
{% do c1.environment.add_env("ACTUAL_SERVER_FILES", "%s/server-files" | format(values.consts.base_data_path)) %}
{% do c1.environment.add_env("ACTUAL_USER_FILES", "%s/user-files" | format(values.consts.base_data_path)) %}
Expand All @@ -22,7 +22,7 @@
{% endif %}

{% do c1.environment.add_user_envs(values.actual_budget.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("/data", values.storage.data) %}
{% do perm_container.add_or_skip_action("data", values.storage.data, perms_config) %}
Expand All @@ -37,6 +37,6 @@
{% do c1.depends.add_dependency(values.consts.perms_container_name, "service_completed_successfully") %}
{% endif %}

{% do tpl.portals.add_portal({"port": values.network.web_port, "scheme": "https" if values.network.certificate_id else "http"}) %}
{% do tpl.portals.add_portal({"port": values.network.web_port.port_number, "scheme": "https" if values.network.certificate_id else "http"}) %}

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

run_as:
user: 568
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ actual_budget:
additional_envs: []
network:
host_network: true
web_port: 8080
web_port:
bind_mode: published
port_number: 8080

run_as:
user: 568
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ actual_budget:
network:
host_network: false
certificate_id: "1"
web_port: 8080
web_port:
bind_mode: published
port_number: 8080

run_as:
user: 568
Expand Down
4 changes: 3 additions & 1 deletion ix-dev/community/adguard-home/app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
annotations:
min_scale_version: '25.04'
app_version: v0.107.56
capabilities:
- description: AdGuard Home is able to bind to a privileged port.
Expand Down Expand Up @@ -42,4 +44,4 @@ sources:
- https://hub.docker.com/r/adguard/adguardhome
title: AdGuard Home
train: community
version: 1.1.15
version: 1.2.0
6 changes: 6 additions & 0 deletions ix-dev/community/adguard-home/migrations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
migrations:
- file: ip_port_migration
# from:
# max_version: "FIXME:"
target:
min_version: 1.2.0
28 changes: 28 additions & 0 deletions ix-dev/community/adguard-home/migrations/ip_port_migration
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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": [],
}
values["network"]["dns_port"] = {
"port_number": values["network"].get("dns_port", 1053),
"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()))))
100 changes: 88 additions & 12 deletions ix-dev/community/adguard-home/questions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,98 @@ questions:
attrs:
- variable: web_port
label: WebUI Port
description: The port for AdGuard Home WebUI
schema:
type: int
default: 30004
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: 30004
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: dns_port
label: DNS Port
description: The port for AdGuard Home DNS
schema:
type: int
default: 53
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", "=", "published"]]
default: 53
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
12 changes: 6 additions & 6 deletions ix-dev/community/adguard-home/templates/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% set c1 = tpl.add_container(values.consts.adguard_container_name, "image") %}
{% do c1.healthcheck.set_test("wget", {
"port": values.adguard.https_port_to_probe if values.adguard.use_https_probe else values.network.web_port,
"port": values.adguard.https_port_to_probe if values.adguard.use_https_probe else values.network.web_port.port_number,
"scheme": "https" if values.adguard.use_https_probe else "http",
"path": "/",
}) %}
Expand All @@ -17,16 +17,16 @@
{% do c1.set_command([
"--no-check-update",
"--web-addr",
"0.0.0.0:%d"|format(values.network.web_port),
"0.0.0.0:%d"|format(values.network.web_port.port_number),
"--config",
"%s/AdGuardHome.yaml"|format(values.consts.config_path),
"--work-dir",
values.consts.work_path,
]) %}

{% do c1.ports.add_port(values.network.web_port, values.network.web_port) %}
{% do c1.ports.add_port(values.network.dns_port, 53) %}
{% do c1.ports.add_port(values.network.dns_port, 53, {"protocol": "udp"}) %}
{% do c1.add_port(values.network.web_port) %}
{% do c1.add_port(values.network.dns_port, {"container_port": 53}) %}
{% do c1.add_port(values.network.dns_port, {"container_port": 53, "protocol": "udp"}) %}

{% for port in values.network.additional_ports %}
{% do c1.add_port(port) %}
Expand All @@ -39,6 +39,6 @@
{% endfor %}

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

{{ tpl.render() | tojson }}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ resources:
adguard:
additional_envs: []
network:
web_port: 8080
dns_port: 1053
web_port:
bind_mode: published
port_number: 8080
dns_port:
bind_mode: published
port_number: 1053
host_network: false
dhcp_enabled: false
additional_ports: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ resources:
adguard:
additional_envs: []
network:
web_port: 8080
dns_port: 1053
web_port:
bind_mode: published
port_number: 8080
dns_port:
bind_mode: published
port_number: 1053
host_network: false
dhcp_enabled: true
additional_ports: []
Expand Down
4 changes: 3 additions & 1 deletion ix-dev/community/audiobookshelf/app.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
annotations:
min_scale_version: '25.04'
app_version: 2.19.0
capabilities: []
categories:
Expand Down Expand Up @@ -33,4 +35,4 @@ sources:
- https://github.com/advplyr/audiobookshelf
title: Audiobookshelf
train: community
version: 1.3.14
version: 1.4.0
Loading
Loading