Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.dockerignore
project-groomeong-34231f48bd14.json
logstash.*
mysql-connector-java-8.0.28.jar
logstash.conf
logstash.copy.conf

# Created by https://www.toptal.com/developers/gitignore/api/node,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos
Expand Down
32 changes: 32 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
steps:
- name: docker/compose:1.29.0
args:
- -f
- docker-compose.prod.yaml
- build

- name: docker/compose:1.29.0
args:
- -f
- docker-compose.prod.yaml
- push

- name: gcr.io/cloud-builders/kubectl
args:
- set
- image
- deployment/groomeong-backend
- backend-sha256-1=asia.gcr.io/project-groomeong/backend:1.2
env:
- CLOUDSDK_COMPUTE_ZONE=asia-northeast3
- CLOUDSDK_CONTAINER_CLUSTER=autopilot-cluster-5

- name: gcr.io/cloud-builders/kubectl
args:
- set
- image
- deployment/groomeong-logstash
- logstash-sha256-1=asia.gcr.io/project-groomeong/logstash:1.0
env:
- CLOUDSDK_COMPUTE_ZONE=asia-northeast3
- CLOUDSDK_CONTAINER_CLUSTER=autopilot-cluster-5
2 changes: 1 addition & 1 deletion docker-compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.7'

services:
my-backend:
image: asia.gcr.io/project-groomeong/backend:1.0
image: asia.gcr.io/project-groomeong/backend:1.2
platform: linux/x86_64
build:
context: .
Expand Down
37 changes: 37 additions & 0 deletions elk/logstash/logstash.prod.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
input {
jdbc {
jdbc_driver_library => "/usr/share/logstash/mysql-connector-java-8.0.28.jar"
jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://10.42.208.3:3306/prod" # jdbc:mysql://SQL인스턴스비공개IP주소:포트번호/db이름
jdbc_user => "root"
jdbc_password => "root"
schedule => "*/10 * * * *"
use_column_value => true
tracking_column => "updatedat"
tracking_column_type => "numeric"
last_run_metadata_path => "./updatedat_auto.txt"
statement => "select *, unix_timestamp(updatedat) as updatedat from shop inner join shop_image on shop.id = shop_image.shopid where unix_timestamp(updatedat) > :sql_last_value or shop_image.isthumbnail = 1 order by updatedat asc"
}
}

filter {
mutate {
coerce => { "averagestar" => 0 } # 평점 null인 경우 0으로 설정
convert => { "averagestar" => "integer" }
remove_field => [ "@version", "@timestamp" ]
}
}

output {
opensearch {
hosts => "https://search-groomeong-elasticsearch-7mvk7xnf5m2a6tcx6p5ro5qste.ap-southeast-2.es.amazonaws.com:443"
user => "groomeong11"
password => "QKQHwngus1!"
index => "auto_shop_1"
document_id => "%{shopid}"
manage_template => true
template => "/usr/share/logstash/auto_template3.json"
template_name => "auto"
template_overwrite => true
}
}
Binary file added elk/logstash/mysql-connector-java-8.0.28.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ import { HttpExceptionFilter } from './commons/filter/http-exception.filter';
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE_DATABASE,
entities: [__dirname + '/apis/**/*.entity.*'],
synchronize: true,
synchronize: false,
logging: true,
}),
CacheModule.register<RedisClientOptions>({
store: redisStore,
url: `redis://${process.env.REDIS_URL}:6379`,
url: `redis://${process.env.REDIS_HOST}:6379`,
isGlobal: true,
}),
],
Expand Down