-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from MZC-CSC/configuration_setup
Writing a Dockerfile to run container base running.
- Loading branch information
Showing
24 changed files
with
343 additions
and
419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ ant | |
.gitignore | ||
.DS_Store | ||
meta/*.db | ||
result/* | ||
result/** | ||
data/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ jmeter.log | |
result/** | ||
**.properties | ||
meta/*.db | ||
ant | ||
ant | ||
data/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
version: '3.8' | ||
|
||
services: | ||
cb-spider: | ||
image: cloudbaristaorg/cb-spider:0.8.17 | ||
container_name: cb-spider | ||
platform: linux/amd64 | ||
ports: | ||
- "0.0.0.0:1024:1024" | ||
- "0.0.0.0:2048:2048" | ||
environment: | ||
- PLUGIN_SW=OFF | ||
# if you leave these values empty, REST Auth will be disabled. | ||
- API_USERNAME= | ||
- API_PASSWORD= | ||
- SPIDER_LOG_LEVEL=info | ||
|
||
|
||
# CB-Tumblebug | ||
cb-tumblebug: | ||
image: cloudbaristaorg/cb-tumblebug:0.8.12 | ||
container_name: cb-tumblebug | ||
platform: linux/amd64 | ||
ports: | ||
- "1323:1323" | ||
depends_on: | ||
- cb-spider | ||
volumes: | ||
- ./data/cb-tumblebug/meta_db/:/app/meta_db/ | ||
- ./data/cb-tumblebug/log/:/app/log/ | ||
environment: | ||
- SPIDER_REST_URL=http://cb-spider:1024/spider | ||
- API_USERNAME=default | ||
- API_PASSWORD=default | ||
|
||
cm-ant: | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile | ||
container_name: cm-ant | ||
platform: linux/amd64 | ||
ports: | ||
- 8880:8880 | ||
depends_on: | ||
- cb-tumblebug | ||
environment: | ||
- ANT_SPIDER_HOST=http://cb-spider | ||
- ANT_SPIDER_PORT=1024 | ||
- ANT_TUMBLEBUG_HOST=http://cb-tumblebug | ||
- ANT_TUMBLEBUG_PORT=1323 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"strings" | ||
|
||
"github.com/cloud-barista/cm-ant/pkg/utils" | ||
"github.com/spf13/viper" | ||
) | ||
|
||
var ( | ||
AppConfig AntConfig | ||
) | ||
|
||
type AntConfig struct { | ||
Root struct { | ||
Path string `yaml:"path"` | ||
} `yaml:"root"` | ||
Server struct { | ||
Port string `yaml:"port"` | ||
} `yaml:"server"` | ||
Spider struct { | ||
Host string `yaml:"host"` | ||
Port string `yaml:"port"` | ||
} `yaml:"spider"` | ||
Tumblebug struct { | ||
Host string `yaml:"host"` | ||
Port string `yaml:"port"` | ||
Username string `yaml:"username"` | ||
Password string `yaml:"password"` | ||
} `yaml:"tumblebug"` | ||
Load struct { | ||
JMeter struct { | ||
Dir string `yaml:"dir"` | ||
Version string `yaml:"version"` | ||
} `yaml:"jmeter"` | ||
} `yaml:"load"` | ||
Logging struct { | ||
Level string `yaml:"level"` | ||
} `yaml:"logging"` | ||
Database struct { | ||
Driver string `yaml:"driver"` | ||
Host string `yaml:"host"` | ||
Port string `yaml:"port"` | ||
User string `yaml:"user"` | ||
Password string `yaml:"password"` | ||
Name string `yaml:"name"` | ||
} `yaml:"database"` | ||
} | ||
|
||
func InitConfig() error { | ||
cfg := AntConfig{} | ||
|
||
viper.AddConfigPath(utils.RootPath()) | ||
viper.SetConfigName("config") | ||
viper.SetConfigType("yaml") | ||
|
||
viper.SetEnvPrefix("ant") | ||
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) | ||
viper.AutomaticEnv() | ||
|
||
err := viper.ReadInConfig() | ||
if err != nil { | ||
return fmt.Errorf("fatal error while read config file: %w", err) | ||
} | ||
|
||
err = viper.Unmarshal(&cfg) | ||
if err != nil { | ||
return fmt.Errorf("fatal error while unmarshal from config to ant config: %w", err) | ||
} | ||
|
||
log.Printf("server configuration with [%+v] \n", cfg) | ||
AppConfig = cfg | ||
|
||
return nil | ||
} |
Oops, something went wrong.