-
Notifications
You must be signed in to change notification settings - Fork 2
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
Enable deployment of engine
and federation-api
on a single server
#41
Changes from all commits
86f77fc
fb35d57
ef2cd8c
dd73717
4ada481
aabe4d5
1d0c9c5
602986b
211eccb
e6d1e06
7bc6266
a92374a
0b3f291
398d620
a0bd647
a417c67
a69744b
a136773
60a1695
13511cf
0601316
d6701ab
ceb81be
c360ddd
2d215fe
79ecd59
71cba8a
55b23b0
b6f623c
ad5a05e
f857f5c
e8eb61d
975d50a
54b60b4
5b1fafe
a23df23
37568e7
36604f6
ee875e0
faab2b7
118622a
08592ec
afccdf0
cf20df2
6d80206
407b470
634498f
a13f2d5
c3200a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
--- | ||
- name: Deploy Open Terms Archive applications | ||
hosts: all | ||
tasks: | ||
- name: Load OTA applications configs | ||
ansible.builtin.include_role: | ||
name: ota/apps | ||
public: true # ensure that the role's variables and defaults are accessible to the play | ||
vars: | ||
ota_apps_read_config_only: true | ||
|
||
- name: Set required variables | ||
set_fact: | ||
chromium_required: "{{ ota_apps_config['@opentermsarchive/engine'] is defined }}" | ||
# Skip Debian 11 with ARM architecture as it is not currently supported by MongoDB; see https://www.mongodb.com/docs/manual/installation/#supported-platforms | ||
mongo_required: | ||
"{{ | ||
(ansible_distribution != 'Debian' or (ansible_distribution == 'Debian' and ansible_facts['architecture'] != 'aarch64')) | ||
and ( | ||
(ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.type is defined and ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.type == 'mongo') | ||
or | ||
(ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.type is defined and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.type == 'mongo') | ||
) | bool | ||
}}" | ||
|
||
snapshots_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository is defined and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository }}" | ||
snapshots_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path is defined and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path }}" | ||
|
||
versions_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository is defined and ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository }}" | ||
versions_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.path is defined and ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.path }}" | ||
|
||
collection_api_basePath: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath is defined and ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath }}" | ||
collection_api_port: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].port is defined and ota_apps_config['@opentermsarchive/engine']['collection-api'].port }}" | ||
|
||
federation_api_basePath: "{{ ota_apps_config['@opentermsarchive/federation-api'].basePath is defined and ota_apps_config['@opentermsarchive/federation-api'].basePath }}" | ||
federation_api_port: "{{ ota_apps_config['@opentermsarchive/federation-api'].port is defined and ota_apps_config['@opentermsarchive/federation-api'].port }}" | ||
|
||
- name: Install infrastructure | ||
become: true | ||
tags: [infrastructure] | ||
block: | ||
- name: Install Node | ||
ansible.builtin.include_role: | ||
name: node | ||
|
||
- name: Install PM2 | ||
ansible.builtin.include_role: | ||
name: pm2/install | ||
|
||
- name: Install Chromium | ||
ansible.builtin.include_role: | ||
name: chromium | ||
when: chromium_required | ||
|
||
- name: Install Nginx | ||
ansible.builtin.include_role: | ||
name: nginx/install | ||
|
||
- name: Install Mongo | ||
ansible.builtin.include_role: | ||
name: mongo/install | ||
when: | ||
- mongo_required | ||
|
||
- name: Configure Mongo | ||
ansible.builtin.include_role: | ||
name: mongo/configure | ||
apply: | ||
become: true | ||
Comment on lines
+68
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided to manage all
However, this approach has some drawbacks:
Another solution considered was using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Amazing, thank you for these clear explanations! |
||
when: | ||
- mongo_required | ||
|
||
- name: Setup Git-based versions database | ||
ansible.builtin.include_role: | ||
name: ota/git-database | ||
vars: | ||
ota_git_database_repository: "{{ versions_repository }}" | ||
ota_git_database_directory: "{{ versions_path }}" | ||
ota_git_database_branch: main | ||
when: | ||
- versions_repository and versions_path | ||
|
||
- name: Setup Git-based snapshots database | ||
ansible.builtin.include_role: | ||
name: ota/git-database | ||
vars: | ||
ota_git_database_repository: "{{ snapshots_repository }}" | ||
ota_git_database_directory: "{{ snapshots_path }}" | ||
ota_git_database_branch: main | ||
when: | ||
- snapshots_repository and snapshots_path | ||
|
||
- name: Setup OTA applications | ||
ansible.builtin.include_role: | ||
name: ota/apps | ||
|
||
- name: Start OTA applications | ||
ansible.builtin.include_role: | ||
name: pm2/manage | ||
|
||
- name: Configure NGINX | ||
ansible.builtin.include_role: | ||
name: nginx/configure | ||
apply: | ||
become: true | ||
vars: | ||
ota_nginx_config_template: ./templates/nginx.conf.j2 | ||
ota_nginx_reverse_proxy_config_template: ./templates/nginx-reverse-proxy-conf.j2 |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- { role: common } |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, I prefer to have a top down approach for global variables