Skip to content

Commit

Permalink
Merge pull request #6 from ymcatwincities/solr_init
Browse files Browse the repository at this point in the history
Add local and build solr support
  • Loading branch information
Dima Danylevskyi authored Feb 13, 2019
2 parents e6e6a44 + a41018b commit 11e2641
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 36 deletions.
5 changes: 5 additions & 0 deletions devops/reinstall/vars/environments/default_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ env:
- { name: 'config-set', status: true, arguments: "geolocation.settings google_map_api_key 'AIzaSyCzztpo_nVXIGjZdnu3g-lCuQSTnKbfEtM' -y" }
- { name: 'config-set', status: true, arguments: "google_tag.settings container_id GTM-PQTSN2 -y" }
- { name: 'config-set', status: true, arguments: "google_tag.settings path_list '' -y" }
- { name: 'config-set', status: true, arguments: "search_api.server.solr backend_config.connector_config.host 127.0.0.1 -y" }
- { name: 'config-set', status: true, arguments: "search_api.server.solr backend_config.connector_config.core {{ mysql_db }} -y" }
- { name: 'config-set', status: true, arguments: "search_api.server.solr backend_config.connector_config.solr_version 4 -y" }
- { name: 'en', status: true, arguments: "openy_lily || true" }
- { name: 'en', status: true, arguments: "openy_development || true" }
- { name: 'en', status: true, arguments: "devel features_ui field_ui views_ui dblog" }
- { name: 'sapi-r', status: true, arguments: "default -y || true" }
- { name: 'sapi-i', status: true, arguments: "default -y || true" }
post_settings:
- { name: '$config_directories["staging"]', status: true, value: 'sites/default/config/staging' }
- { name: '$settings["cache"]["bins"]["render"]', status: false, value: 'cache.backend.memory' }
Expand Down
4 changes: 4 additions & 0 deletions devops/reinstall/vars/global_settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ build_environments:
- { folder: 'install', url: 'install.drupal.192.168.56.132.xip.io' }
- { folder: 'install', url: 'install.openy.cibox.tools' }

# SOLR
solr_conf_path: '/opt/solr/solr'
default_solr_collection_path: "{{ solr_conf_path }}/collection1"
solr_module_config_path: '/var/www/docroot/modules/contrib/search_api_solr/solr-conf/4.x'
45 changes: 45 additions & 0 deletions devops/reinstall/vars/solr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
- name: Remove build collection directory
file:
state: absent
path: "{{ solr_conf_path }}/{{ mysql_db }}"
mode: 0755

- name: Create build collection directory
file:
state: directory
path: "{{ solr_conf_path }}/{{ mysql_db }}"
mode: 0755

- name: Copy default collection to unique build collection directory
synchronize:
src: "{{ default_solr_collection_path }}/"
dest: "{{ solr_conf_path }}/{{ mysql_db }}"
delegate_to: "{{ inventory_hostname }}"


- name: Copy solr config from search_api_solr to unique build collection directory
synchronize:
src: "{{ solr_module_config_path }}/"
dest: "{{ solr_conf_path }}/{{ mysql_db }}/conf"
delegate_to: "{{ inventory_hostname }}"

- name: Set ownership for build collection directory
file:
state: directory
path: "{{ solr_conf_path }}/{{ mysql_db }}"
mode: 0755
owner: solr
group: solr
recurse: yes

- name: Changing name of the solr collection within build directory
lineinfile:
dest: "{{ solr_conf_path }}/{{ mysql_db }}/core.properties"
regexp: '^name='
line: "name={{ mysql_db }}"

- name: Restart jetty solr
service:
state: restarted
name: jetty
87 changes: 51 additions & 36 deletions reinstall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,54 @@
- devops/reinstall/vars/environments/global_env.yml

tasks:
- name: Include specific variables per environment
include_vars: "devops/reinstall/vars/environments/{{ pp_environment }}_env.yml"
tags: [ 'settings', 'pre-settings', 'post-settings', 'modules-enable', 'drush-commands' ]

- include: devops/reinstall/database_backup.yml
when: make_backup
tags: [ 'database-backup' ]

- include: devops/reinstall/prepare_environment.yml
tags: [ 'prepare-environment' ]

- include: devops/reinstall/pre_settings.yml
when: workflow_type == "sql" or not run_installation_process or run_installation_process == 'false'
tags: [ 'settings', 'pre-settings', 'sql-workflow' ]

- include: devops/reinstall/sql_workflow.yml
when: workflow_type == "sql"
tags: [ 'sql-workflow' ]

- include: devops/reinstall/profile_workflow.yml
when: workflow_type == "profile"
tags: [ 'profile-workflow' ]

- include: devops/reinstall/prepare_environment.yml
tags: [ 'prepare-environment' ]

- include: devops/reinstall/post_settings.yml
tags: [ 'settings', 'post-settings' ]

- include: devops/reinstall/modules_enable.yml
tags: [ 'modules-enable' ]
when: run_installation_process

- include: devops/reinstall/drush_commands.yml
tags: [ 'drush-commands' ]
when: run_installation_process
- name: Include specific variables per environment
include_vars: "devops/reinstall/vars/environments/{{ pp_environment }}_env.yml"
tags:
- 'settings'
- 'pre-settings'
- 'post-settings'
- 'modules-enable'
- 'drush-commands'
- 'solr-commands'
- 'prepare-environment'
- 'database-backup'
- 'profile-workflow'
- 'sql-workflow'

- include: devops/reinstall/database_backup.yml
when: make_backup
tags: [ 'database-backup' ]

- include: devops/reinstall/prepare_environment.yml
tags: [ 'prepare-environment' ]

- include: devops/reinstall/pre_settings.yml
when: workflow_type == "sql" or not run_installation_process or run_installation_process == 'false'
tags: [ 'settings', 'pre-settings', 'sql-workflow' ]

- include: devops/reinstall/sql_workflow.yml
when: workflow_type == "sql"
tags: [ 'sql-workflow' ]

- include: devops/reinstall/profile_workflow.yml
when: workflow_type == "profile"
tags: [ 'profile-workflow' ]

- include: devops/reinstall/prepare_environment.yml
tags: [ 'prepare-environment' ]

- include: devops/reinstall/post_settings.yml
tags: [ 'settings', 'post-settings' ]

- include: devops/reinstall/modules_enable.yml
tags: [ 'modules-enable' ]
when: run_installation_process

- include: devops/reinstall/solr.yml
tags: [ 'solr-commands' ]
when: run_installation_process
become: yes

- include: devops/reinstall/drush_commands.yml
tags: [ 'drush-commands' ]
when: run_installation_process

0 comments on commit 11e2641

Please sign in to comment.