Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Merge branch 'ozline:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
wushiling50 authored Sep 18, 2023
2 parents 8a73506 + 7aed598 commit b003dfa
Show file tree
Hide file tree
Showing 60 changed files with 3,649 additions and 61 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ cmd/api/tiktok_api
dumped_hertz_remote_config.json

# config
config/config.yaml
config/config.yaml

# compose data
/data
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ PERFIX = "[Makefile]"

.PHONY: env-up
env-up:
sh init.sh
docker-compose up -d

.PHONY: env-down
Expand Down
11 changes: 9 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var (
Mysql *mySQL
Snowflake *snowflake
Service *service
Jaeger *jaeger
Etcd *etcd
RabbitMQ *rabbitMQ
Redis *redis
Expand All @@ -36,8 +37,10 @@ func Init(path string, service string) {
panic(errors.New("not found etcd addr in env"))
}

Etcd = &etcd{Addr: etcdAddr}

// use etcd for config save
err := runtime_viper.AddRemoteProvider("etcd3", etcdAddr, "/config/config.yaml")
err := runtime_viper.AddRemoteProvider("etcd3", Etcd.Addr, "/config/config.yaml")

if err != nil {
panic(err)
Expand Down Expand Up @@ -75,7 +78,7 @@ func configMapping(srv string) {
Server = &c.Server
Server.Secret = []byte(runtime_viper.GetString("server.jwt-secret"))

Etcd = &c.Etcd
Jaeger = &c.Jaeger
Mysql = &c.MySQL
RabbitMQ = &c.RabbitMQ
Redis = &c.Redis
Expand Down Expand Up @@ -107,6 +110,10 @@ func InitForTest() {
Secret: []byte("MTAxNTkwMTg1Mw=="),
}

Jaeger = &jaeger{
Addr: "127.0.0.1:6831",
}

Etcd = &etcd{
Addr: "127.0.0.1:2379",
}
Expand Down
9 changes: 9 additions & 0 deletions config/config_exmple.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# NOTICE: copy and rename this file to config.yaml
# NOTICE: some cofig need to complete


# nodes ony need to set this item
etcd-addr: 172.16.232.8:2379

# etcd server need to complete these items
server:
jwt-secret: MTAxNTkwMTg1Mw==
version: "1.0"
Expand Down Expand Up @@ -41,6 +46,10 @@ redis:
addr: 127.0.0.1:6379
password: tiktok

jaeger:
addr: 127.0.0.1:6831

# if you deploy in different machines, remember to modify IP.
services:
api:
name: api
Expand Down
27 changes: 27 additions & 0 deletions config/elasticsearch/elasticsearch-plugins.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Rename this file to `elasticsearch-plugins.yml` to use it.
#
# All plugins must be listed here. If you add a plugin to this list and run
# `elasticsearch-plugin sync`, that plugin will be installed. If you remove
# a plugin from this list, that plugin will be removed when Elasticsearch
# next starts.

plugins:
# Each plugin must have an ID. Plugins with only an ID are official plugins and will be downloaded from Elastic.
- id: example-id

# Plugins can be specified by URL (it doesn't have to be HTTP, you could use e.g. `file:`)
- id: example-with-url
location: https://some.domain/path/example4.zip

# Or by maven coordinates:
- id: example-with-maven-url
location: org.elasticsearch.plugins:example-plugin:1.2.3

# A proxy can also be configured per-plugin, if necessary
- id: example-with-proxy
location: https://some.domain/path/example.zip
proxy: https://some.domain:1234

# Configures a proxy for all network access. Remove this if you don't need
# to use a proxy.
proxy: https://some.domain:1234
Binary file added config/elasticsearch/elasticsearch.keystore
Binary file not shown.
2 changes: 2 additions & 0 deletions config/elasticsearch/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cluster.name: "docker-cluster"
network.host: 0.0.0.0
75 changes: 75 additions & 0 deletions config/elasticsearch/jvm.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
################################################################
##
## JVM configuration
##
################################################################
##
## WARNING: DO NOT EDIT THIS FILE. If you want to override the
## JVM options in this file, or set any additional options, you
## should create one or more files in the jvm.options.d
## directory containing your adjustments.
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/8.4/jvm-options.html
## for more information.
##
################################################################



################################################################
## IMPORTANT: JVM heap size
################################################################
##
## The heap size is automatically configured by Elasticsearch
## based on the available memory in your system and the roles
## each node is configured to fulfill. If specifying heap is
## required, it should be done through a file in jvm.options.d,
## which should be named with .options suffix, and the min and
## max should be set to the same value. For example, to set the
## heap to 4 GB, create a new file in the jvm.options.d
## directory containing these lines:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/8.4/heap-size.html
## for more information
##
################################################################


################################################################
## Expert settings
################################################################
##
## All settings below here are considered expert settings. Do
## not adjust them unless you understand what you are doing. Do
## not edit them in this file; instead, create a new file in the
## jvm.options.d directory containing your adjustments.
##
################################################################

-XX:+UseG1GC

## JVM temporary directory
-Djava.io.tmpdir=${ES_TMPDIR}

## heap dumps

# generate a heap dump when an allocation from the Java heap fails; heap dumps
# are created in the working directory of the JVM unless an alternative path is
# specified
-XX:+HeapDumpOnOutOfMemoryError

# exit right after heap dump on out of memory error
-XX:+ExitOnOutOfMemoryError

# specify an alternative path for heap dumps; ensure the directory exists and
# has sufficient space
-XX:HeapDumpPath=data

# specify an alternative path for JVM fatal error logs
-XX:ErrorFile=logs/hs_err_pid%p.log

## GC logging
-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
Loading

0 comments on commit b003dfa

Please sign in to comment.