Skip to content

Commit c6662ca

Browse files
committed
Improve naming
1 parent acf48f4 commit c6662ca

14 files changed

Lines changed: 46 additions & 46 deletions

File tree

playbooks/deploy.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,36 +50,36 @@
5050
apply:
5151
tags: [always]
5252
vars:
53-
ota_apps_read_config_only: true
53+
ota_collection_read_config_only: true
5454

5555
- name: Set OTA collection variables
5656
ansible.builtin.set_fact:
57-
ota_chromium_required: "{{ ota_apps_config['@opentermsarchive/engine'] is defined }}"
57+
ota_chromium_required: "{{ ota_collection_config['@opentermsarchive/engine'] is defined }}"
5858
ota_mongo_required: >-
5959
{{
6060
(ansible_distribution != 'Debian' or (ansible_distribution == 'Debian' and ansible_facts['architecture'] != 'aarch64'))
6161
and (
62-
(ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.type is defined
63-
and ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.type == 'mongo')
62+
(ota_collection_config['@opentermsarchive/engine'].recorder.versions.storage.type is defined
63+
and ota_collection_config['@opentermsarchive/engine'].recorder.versions.storage.type == 'mongo')
6464
or
65-
(ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.type is defined
66-
and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.type == 'mongo')
65+
(ota_collection_config['@opentermsarchive/engine'].recorder.snapshots.storage.type is defined
66+
and ota_collection_config['@opentermsarchive/engine'].recorder.snapshots.storage.type == 'mongo')
6767
) | bool
6868
}}
69-
ota_snapshots_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository | default(None) }}"
70-
ota_snapshots_relative_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path | default(None) }}"
71-
ota_versions_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository | default(None) }}"
72-
ota_versions_relative_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.path | default(None) }}"
73-
ota_collection_api_base_path: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath | default(None) }}"
74-
ota_collection_api_port: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].port | default(None) }}"
69+
ota_snapshots_repository: "{{ ota_collection_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository | default(None) }}"
70+
ota_snapshots_relative_path: "{{ ota_collection_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path | default(None) }}"
71+
ota_versions_repository: "{{ ota_collection_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository | default(None) }}"
72+
ota_versions_relative_path: "{{ ota_collection_config['@opentermsarchive/engine'].recorder.versions.storage.git.path | default(None) }}"
73+
ota_collection_api_base_path: "{{ ota_collection_config['@opentermsarchive/engine']['collection-api'].basePath | default(None) }}"
74+
ota_collection_api_port: "{{ ota_collection_config['@opentermsarchive/engine']['collection-api'].port | default(None) }}"
7575
# Generic variables for pm2 and nginx
7676
ota_app_directory: "{{ ota_directory }}"
7777
ota_app_collection_id: "{{ ota_collection_id }}"
7878
ota_app_pm2_home: "{{ ota_pm2_home }}"
7979
ota_app_endpoints:
8080
- name: "collection-api"
81-
basePath: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath | default(None) }}"
82-
port: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].port | default(None) }}"
81+
basePath: "{{ ota_collection_config['@opentermsarchive/engine']['collection-api'].basePath | default(None) }}"
82+
port: "{{ ota_collection_config['@opentermsarchive/engine']['collection-api'].port | default(None) }}"
8383

8484
- name: Setup GitHub bot SSH key
8585
ansible.builtin.include_role:
@@ -97,7 +97,7 @@
9797
apply:
9898
tags: [always]
9999
vars:
100-
ota_contribution_tool_apps_read_config_only: true
100+
ota_contribution_tool_read_config_only: true
101101

102102
- name: Set contribution-tool variables
103103
ansible.builtin.set_fact:
@@ -125,22 +125,22 @@
125125
apply:
126126
tags: [always]
127127
vars:
128-
ota_federation_api_apps_read_config_only: true
128+
ota_federation_api_read_config_only: true
129129

