{"id":22845463,"url":"https://github.com/idealista/solr_role","last_synced_at":"2025-04-28T16:44:31.483Z","repository":{"id":39637285,"uuid":"77052305","full_name":"idealista/solr_role","owner":"idealista","description":"Ansible role to install an Apache Solr (Cloud) server/cluster","archived":false,"fork":false,"pushed_at":"2024-05-14T08:55:39.000Z","size":879,"stargazers_count":25,"open_issues_count":9,"forks_count":10,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-30T11:24:43.018Z","etag":null,"topics":["ansible","apache-solr","debian","solr-cloud","solr-server","solrcloud","solrcloud-server"],"latest_commit_sha":null,"homepage":"","language":"XSLT","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/idealista.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-21T13:06:22.000Z","updated_at":"2024-07-01T13:49:46.000Z","dependencies_parsed_at":"2024-05-12T03:32:29.583Z","dependency_job_id":null,"html_url":"https://github.com/idealista/solr_role","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealista%2Fsolr_role","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealista%2Fsolr_role/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealista%2Fsolr_role/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idealista%2Fsolr_role/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idealista","download_url":"https://codeload.github.com/idealista/solr_role/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251347903,"owners_count":21575176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","apache-solr","debian","solr-cloud","solr-server","solrcloud","solrcloud-server"],"created_at":"2024-12-13T03:17:20.358Z","updated_at":"2025-04-28T16:44:31.449Z","avatar_url":"https://github.com/idealista.png","language":"XSLT","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Logo](https://raw.githubusercontent.com/idealista/solr_role/master/logo.gif)\n\n[![Build Status](https://api.travis-ci.com/idealista/solr_role.png)](https://app.travis-ci.com/github/idealista/solr_role)\n\n# Solr Ansible role\n\nThis ansible role installs a Solr server in a debian environment.\n\n- [Solr Ansible role](#solr-ansible-role)\n  - [Getting Started](#getting-started)\n    - [Prerequisities](#prerequisities)\n    - [Installing](#installing)\n  - [Usage](#usage)\n    - [Add JVM Agent to your installation](#add-jvm-agent-to-your-installation)\n  - [Set up collections](#set-up-collections)\n  - [Set up cores](#set-up-cores)\n  - [Prometheus Exporter](#prometheus-exporter)\n  - [Testing](#testing)\n  - [Built With](#built-with)\n  - [Versioning](#versioning)\n  - [Authors](#authors)\n  - [License](#license)\n  - [Contributing](#contributing)\n\n## Getting Started\n\nThese instructions will get you a copy of the role for your ansible playbook. Once launched, it will install a [Solr](https://cwiki.apache.org/confluence/display/solr/SolrCloud) server in a Debian system.\n\nThis role is tested on:\n- Debian\n  - stretch (java 8 and 11)\n  - buster (java 11)\n- Ubuntu\n  - focal (java 8 and 14)\n\n### Prerequisities\n\nAnsible 2.8.8 version installed.\nInventory destination should be a Debian environment.\n\nFor testing purposes, [Molecule](https://molecule.readthedocs.io/) with [Docker](https://www.docker.com/) as driver.\n\n### Installing\n\nCreate or add to your roles dependency file (e.g requirements.yml):\n\n```\n- src: idealista.solr_role\n  version: x.x.x\n  name: solr\n```\n\nInstall the role with ansible-galaxy command:\n\n```\nansible-galaxy install -p roles -r requirements.yml -f\n```\n\nUse in a playbook:\n\n```\n---\n- hosts: someserver\n  roles:\n    - { role: solr }\n```\n\nPlaybook example below showing how to provision from scratch a SolrCloud cluster with two nodes plus create an example (and empty) collection called `sample_techproducts_configs`, using idealista [java](https://github.com/idealista/java-role), [zookeeper](https://github.com/idealista/zookeeper-role) and [solr](https://github.com/idealista/solr_role) roles:\n\n**Note:** Assuming that 'solrcloud' group has two nodes (`solrcloud1` and `solrcloud2`) as is declared in [molecule.yml](https://github.com/idealista/solr_role/tree/master/molecule/default/molecule.yml),\ncollection will have two shards, one replica and one shard per node as is declared in group vars file called [solrcloud.yml](https://github.com/idealista/solr_role/tree/master/molecule/default/group_vars/solrcloud.yml)\nand configuration files are stored under directory called `sample_techproducts_configs` under template directory.\n\n\u003e :warning: Use the example below just as a reference, requires inventory host groups `solr` and `zookeeper` to be correctly defined\n\n```\n---\n\n- hosts: zookeeper\n  roles:\n    - role: zookeeper\n  pre_tasks:\n    - name: installing required libs\n      apt:\n        pkg: \"{{ item }}\"\n        state: present\n      with_items:\n        - net-tools\n        - netcat\n\n- hosts: solrcloud\n  roles:\n    - role: solr_role\n```\n\n## Usage\n\nLook to the defaults properties file to see the possible configuration properties.\n\n### Add JVM Agent to your installation\n\nThis role supports JVM agents (such as [Newrelic](https://newrelic.com/), [Datadog](https://www.datadoghq.com/), etc.) to be used inside your installation.\nYou can view an example with JVM Agents in the molecule tests section --\u003e [example_setup_with_agent](molecule/setup_with_agent).\n\nIts very simple, must follow this steps (in this case we will add config for [Newrelic's agent](https://newrelic.com/)):\n- Just add the config in your group_vars.\n  ```yml\n  solr_agents_required_libs:\n    - unzip\n    - apt-transport-https\n  solr_agents_config:\n    - name: \"newrelic\"\n      download_url: \"http://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip\"\n      vm_opts:\n        - '-javaagent:{{ solr_installation_dir }}/newrelic/newrelic.jar'\n      configuration_files:\n        - \"newrelic.yml\"\n      params: {\n        application_name: \"application_sample_name\",\n        license_key: \"your_license_key\"\n      }\n  ```\n- __Optional__: Place the configuration files in the templates folder using this order \"templates/{{ agent_name }}/{{ file names specified in solr_agents_config.configuration_files }}.j2. In this case we have the newrelic.yml.j2 in [templates/agents/newrelic/newrelic.yml.j2](molecule/setup_with_agent/templates/agents/newrelic/newrelic.yml.j2).\n\n### Backup with S3\n\nBy default, backups are configured to a local directory. This role also supports S3 Backup, just add the next configuration to your variable file:\n```yaml\nsolr_backup_s3_repository:\n  name: s3\n  class: org.apache.solr.s3.S3BackupRepository\n  default: \"false\"\n  config:\n    - name: \"s3.bucket.name\"\n      value: \"solr-backup\"\n      type: str\n    - name: \"s3.region\"\n      value: \"eu-west-1\"\n      type: str\n```\nThe backup bucket needs to be created.\n\nWhen using IAM user, you can add credentials with these two extra variables (ansible-vault is recommended):\n```yaml\naws_access_key_id: \"admin\"\naws_secret_access_key: \"adminpass\"\n```\n\n## Set up collections\n\nIn order to configure collections just put this config in yml like this example:\n\n```yaml\nsolr_mode: cloud\nsolr_collections:\n  # Extracted from https://github.com/apache/lucene-solr/tree/master/solr/server/solr/configsets/sample_techproducts_configs/conf\n  # Should have configuration files under \"templates/collections/[collection_name]\" directory\n  sample_techproducts_configs:\n    shards: 2\n    replicas: 1\n    shards_per_node: 1\n    auto_add_replicas: false\n  sample_techproducts_configs_2:\n    shards: 2\n    replicas: 1\n    shards_per_node: 1\n```\n\n## Set up cores\n\nIn order to configure cores just put this config in yml like this example:\n\n```yaml\nsolr_mode: standalone\nsolr_cores:\n  # Extracted from https://github.com/apache/lucene-solr/tree/master/solr/server/solr/configsets/sample_techproducts_configs/conf\n  # Should have configuration files under \"templates/collections/[collection_name]\" directory\n  - mail\n```\n\n## Prometheus Exporter\n\nIf you want to scrape metrics from Solr using [Prometheus](https://github.com/idealista/prometheus_server-role), you will need to [configure a exporter](https://lucene.apache.org/solr/guide/7_7/monitoring-solr-with-prometheus-and-grafana.html). We have a [Prometheus Solr Exporter role](https://github.com/idealista/prometheus_solr_exporter_role) that will make configuration easier for you, just keep in mind that the variables `solr_version` and `prometheus_solr_exporter_version` must have the same value.\n\n## Testing\n\n```\n$ pipenv sync\n$ pipenv shell\n\n# This will execute tests but doesn't destroy created environment (because of --destroy=never)\n$ molecule test --destroy=never -s setup_with_collections\n```\n\nSolr Admin UI should be accessible from docker container host at URL:\n\nhttp://localhost:8983/solr/#/ (node: `solrcloud1`)\n\nor\n\nhttp://localhost:8984/solr/#/ (node: `solrcloud2`)\n\n\u003cimg src=\"https://raw.githubusercontent.com/idealista/solr_role/master/assets/solr_admin_ui.png\" alt=\"Solr Admin UI example\" style=\"width: 600px;\"/\u003e\n\nSee [molecule.yml](https://github.com/idealista/solr_role/blob/master/molecule/default/molecule.yml) to check possible testing platforms.\n\n## Built With\n\n![Ansible](https://img.shields.io/badge/ansible-2.8.8-green.svg)\n![Molecule](https://img.shields.io/badge/molecule-3.0.4-green.svg)\n![Goss](https://img.shields.io/badge/goss-0.3.11-green.svg)\n\n## Versioning\n\nFor the versions available, see the [tags on this repository](https://github.com/idealista/solr_role/tags).\n\nAdditionaly you can see what change in each version in the [CHANGELOG.md](https://github.com/idealista/solr_role/blob/master/CHANGELOG.md) file.\n\n## Authors\n\n* **Idealista** - *Work with* - [idealista](https://github.com/idealista)\n\nSee also the list of [contributors](https://github.com/idealista/solr_role/contributors) who participated in this project.\n\n## License\n\n![Apache 2.0 License](https://img.shields.io/hexpm/l/plug.svg)\n\nThis project is licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](https://github.com/idealista/solr_role/blob/master/.github/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidealista%2Fsolr_role","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidealista%2Fsolr_role","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidealista%2Fsolr_role/lists"}