-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #397 from GSA/feature/solrcloud
Solrcloud Integration with Solr 8
- Loading branch information
Showing
21 changed files
with
1,535 additions
and
776 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import os | ||
import sys | ||
import time | ||
try: | ||
from urllib.request import urlopen | ||
from urllib.error import URLError | ||
except ImportError: | ||
from urllib2 import urlopen | ||
from urllib2 import URLError | ||
|
||
import prerun as pr | ||
|
||
RETRY = 5 | ||
|
||
|
||
def check_solr_connection(retry=None): | ||
if retry is None: | ||
retry = RETRY | ||
elif retry == 0: | ||
print("[prerun] Giving up after 5 tries...") | ||
sys.exit(1) | ||
|
||
url = os.environ.get("CKAN_SOLR_URL", "") | ||
search_url = "{url}/select/?q=*&wt=json".format(url=url) | ||
|
||
try: | ||
connection = urlopen(search_url) | ||
except URLError as e: | ||
print(str(e)) | ||
print("[prerun] Unable to connect to solr, waiting...") | ||
time.sleep(10) | ||
check_solr_connection(retry=retry - 1) | ||
else: | ||
try: | ||
pythonified = str(connection.read()).replace('true', 'True') | ||
eval(pythonified) | ||
except TypeError: | ||
pass | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
maintenance = os.environ.get("MAINTENANCE_MODE", "").lower() == "true" | ||
|
||
if maintenance: | ||
print("[prerun] Maintenance mode, skipping setup...") | ||
else: | ||
pr.check_main_db_connection() | ||
pr.init_db() | ||
pr.update_plugins() | ||
pr.check_datastore_db_connection() | ||
pr.init_datastore_db() | ||
check_solr_connection() | ||
pr.create_sysadmin() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
#----------------------------------------------------------------------- | ||
# Use a protected word file to protect against the stemmer reducing two | ||
# unrelated words to the same base word. | ||
|
||
# Some non-words that normally won't be encountered, | ||
# just to test that they won't be stemmed. | ||
dontstems | ||
zwhacky | ||
|
||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#----------------------------------------------------------------------- | ||
# Use a protected word file to protect against the stemmer reducing two | ||
# unrelated words to the same base word. | ||
# Some non-words that normally won't be encountered, | ||
# just to test that they won't be stemmed. | ||
dontstems | ||
zwhacky | ||
Oops, something went wrong.