130130
- name: Set federation-api variables
131131
ansible.builtin.set_fact:
132132
ota_chromium_required: false
133133
ota_mongo_required: false
134-
ota_federation_api_port: "{{ ota_federation_api_apps_config['@opentermsarchive/federation-api'].port }}"
135-
ota_federation_api_base_path: "{{ ota_federation_api_apps_config['@opentermsarchive/federation-api'].basePath }}"
134+
ota_federation_api_port: "{{ ota_federation_api_config['@opentermsarchive/federation-api'].port }}"
135+
ota_federation_api_base_path: "{{ ota_federation_api_config['@opentermsarchive/federation-api'].basePath }}"
136136
# Generic variables for pm2 and nginx
137137
ota_app_directory: "{{ ota_federation_api_directory }}"
138138
ota_app_collection_id: "{{ ota_federation_api_collection_id }}"
139139
ota_app_pm2_home: "{{ ota_federation_api_pm2_home }}"
140140
ota_app_endpoints:
141141
- name: "federation-api"
142-
basePath: "{{ ota_federation_api_apps_config['@opentermsarchive/federation-api'].basePath }}"
143-
port: "{{ ota_federation_api_apps_config['@opentermsarchive/federation-api'].port }}"
142+
basePath: "{{ ota_federation_api_config['@opentermsarchive/federation-api'].basePath }}"
143+
port: "{{ ota_federation_api_config['@opentermsarchive/federation-api'].port }}"
144144

145145
# Infrastructure installation (common)
146146
- name: Install infrastructure
@@ -235,7 +235,7 @@
235235
apply:
236236
become: true
237237
vars:
238-
ota_nginx_collection_id: "{{ ota_app_collection_id }}"
238+
ota_nginx_app_id: "{{ ota_app_collection_id }}"
239239
ota_nginx_endpoints: "{{ ota_app_endpoints }}"
240240
ota_nginx_config_template: ./templates/nginx.conf.j2
241241
ota_nginx_reverse_proxy_config_template: ./templates/nginx-reverse-proxy-conf.j2

playbooks/templates/nginx-reverse-proxy-conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{{ ansible_managed | comment }}
22

3-
# Collection: {{ ota_nginx_collection_id }}
3+
# Application: {{ ota_nginx_app_id }}
44

