Skip to content

Commit

Permalink
fix: modified auto.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarrettluo committed Oct 10, 2023
1 parent 70b27e4 commit ad7b219
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
20 changes: 15 additions & 5 deletions docker/auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ else
docker pull mongo:latest
fi


# 检查是否已经存在 Docker Compose 文件
if [ ! -f "docker-compose.yml" ]; then
echo "未找到 docker-compose.yml 文件。请将 Docker Compose 文件放置在当前目录中后再运行此脚本。"
Expand All @@ -101,7 +100,7 @@ docker-compose up -d
echo "Waiting for services to start..."
# 在这里可以添加等待服务启动的逻辑,比如等待MongoDB、Elasticsearch和Redis准备就绪
# 检查每个服务是否正常运行
services=("service1" "service2" "service3" "service4") # 替换为服务名称
services=("ad_mongo" "ad_elasticsearch" "ad_redis" "ad_server", "ad_web") # 替换为服务名称

for service in "${services[@]}"; do
if docker-compose ps -q "$service" > /dev/null; then
Expand All @@ -114,14 +113,27 @@ done

#----------------------------------------------------------#

# 在安装目录的esplugin中创建文件夹
cd esplugin && mkdir analysis-ik

# 退出到安装目录
cd ..

# 解压缩到指定文件夹
unzip elasticsearch-analysis-ik-7.9.3.zip -d ./esplugin/analysis-ik/

docker restart ad_elasticsearch

#----------------------------------------------------------#

# 安装Elasticsearch插件(如果有的话)
echo "Installing Elasticsearch plugins..."
# 在这里可以添加安装Elasticsearch插件的命令,比如使用Elasticsearch的REST API或官方提供的命令行工具安装插件
# 进入 Elasticsearch 服务容器
docker-compose exec elasticsearch bash

# 在容器中安装插件,例如插件名称为插件名
bin/elasticsearch-plugin install 插件名
./bin/elasticsearch-plugin install ingest-attachment

#----------------------------------------------------------#

Expand Down Expand Up @@ -175,8 +187,6 @@ curl -X PUT "http://localhost:9200/my_index" -H "Content-Type: application/json"
}
}'



#----------------------------------------------------------#

echo "Installation completed successfully!"
6 changes: 6 additions & 0 deletions src/main/java/com/jiaruiblog/task/executor/PicExecutor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.jiaruiblog.task.executor;

import com.jiaruiblog.entity.FileDocument;
import com.jiaruiblog.task.data.TaskData;

import javax.imageio.ImageIO;
Expand All @@ -22,6 +23,11 @@ public class PicExecutor extends TaskExecutor{
public static final Integer TARGET_WIDTH = 120;
public static final Integer TARGET_HEIGHT = 200;

@Override
public void uploadFileToEs(InputStream is, FileDocument fileDocument, TaskData taskData) {
// do nothing for pic file
}

@Override
protected void readText(InputStream is, String textFilePath) throws IOException {
// do nothing for pic
Expand Down

0 comments on commit ad7b219

Please sign in to comment.