Skip to content
Snippets Groups Projects
Commit 9003173a authored by Krish Moodbidri's avatar Krish Moodbidri
Browse files

add deploy_account_services_app job

`deploy_account_services_app` job in `.gitlab-ci.yml` to launch the `account-services-app` VM
parent c635b33f
No related branches found
No related tags found
1 merge request!4wip: add account services node deployment with a accountservices playbook
......@@ -427,7 +427,7 @@ deploy_ood_node:
- if: $PIPELINE_TARGET == "deploy" && $OOD_IMAGE_ID
when: always
deploy_account_services_:
deploy_account_services_app:
stage: deploy
environment:
name: $ENV
......@@ -465,7 +465,7 @@ deploy_account_services_:
cmd+=" --security-group $security_group"
done
cmd+=" --user-data user_data.txt"
if [ -n "$PROXY_NETWORK" ];then cmd+=" --network $PROXY_NETWORK"; fi
if [ -n "$INSTANCE_NETWORK" ];then cmd+=" --network $INSTANCE_NETWORK"; fi
if [ -n "$ACCOUNT_SERVICES_APP_PORT" ];then cmd+=" --port $ACCOUNT_SERVICES_APP_PORT"; fi
cmd+=" --wait account-services-app"
- export ACCOUNT_SERVICES_APP_INSTANCE_ID=$(bash -c "$cmd")
......
......@@ -3,6 +3,5 @@
hosts: default
become: true
roles:
- { name: 'install_rabbitmq', tags: 'install_rabbitmq' }
- { name: 'install_accountapp', tags: 'install_accountapp' }
---
- name: Install packages via yum
yum:
name:
- python3-pip
- python3-devel
state: latest
- name: Remove existing user register app install
file:
path: "{{ user_register_app_path }}"
state: absent
- name: Clone user register app form from gitlab
git:
repo: "{{ user_register_app_repo }}"
dest: "{{ user_register_app_path }}"
refspec: "{{ user_register_app_refspec }}"
version: "{{ user_register_app_tag }}"
- name: Change ownership of directory
file:
path: "{{ user_register_app_path }}"
owner: root
group: root
state: directory
recurse: yes
- name: Create __pycache__ in app dir
file:
path: "{{ user_register_app_path }}/__pycache__"
owner: "{{ RegUser_app_user }}"
group: "{{ RegUser_app_user }}"
state: directory
- name: Create __pycache__ in app dir
file:
path: "{{ user_register_app_path }}/app/__pycache__"
owner: "{{ RegUser_app_user }}"
group: "{{ RegUser_app_user }}"
state: directory
- name: Copy Self-Reg app variables file
template:
src: app_vars.j2
dest: "{{ user_register_app_path }}/app_vars.py"
- name: Install requirements in virtualenv
pip:
requirements: requirements.txt
virtualenv: venv
virtualenv_command: /usr/bin/python3 -m venv
chdir: "{{ user_register_app_path }}"
- name: Install gunicorn in virtualenv
pip:
name: gunicorn
virtualenv: venv
virtualenv_command: /usr/bin/python3 -m venv
chdir: "{{ user_register_app_path }}"
- name: Create log directory
file:
path: "/var/log/{{ user_register_app }}"
owner: "{{ RegUser_app_user }}"
group: "{{ RegUser_app_user }}"
state: directory
- name: Set up log rotate for module usage
template:
src: logrotate.j2
dest: "/etc/logrotate.d/{{ user_register_app }}"
- name: Copy Celery service template
template:
src: celery.service.j2
dest: "/etc/systemd/system/celery-{{ user_register_app }}.service"
- name: Enable celery.service
systemd:
name: celery-{{ user_register_app }}.service
enabled: yes
- name: Put apache config file in place (user-reg_conf_shib.j2 in case of shib)
template:
src: user-reg_conf_shib.j2
dest: "/opt/rh/httpd24/root/etc/httpd/conf.d/user-reg-{{ user_register_app }}.conf"
when: configure_shib
- name: Put apache config file in place (user-reg_conf.j2 in case of basicauth)
template:
src: user-reg_conf.j2
dest: "/opt/rh/httpd24/root/etc/httpd/conf.d/user-reg.conf"
when: not configure_shib
- name: Put wsgi file in place
template:
src: wsgi.j2
dest: "{{ user_register_app_path }}/wsgi.py"
- name: Put gunicorn config file in place
template:
src: ini.j2
dest: "{{ user_register_app_path }}/{{ user_register_app }}.ini"
- name: Create gunicorn system service
template:
src: service.j2
dest: "/etc/systemd/system/{{ user_register_app }}.service"
- name: Enable user registration redirect
replace:
path: /etc/ood/config/ood_portal.yml
regexp: '{{ item.regexp }}'
replace: '{{ item.replace }}'
backup: yes
with_items:
- { regexp: "^#?(user_map_cmd:).*", replace: "\\1 '/opt/ood/ood_auth_map/bin/user_auth.py'" }
- { regexp: "^#?(map_fail_uri:).*", replace: "\\1 '/{{ user_register_app }}'" }
- { regexp: "^#?(register_uri:).*", replace: "\\1 '/{{ user_register_app }}'" }
when: activate_namespace
- name: Stage regex file for ood
template:
src: user_auth_py.j2
dest: /opt/ood/ood_auth_map/bin/user_auth.py
owner: root
group: root
mode: 0755
- name: Build the updated Apache config
command: /opt/ood/ood-portal-generator/sbin/update_ood_portal
ignore_errors: yes
- name: Enable apache service
systemd:
name: httpd24-httpd
enabled: yes
- name: Start and enable flask app gunicorn service
service:
name: "{{ user_register_app }}"
enabled: yes
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment