Skip to content

Commit

Permalink
setup/core - setup bug-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
superstes committed Dec 31, 2021
1 parent 71aead2 commit 5df9310
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
3 changes: 2 additions & 1 deletion code/core/config/object/core/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
class GaAgent(GaBase):
setting_list = [
'sql_server', 'sql_port', 'sql_user', 'sql_secret', 'sql_database', 'log_level', 'debug', 'device_fail_count', 'device_fail_sleep', 'device_log',
'path_root', 'path_home', 'path_log', 'svc_interval_status', 'svc_interval_reload', 'subprocess_timeout', 'version', 'version_detail',
'path_root', 'path_home', 'path_log', 'svc_interval_status', 'svc_interval_reload', 'subprocess_timeout', 'version', 'version_detail', 'sql_socket',
'sql_service', 'sql_config',
]

def __init__(self, setting_dict: dict, **kwargs):
Expand Down
5 changes: 5 additions & 0 deletions setup/pb_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
tasks_from: 'read_pwds.yml'
when: random_pwd_file.stat.exists

- name: GA | Setup | Getting version
ansible.builtin.import_role:
name: setup
tasks_from: 'get_version.yml'

# installation
- name: GA | Setup | GA Core
ansible.builtin.import_role:
Expand Down
11 changes: 11 additions & 0 deletions setup/roles/setup/tasks/get_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

- name: GA | Setup | Get commit hash
ansible.builtin.shell: "cd {{ ga_setup_clone_dir }} && git log -1 | grep commit | cut -d ' ' -f2"
changed_when: false
register: ga_raw_commit

- name: GA | Setup | Setting commit hash
ansible.builtin.set_fact:
ga_setup_commit: "{{ ga_raw_commit.stdout[:8] }}"
changed_when: false
10 changes: 0 additions & 10 deletions setup/roles/web/tasks/init_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@
no_log: true
register: ga_sql_pwd_web_encrypted

- name: GA | Web | Init | Get commit hash
ansible.builtin.shell: "cd {{ ga_setup_clone_dir }} && git log -1 | grep commit | cut -d ' ' -f2"
changed_when: false
register: ga_raw_commit

- name: GA | Web | Init | Setting commit hash
ansible.builtin.set_fact:
ga_setup_commit: "{{ ga_raw_commit.stdout[:8] }}"
changed_when: false

- name: GA | Web | Init | Preparing initialization script
ansible.builtin.set_fact:
ga_db_init: # This script is used to initialize the main configuration-objects - without those the core and web-interface won't work properly
Expand Down
11 changes: 11 additions & 0 deletions setup/roles/web/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
home: "{{ ga_web_path_home }}"
groups: "{{ ga_web_groups }}"
append: yes
ignore_errors: true
register: ga_web_user_raw

- name: GA | Web | Adding service user to groups
ansible.builtin.user:
name: "{{ ga_web_service_user }}"
groups: "{{ ga_web_groups }}"
append: yes
when:
- ga_web_user_raw.failed is defined
- ga_web_user_raw.failed

- name: GA | Web | Creating directories
ansible.builtin.file:
Expand Down
4 changes: 2 additions & 2 deletions setup/vars/hardcoded.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ ga_update_path: '/var/lib/ga_update'

# users
ga_core_service_user: 'ga_core'
ga_web_service_user: 'ga_web'
ga_web_service_user: 'www-data'
ga_update_service_user: 'ga_update'
ga_service_group: 'ga'
ga_core_path_home: "/home/{{ ga_core_service_user }}"
ga_core_path_venv: "{{ ga_core_path_home }}/venv"
ga_web_path_home: "/home/{{ ga_web_service_user }}"
ga_web_path_home: "/home/ga_web"
ga_web_path_venv: "{{ ga_web_path_home }}/venv"
ga_update_path_home: "/home/{{ ga_update_service_user }}"

Expand Down

0 comments on commit 5df9310

Please sign in to comment.