|
1 | 1 | {% set tpl = ix_lib.base.render.Render(values) %} |
2 | 2 |
|
3 | 3 | {% set calagopus_net = tpl.networks.create_internal("calagopus-net") %} |
| 4 | +{% set wings_host_path = tpl.funcs.get_host_path(values.storage.wings_data) %} |
4 | 5 |
|
5 | 6 | {# Main Calagopus AIO container (Panel + Wings) #} |
6 | 7 | {% set c1 = tpl.add_container(values.consts.calagopus_container_name, "image") %} |
7 | 8 | {% do c1.add_network(calagopus_net) %} |
8 | 9 |
|
9 | 10 | {% set wings_init = tpl.add_container(values.consts.wings_init_container_name, "image") %} |
10 | 11 | {% do wings_init.setup_as_helper() %} |
11 | | -{% do wings_init.set_user(0, 0) %} |
12 | 12 | {% do wings_init.set_entrypoint(["/bin/sh", "-c"]) %} |
13 | | -{% do wings_init.set_command(["[ -s %s ] || echo '{}' > %s" | format(values.consts.wings_config_path, values.consts.wings_config_path)]) %} |
| 13 | +{% set wings_seed_yaml -%} |
| 14 | +system: |
| 15 | + root_directory: {{ wings_host_path }} |
| 16 | + log_directory: {{ wings_host_path }}/logs |
| 17 | + data_directory: {{ wings_host_path }}/volumes |
| 18 | + vmount_directory: {{ wings_host_path }}/vmounts |
| 19 | + archive_directory: {{ wings_host_path }}/archives |
| 20 | + backup_directory: {{ wings_host_path }}/backups |
| 21 | + tmp_directory: {{ wings_host_path }}/tmp |
| 22 | +{%- endset %} |
| 23 | +{% do wings_init.set_command([ |
| 24 | + "[ -s " ~ values.consts.wings_config_path ~ " ] || cat > " ~ values.consts.wings_config_path ~ " <<'EOF'\n" ~ wings_seed_yaml ~ "\nEOF" |
| 25 | +]) %} |
14 | 26 | {% do wings_init.add_storage(values.consts.data_path, values.storage.data) %} |
15 | 27 |
|
16 | | -{# Permissions init container - prepares storage for postgres and the panel data dir #} |
| 28 | +{# Permissions init container - prepares storage for postgres and the redis temp volume #} |
17 | 29 | {% set perm_container = tpl.deps.perms(values.consts.perms_container_name) %} |
18 | 30 |
|
19 | 31 | {# PostgreSQL dependency #} |
|
34 | 46 | {% set redis = tpl.deps.redis(values.consts.redis_container_name, "redis_image", redis_config, perm_container) %} |
35 | 47 | {% do redis.container.add_network(calagopus_net) %} |
36 | 48 |
|
37 | | -{# AIO image manages sibling containers via the docker socket and therefore needs to run as root #} |
38 | | -{% do c1.set_user(0, 0) %} |
39 | | -{% do c1.add_caps(["CHOWN", "DAC_OVERRIDE", "FOWNER", "KILL", "SETFCAP", "SETGID", "SETPCAP", "SETUID"]) %} |
40 | | - |
41 | 49 | {# Health check on the panel HTTP port #} |
42 | | -{% do c1.healthcheck.set_test("netcat", {"port": values.consts.internal_web_port}) %} |
| 50 | +{% do c1.healthcheck.set_test("netcat", {"port": values.network.web_port.port_number}) %} |
43 | 51 |
|
44 | 52 | {# Dependencies must come up healthy before the panel starts #} |
45 | 53 | {% do c1.depends.add_dependency(values.consts.postgres_container_name, "service_healthy") %} |
46 | 54 | {% do c1.depends.add_dependency(values.consts.redis_container_name, "service_healthy") %} |
47 | 55 | {% do c1.depends.add_dependency(values.consts.wings_init_container_name, "service_completed_successfully") %} |
48 | 56 |
|
49 | 57 | {# Core environment - mirrors the upstream calagopus compose.yml #} |
50 | | -{% do c1.environment.add_env("PORT", values.consts.internal_web_port) %} |
| 58 | +{% do c1.environment.add_env("PORT", values.network.web_port.port_number) %} |
51 | 59 | {% do c1.environment.add_env("BIND", "0.0.0.0") %} |
52 | 60 | {% do c1.environment.add_env("DATABASE_URL", postgres.get_url("postgresql")) %} |
53 | 61 | {% do c1.environment.add_env("DATABASE_MIGRATE", "true") %} |
54 | 62 | {% do c1.environment.add_env("REDIS_MODE", "redis") %} |
55 | 63 | {% do c1.environment.add_env("REDIS_URL", redis.get_url("redis")) %} |
56 | 64 | {% do c1.environment.add_env("APP_ENCRYPTION_KEY", values.calagopus.encryption_key) %} |
57 | | -{% do c1.environment.add_env("APP_PRIMARY", values.calagopus.app_primary) %} |
58 | | -{% do c1.environment.add_env("APP_DEBUG", values.calagopus.app_debug) %} |
| 65 | +{% do c1.environment.add_env("APP_PRIMARY", "true") %} |
| 66 | +{% do c1.environment.add_env("APP_DEBUG", "false") %} |
59 | 67 | {% do c1.environment.add_env("APP_ENABLE_WINGS_PROXY", values.calagopus.enable_wings_proxy) %} |
60 | | -{% do c1.environment.add_env("APP_USE_DECRYPTION_CACHE", values.calagopus.use_decryption_cache) %} |
61 | | -{% do c1.environment.add_env("APP_USE_INTERNAL_CACHE", values.calagopus.use_internal_cache) %} |
| 68 | +{% do c1.environment.add_env("APP_USE_DECRYPTION_CACHE", "true") %} |
| 69 | +{% do c1.environment.add_env("APP_USE_INTERNAL_CACHE", "true") %} |
62 | 70 | {% do c1.environment.add_env("APP_LOG_DIRECTORY", values.consts.log_path) %} |
63 | 71 |
|
64 | 72 | {# AIO-specific: where the integrated wings reads its bootstrap configuration from. |
|
69 | 77 | {% do c1.environment.add_env("APP_TRUSTED_PROXIES", values.calagopus.trusted_proxies | join(",")) %} |
70 | 78 | {% endif %} |
71 | 79 |
|
72 | | -{% if values.calagopus.server_name %} |
73 | | - {% do c1.environment.add_env("SERVER_NAME", values.calagopus.server_name) %} |
74 | | -{% endif %} |
75 | | - |
76 | | -{% if values.calagopus.sentry_url %} |
77 | | - {% do c1.environment.add_env("SENTRY_URL", values.calagopus.sentry_url) %} |
78 | | -{% endif %} |
79 | | - |
80 | 80 | {% do c1.environment.add_user_envs(values.calagopus.additional_envs) %} |
81 | 81 |
|
82 | 82 | {# Ports - panel HTTP and Wings SFTP #} |
83 | | -{% if not values.network.host_network %} |
84 | | - {% do c1.add_port(values.network.web_port, {"container_port": values.consts.internal_web_port}) %} |
85 | | - {% do c1.add_port(values.network.sftp_port, {"container_port": values.consts.internal_sftp_port}) %} |
86 | | -{% endif %} |
| 83 | +{% do c1.add_port(values.network.web_port, {"container_port": values.consts.internal_web_port}) %} |
| 84 | +{% do c1.add_port(values.network.sftp_port, {"container_port": values.consts.internal_sftp_port}) %} |
87 | 85 |
|
88 | 86 | {# Panel-managed storage (configurable via questions.yaml) #} |
89 | 87 | {% do c1.add_storage(values.consts.data_path, values.storage.data) %} |
90 | 88 | {% do c1.add_storage(values.consts.log_path, values.storage.logs) %} |
91 | 89 |
|
| 90 | +{# Wings data: same host path inside the container as on the host so sibling containers |
| 91 | + spawned via the docker socket can bind-mount paths under it. #} |
| 92 | +{% do c1.add_storage(wings_host_path, values.storage.wings_data) %} |
| 93 | + |
92 | 94 | {# Docker socket - required for Wings to manage game server containers #} |
93 | 95 | {% do c1.add_docker_socket(read_only=False) %} |
94 | 96 |
|
95 | | -{# Wings host bind mounts. These paths MUST be identical on host and container because |
96 | | - Wings spawns sibling containers (via the docker socket) that reference these host |
97 | | - paths directly. They are intentionally not exposed in questions.yaml. #} |
98 | | -{% set wings_host_paths = [ |
99 | | - (values.consts.wings_etc_path, values.consts.wings_etc_path, false), |
100 | | - (values.consts.wings_data_path, values.consts.wings_data_path, false), |
101 | | - (values.consts.wings_tmp_path, values.consts.wings_tmp_path, false), |
102 | | -] %} |
103 | | -{% for host_path, container_path, read_only in wings_host_paths %} |
104 | | - {% do c1.add_storage(container_path, { |
105 | | - "type": "host_path", |
106 | | - "read_only": read_only, |
107 | | - "host_path_config": {"path": host_path, "create_host_path": true}, |
108 | | - }) %} |
109 | | -{% endfor %} |
110 | | - |
111 | 97 | {# User-defined extra storage #} |
112 | 98 | {% for store in values.storage.additional_storage %} |
113 | 99 | {% do c1.add_storage(store.mount_path, store) %} |
|
0 commit comments