55
{% for endpoint in ota_nginx_endpoints %}
66
{% if endpoint.basePath and endpoint.port %}
77
location {{ endpoint.basePath }} {
88
# Allowing for a `burst` of requests beyond the specified rate limit. The `nodelay` parameter ensures that excessive requests beyond the burst limit are immediately rejected with a 429 error response instead of being queued. See https://www.nginx.com/blog/rate-limiting-nginx/.
9-
limit_req zone=ota_limited_{{ ota_nginx_collection_id }} burst={{ ota_rate_limit_burst | default(5) }} nodelay;
9+
limit_req zone=ota_limited_{{ ota_nginx_app_id }} burst={{ ota_rate_limit_burst | default(5) }} nodelay;
1010
proxy_pass http://localhost:{{ endpoint.port }};
1111
proxy_redirect off;
1212
proxy_set_header Host $host;

playbooks/templates/nginx-server.conf.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ server {
44
listen 80;
55
server_name {{ inventory_hostname }};
66

7-
# Include all OTA collection location configs
7+
# Include all OTA applications location configs
88
include /etc/nginx/ota.d/*.conf;
99
}

playbooks/templates/nginx.conf.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ ansible_managed | comment }}
22

3-
# Collection: {{ ota_nginx_collection_id }}
4-
# Configure the collection-specific rate limiting zone to prevent DDoS attacks.
5-
limit_req_zone $binary_remote_addr zone=ota_limited_{{ ota_nginx_collection_id }}:{{ ota_rate_limit_zone_size | default('10m') }} rate={{ ota_rate_limit_rate | default('10r/s') }};
3+
# Application: {{ ota_nginx_app_id }}
4+
# Configure app-specific rate limiting zone to prevent DDoS attacks.
5+
limit_req_zone $binary_remote_addr zone=ota_limited_{{ ota_nginx_app_id }}:{{ ota_rate_limit_zone_size | default('10m') }} rate={{ ota_rate_limit_rate | default('10r/s') }};

roles/github/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Sets up GitHub bot SSH key for repository access.
66

77
| Variable | Description | Default |
88
|----------|-------------|---------|
9-
| `ota_github_bot_key_path` | Path to store SSH key on server | `/home/{{ ansible_user }}/.ssh/ota-github-bot-key-{{ ota_collection_id }}` |
9+
| `ota_github_bot_key_path` | Path to store SSH key on server | `/home/{{ ansible_user }}/.ssh/ota-github-bot-key-{{ ota_app_collection_id }}` |
1010

1111
## Files Required
1212

@@ -15,4 +15,4 @@ Sets up GitHub bot SSH key for repository access.
1515
## Notes
1616

1717
- Adds GitHub SSH fingerprints to known_hosts
18-
- Supports collection-scoped keys for multi-tenant deployment
18+
- Supports app-scoped keys for multi-tenant deployment

roles/github/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
register: github_bot_private_key_file
66
delegate_to: localhost
77

8-
- name: Add GitHub Bot SSH key (collection-scoped)
8+
- name: Add GitHub Bot SSH key (app-scoped)
99
when: github_bot_private_key_file.stat.exists | default(false)
1010
ansible.builtin.copy:
1111
src: "{{ inventory_dir }}/github-bot-private-key"

roles/nginx/configure/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Configures NGINX reverse proxy for OTA applications.
66

77
| Variable | Description | Default |
88
|----------|-------------|---------|
9-
| `ota_nginx_collection_id` | Collection identifier for config files | Required |
9+
| `ota_nginx_app_id` | Application identifier for config files | Required |
1010
| `ota_nginx_endpoints` | List of endpoints with basePath and port | Required |
1111
| `ota_nginx_config_template` | Rate limit config template path | Required |
1212
| `ota_nginx_reverse_proxy_config_template` | Reverse proxy config template path | Required |

roles/nginx/configure/tasks/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
mode: "0644"
2222
force: true
2323

24-
- name: Add collection-specific rate limit config
24+
- name: Add app-specific rate limit config
2525
ansible.builtin.template:
2626
src: "{{ ota_nginx_config_template }}"
27-
dest: /etc/nginx/conf.d/ota-rate-limit-{{ ota_nginx_collection_id }}.conf
27+
dest: /etc/nginx/conf.d/ota-rate-limit-{{ ota_nginx_app_id }}.conf
2828
owner: root
2929
group: root
3030
mode: "0644"
@@ -38,13 +38,13 @@
3838
group: root
3939
mode: "0755"
4040

41-
- name: Configure NGINX for collection
41+
- name: Configure NGINX for application
4242
notify: Restart NGINX
4343
block:
44-
- name: Add collection-specific location config
44+
- name: Add app-specific location config
4545
ansible.builtin.template:
4646
src: "{{ ota_nginx_reverse_proxy_config_template }}"
47-
dest: /etc/nginx/ota.d/{{ ota_nginx_collection_id }}.conf
47+
dest: /etc/nginx/ota.d/{{ ota_nginx_app_id }}.conf
4848
mode: "0644"
4949
force: true
5050

@@ -57,7 +57,7 @@
5757
mode: "0644"
5858
force: true
5959

60-
- name: Enable OTA collection site
60+
- name: Enable OTA site
6161
ansible.builtin.file:
6262
src: /etc/nginx/sites-available/ota
6363
dest: /etc/nginx/sites-enabled/ota

roles/ota/collection/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
ota_apps_read_config_only: false
2+
ota_collection_read_config_only: false
33
ota_collection_repository_branch: main
44
ota_directory: "{{ ota_collection_repository | ansible.builtin.urlsplit('path') | ansible.builtin.basename | ansible.builtin.splitext | first }}" # extract the repository name from the URL
55
ota_collection_id: "{{ ota_directory | regex_replace('-declarations$', '') }}"

roles/ota/collection/tasks/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
- name: Save production config data into a variable
1616
ansible.builtin.set_fact:
17-
ota_apps_config: "{{ read_config.stdout | from_json }}"
17+
ota_collection_config: "{{ read_config.stdout | from_json }}"
1818

1919
- name: Set up environment variables and install dependencies
20-
when: not ota_apps_read_config_only | bool
20+
when: not ota_collection_read_config_only | bool
2121
block:
2222
- name: Install dependencies
2323
ansible.builtin.command:

0 commit comments

Comments
 (0)