1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-28 09:24:24 +01:00

fix docker-compose upgrade of elastic + update of elastic version in docs

This commit is contained in:
Sylvain 2018-04-09 16:37:21 +02:00
parent 8f61b47529
commit 88f0926d2a
3 changed files with 45 additions and 13 deletions

View File

@ -46,7 +46,7 @@ FabManager is a Ruby on Rails / AngularJS web application that runs on the follo
- Git 1.9.1+
- Redis 2.8.4+
- Sidekiq 3.3.4+
- Elasticsearch 1.7
- Elasticsearch 5.6
- PostgreSQL 9.4
<a name="contributing"></a>
@ -492,33 +492,38 @@ In FabManager, it is used for the admin's statistics module and to perform searc
For a more detailed guide concerning the ElasticSearch installation, please check the [official documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html)
1. Install the OpenJDK's Java Runtime Environment (JRE). ElasticSearch recommends that you install Java 8 update 20 or later.
1. Install the OpenJDK's Java Runtime Environment (JRE). ElasticSearch recommends that you install Java 8 update 131 or later.
Please check that your distribution's version meet this requirement.
With Ubuntu 14.04, see https://askubuntu.com/a/944260, otherwise use the following command
Using Ubuntu 14.04, see https://askubuntu.com/a/944260. With other systems, use the following command
```bash
sudo apt-get install openjdk-8-jre
```
2. Install HTTPS support for aptitude
```bash
sudo apt-get install apt-transport-https
```
1. Create the repository definition file
3. Create the repository definition file
```bash
echo "deb http://packages.elastic.co/elasticsearch/1.7/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-1.7.list
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
```
2. Import the repository signing key, and update the package lists
4. Import the repository signing key, and update the package lists
```bash
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get update
```
3. Install ElasticSearch 1.7
5. Install ElasticSearch 5.6
```bash
sudo apt-get install elasticsearch
```
4. To automatically start ElasticSearch during bootup, then, depending if your system is compatible with SysV (eg. Ubuntu 14.04) or uses systemd (eg. Debian 8+/Ubuntu 16.04+), you will need to run:
6. To automatically start ElasticSearch during bootup, then, depending if your system is compatible with SysV (eg. Ubuntu 14.04) or uses systemd (eg. Debian 8+/Ubuntu 16.04+), you will need to run:
```bash
# System V
@ -528,7 +533,7 @@ For a more detailed guide concerning the ElasticSearch installation, please chec
sudo /bin/systemctl enable elasticsearch.service
```
5. Restart the host operating system to complete the installation
7. Restart the host operating system to complete the installation
```bash
sudo reboot
@ -542,7 +547,7 @@ Otherwise, please follow the official instructions on the project's website.
```bash
brew update
brew install homebrew/versions/elasticsearch17
brew install elasticsearch@5.6
```
<a name="setup-fabmanager-in-elasticsearch"></a>
@ -681,7 +686,7 @@ See `vendor/assets/components/fullcalendar/dist/lang/*.js` for a list of availab
ELASTICSEARCH_LANGUAGE_ANALYZER
This configure the language analyzer for indexing and searching in projects with ElasticSearch.
See https://www.elastic.co/guide/en/elasticsearch/reference/1.7/analysis-lang-analyzer.html for a list of available analyzers (check that the doc version match your installed elasticSearch version).
See https://www.elastic.co/guide/en/elasticsearch/reference/5.6/analysis-lang-analyzer.html for a list of available analyzers.
TIME_ZONE
@ -810,7 +815,7 @@ Developers may find information on how to implement their own authentication pro
- [Ruby on Rails](http://api.rubyonrails.org)
- [AngularJS](https://docs.angularjs.org/api)
- [Angular-Bootstrap](http://angular-ui.github.io/bootstrap/)
- [ElasticSearch 1.7](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/index.html)
- [ElasticSearch 5.6](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/index.html)
---

View File

@ -27,7 +27,13 @@ services:
restart: always
elasticsearch:
image: elasticsearch:1.7
image: elasticsearch:5.6
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- ${PWD}/elasticsearch:/usr/share/elasticsearch/data
restart: always

View File

@ -213,22 +213,35 @@ ensure_initial_status_green()
wait_for_online()
{
local counter=0
echo -n "Waiting for ElasticSearch instance to came online"
STATUS=$(test_running)
while [ "$STATUS" != "ONLINE" ]
do
echo -n "."
sleep 1
STATUS=$(test_running)
((++counter))
if [ "$counter" -eq 120 ]
then
echo -e "\nThe ElasticSearch instance did not came online for 2 minutes, please check the logs for any errors. Exiting..."
exit 8
fi
done
echo -e "\n"
}
wait_for_green_status()
{
echo -n "Waiting for ElasticSearch indices to have green status"
local state=$(curl "$ES_IP:9200/_cat/indices" 2>/dev/null | awk '{print $1}' | sort | uniq)
while [ "$state" != "green" ]
do
echo -n "."
sleep 1
state=$(curl "$ES_IP:9200/_cat/indices" 2>/dev/null | awk '{print $1}' | sort | uniq)
done
echo -e "\n"
}
prepare_upgrade()
@ -261,6 +274,14 @@ upgrade_compose()
local image="elasticsearch:$target"
if [ $target = '6.2' ]; then image="docker.elastic.co\/elasticsearch\/elasticsearch-oss:6.2.3"; fi
sed -i.bak "s/image: elasticsearch:$current/image: $image/g" "$FM_PATH/docker-compose.yml"
if ! grep -qe "ES_JAVA_OPTS" docker-compose.yml
then
sed -i.bak "/image: $image/s/.*/&\n environment:\n - \"ES_JAVA_OPTS=-Xms512m -Xmx512m\"/" "$FM_PATH/docker-compose.yml"
fi
if ! grep -qe "ulimits" docker-compose.yml
then
sed -i.bak "/image: $image/s/.*/&\n ulimits:\n memlock:\n soft: -1\n hard: -1/" "$FM_PATH/docker-compose.yml"
fi
docker-compose pull
docker-compose up -d
wait_for_online