Skip to content

Commit

Permalink
Merge pull request #1 from MZC-CSC/main
Browse files Browse the repository at this point in the history
mc-web-console Initial code push and documentation
  • Loading branch information
MZC-CSC authored Nov 30, 2023
2 parents a93a883 + 64b9d53 commit 1cb9ad9
Show file tree
Hide file tree
Showing 832 changed files with 138,862 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
24 changes: 24 additions & 0 deletions .buffalo.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
app_root: .
ignored_folders:
- vendor
- log
- logs
- assets
- public
- grifts
- tmp
- bin
- node_modules
- .sass-cache
included_extensions:
- .go
- .env
build_path: tmp
build_delay: 200ns
build_target_path: "./cmd/app"
binary_name: mc_web_console-build
command_flags: []
enable_colors: true
log_name: buffalo
http:
port: $PORT
23 changes: 23 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: "2"
checks:
method-lines:
config:
threshold: 100
plugins:
fixme:
enabled: true
gofmt:
enabled: true
golint:
enabled: true
govet:
enabled: true
exclude_patterns:
- grifts/**/*
- "**/*_test.go"
- "*_test.go"
- "**_test.go"
- logs/*
- public/*
- templates/*
- "**/node_modules/"
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
*.log
bin/
21 changes: 21 additions & 0 deletions .env_sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## for dynamic target, using ${CBWS_TARGET}
# common WIP env for test/demo set export CBWS_TARGET=
export CBWS_TARGET=localhost

## localhost
export SPIDER_URL=http://${CBWS_TARGET}:1024/spider
export TUMBLE_URL=http://${CBWS_TARGET}:1323/tumblebug
export DRAGONFLY_URL=http://${CBWS_TARGET}:9090/dragonfly
export API_GW=http://${CBWS_TARGET}:8000

export LADYBUG_URL=${API_GW}/ladybug
export MCKS_URL=http://${CBWS_TARGET}:1470/mcks

export LoginUser=admin
export LoginEmail=admin
export LoginPassword=admin
export LoginAccessSecret=<input access secret>
export LoginRefreshSecret=<input refresh secret>

