Skip to content

Commit

Permalink
docs: 설정용 파일과 보관용 파일 분리
Browse files Browse the repository at this point in the history
setup : 실제 사용할 수 있는 설정용 파일
docs : 보관용 파일 , 문서
  • Loading branch information
Miensoap committed Nov 28, 2024
1 parent fe834a9 commit 2c5cc4c
Show file tree
Hide file tree
Showing 35 changed files with 143 additions and 4 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
elasticsearch:
build:
context: .
context: ..
dockerfile: Dockerfile
container_name: elasticsearch
environment:
Expand Down Expand Up @@ -39,4 +39,4 @@ services:

volumes:
esdata:
driver: local
driver: local
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions setup/production/elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM docker.elastic.co/elasticsearch/elasticsearch:8.16.0

RUN elasticsearch-plugin install --batch analysis-nori
106 changes: 106 additions & 0 deletions setup/production/elasticsearch/index/place-index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"filter": {
"synonym_filter": {
"type": "synonym",
"synonyms_path": "synonyms.txt"
},
"suggest_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 50
}
},
"analyzer": {
"nori_with_synonym": {
"type": "custom",
"tokenizer": "nori_tokenizer",
"filter": ["lowercase", "nori_readingform", "synonym_filter"]
},
"suggest_index_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "suggest_filter"]
},
"suggest_search_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase"]
}
}
}
},
"mappings": {
"properties": {
"id": {
"type": "integer"
},
"googlePlaceId": {
"type": "keyword"
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
},
"suggest": {
"type": "completion",
"analyzer": "suggest_index_analyzer",
"search_analyzer": "suggest_search_analyzer"
}
},
"analyzer": "nori_with_synonym"
},
"thumbnailUrl": {
"type": "text",
"index": false
},
"rating": {
"type": "scaled_float",
"scaling_factor": 100
},
"location": {
"type": "geo_point"
},
"formattedAddress": {
"type": "text",
"fields": {
"suggest": {
"type": "completion",
"analyzer": "suggest_index_analyzer",
"search_analyzer": "suggest_search_analyzer"
}
},
"analyzer": "nori_with_synonym"
},
"category": {
"type": "keyword",
"index": true
},
"description": {
"type": "text"
},
"detailPageUrl": {
"type": "text",
"index": false
},
"createdAt": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"updatedAt": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"deletedAt": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis",
"null_value": null
}
}
}
}
17 changes: 17 additions & 0 deletions setup/production/elasticsearch/index/synonyms.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
서울특별시, 서울, 서울시
부산광역시, 부산, 부산시
대구광역시, 대구, 대구시
인천광역시, 인천, 인천시
광주광역시, 광주, 광주시
대전광역시, 대전, 대전시
울산광역시, 울산, 울산시
세종특별자치시, 세종, 세종시
경기도, 경기, 경기도청
강원도, 강원, 강원도청
충청북도, 충북, 충청북도청
충청남도, 충남, 충청남도청
전라북도, 전북, 전북특별자치도, 전라북도청
전라남도, 전남, 전라남도청
경상북도, 경북, 경상북도청
경상남도, 경남, 경상남도청
제주특별자치도, 제주, 제주도
15 changes: 13 additions & 2 deletions ...d/resources/elasticsearch/init-es.prod.sh → .../production/elasticsearch/init-es.prod.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
#!/bin/bash

# 현재 스크립트의 디렉터리 가져오기
SCRIPT_DIR=$(dirname "$(realpath "$0")")
INDEX_FILE="$SCRIPT_DIR/index/place-index.json"

# Elasticsearch 상태 확인
until curl -s -XGET "http://localhost:9200/_cluster/health" | grep '"status":"green"' > /dev/null; do
echo "Waiting for Elasticsearch to be ready..."
sleep 5
done

echo "Checking if 'place' index exists..."
response=$(curl -s -o /dev/null -w "%{http_code}" -XGET "http://elasticsearch:9200/place" -u "elastic:${ELASTIC_PASSWORD}")
if [ "$response" -eq 404 ]; then
echo "Index 'place' does not exist. Creating it..."
curl -X PUT "http://elasticsearch:9200/place" \
-H "Content-Type: application/json" \
-u "elastic:${ELASTIC_PASSWORD}" \
--data-binary @/usr/share/elasticsearch/place-index.json
--data-binary @"$INDEX_FILE"
echo "'place' index created successfully."
elif [ "$response" -eq 200 ]; then
echo "Index 'place' already exists."
else
echo "Unexpected response while checking for 'place' index: HTTP $response"
fi
fi
2 changes: 2 additions & 0 deletions setup/production/elasticsearch/sample_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CUSTOM_USERNAME=
ELASTIC_PASSWORD=
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2c5cc4c

Please sign in to comment.