export API_USERNAME=<api userName for using Tumblebug>
export API_PASSWORD=<api password for using Tumblebug>
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
vendor/
**/*.log
**/*.sqlite
.idea/
bin/
tmp/
node_modules/
.sass-cache/
public/assets/
.vscode/
.grifter/
.env
**/.DS_Store
*.pid
coverage
coverage.data
.svn
.console_history
.sass-cache/*
.jhw-cache/
jhw.*
*.sublime*
dist/
generated/
.vendor/
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
database.yml
Binary file added .yarn/install-state.gz
Binary file not shown.
823 changes: 823 additions & 0 deletions .yarn/releases/yarn-3.3.1.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
enableGlobalCache: true

logFilters:
- code: YN0013
level: discard

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.3.1.cjs
15 changes: 0 additions & 15 deletions CODE_OF_CONDUCT.md

This file was deleted.

6 changes: 0 additions & 6 deletions CONTRIBUTING.md

This file was deleted.

44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This is a multi-stage Dockerfile and requires >= Docker 17.05
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/
FROM gobuffalo/buffalo:v0.18.12 as builder

ENV GOPROXY http://proxy.golang.org

RUN mkdir -p /src/web_console
WORKDIR /src/web_console

# this will cache the npm install step, unless package.json changes
ADD package.json .
ADD yarn.lock .yarnrc.yml ./
RUN mkdir .yarn
COPY .yarn .yarn
RUN yarn install
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

ADD . .
RUN buffalo build --static -o /bin/app

FROM alpine
RUN apk add --no-cache bash
RUN apk add --no-cache ca-certificates

WORKDIR /bin/

COPY --from=builder /bin/app .

# Uncomment to run the binary in "production" mode:
# ENV GO_ENV=production

# Bind the app to 0.0.0.0 so it can be seen from outside the container
ENV ADDR=0.0.0.0

EXPOSE 3000

# Uncomment to run the migrations before running the binary:
# CMD /bin/app migrate; /bin/app
CMD exec /bin/app
82 changes: 79 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,89 @@ This repository provides a Multi-Cloud WEB Console.

A sub-system of [M-CMP platform](https://github.com/m-cmp/docs/tree/main) to deploy and manage Multi-Cloud Infrastructures.

## Overview
```
[NOTE]
mc-web-console is currently under development.
So, we do not recommend using the current release in production.
Please note that the functionalities of mc-web-console are not stable and secure yet.
If you have any difficulties in using mc-web-console, please let us know.
(Open an issue or Join the M-CMP Slack)
```

-
## Overview
- [KOREAN] mc-web-console은 Multi-Cloud Project의 일환으로 다양한 클라우드를 web console에서 처리해 사용자로 하여금 간단하고 편안하게 클라우드를 접할 수 있게 해준다.
- [ENG] The mc-web-console is part of the Multi-Cloud Project, allowing users to seamlessly manage various clouds through a web console, providing a simple and comfortable experience for interacting with the cloud."

## How to Use
- [[설치 환경]](#설치-환경)
- [[의존성]](#의존성)
- [[소스 설치]](#소스-설치)
- [[환경 설정]](#환경-설정)
- [[mc-web-console 실행]](#mc-web-console-실행)

***
## [설치 환경]
mc-web-console은 1.19 이상의 Go 버전이 설치된 다양한 환경에서 실행 가능하지만 최종 동작을 검증한 OS는 Ubuntu 22.0.4입니다.

<br>

## [의존성]
mc-web-console은 내부적으로 mc-infra-connector & mc-infra-manager의 개방형 API를 이용하기 때문에 각 서버의 연동이 필요합니다.(필수)<br>
- [https://github.com/cloud-barista/cb-tumblebug](https://github.com/cloud-barista/cb-tumblebug) README 참고하여 설치 및 실행 (검증된 버전 : cb-tumblebug v0.5.11)
- [https://github.com/cloud-barista/cb-spider](https://github.com/cloud-barista/cb-spider) README 참고하여 설치 및 실행 (검증된 버전 : cb-spider v0.5.12-p1)
- [https://github.com/cloud-barista/cb-dragonfly](https://github.com/cloud-barista/cb-dragonfly) README 참고하여 설치 및 실행 (검증된 버전 : cb-dragonfly v0.5.2)
- [https://github.com/cloud-barista/cb-mcks](https://github.com/cloud-barista/cb-mcks) README 참고하여 설치 및 실행 (검증된 버전 : cb-mcks v0.5.3)

추가로 mc-across-service-manager, mc-observability, mc-cost-optimizer, mc-iam-manager의 개방형 API를 이용할 수도 있다.

<br>

## [소스 설치]
- Git 설치
- `$ sudo apt update`
- `$ sudo apt install git`

- Go 1.19 이상의 버전 설치<br>
- `$ wget https://golang.org/dl/go1.19.1.linux-amd64.tar.gz`
- `$ sudo tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz`

- Go 환경 설정
- `$ echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bashrc`
- `$ echo "export GOPATH=$HOME/go" >> ~/.bashrc`
- `$ source ~/.bashrc`
- `$ go version`
```
go version go1.19.1 linux/amd64
```

- mc-web-console 설치
- `$ mkdir -p ~/go/src/github.com/m-cmp`
- `$ cd ~/go/src/github.com/m-cmp`
- `$ git clone https://github.com/m-cmp/mc-web-console.git`
- `$ cd mc-web-console`
- `$ go mod download`
- `$ go mod verify`

<br>

## [환경 설정]
- ./.env 파일에서 이용하고자 하는 개방형 API 서버의 실제 URL 정보로 수정합니다.<br><br>
**[주의사항]**<br> mc-web-console을 비롯하여 연동되는 모든 서버가 자신의 로컬 환경에서 개발되는 경우를 제외하고는 클라이언트의 웹브라우저에서 접근하기 때문에 localhost나 127.0.0.1 주소가 아닌 실제 IP 주소를 사용해야 합니다.

- 로그인 : iammanager를 사용하는 경우 iammanager에 user 생성, 로컬DB를

- 초기 Data 구축관련<br>
내부적으로 [cb-spider](https://github.com/cloud-barista/cb-spider)[cb-tumblebug](https://github.com/cloud-barista/cb-tumblebug)의 개방형 API를 사용하므로 입력되는 Key Name및 Key Value는 cb-spider 및 cb-tumblebug의 API 문서를 참고하시기 바랍니다.<br>

<br>

-
## [mc-web-console 실행]
- 일반 실행
- `$ cd ~/go/src/github.com/m-cmp/mc-web-console`
- `$ source ./.env`
- `$ buffalo dev`

<br>

## How to Contribute

Expand Down
24 changes: 24 additions & 0 deletions actions/actions_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package actions

import (
"os"
"testing"

"github.com/gobuffalo/suite/v4"
)

type ActionSuite struct {
*suite.Action
}

func Test_ActionSuite(t *testing.T) {
action, err := suite.NewActionWithFixtures(App(), os.DirFS("../fixtures"))
if err != nil {
t.Fatal(err)
}

as := &ActionSuite{
Action: action,
}
suite.Run(t, as)
}
Loading

0 comments on commit 1cb9ad9

Please sign in to comment.