Skip to content

Commit

Permalink
Merge pull request #93 from yunkon-kim/241029
Browse files Browse the repository at this point in the history
Staging v0.0.9
  • Loading branch information
yunkon-kim authored Oct 29, 2024
2 parents 0e97b88 + f348b72 commit 1e35006
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ RUN ./scripts/install-tofu.sh
# Setting various environment variables required by the application
ENV TERRARIUM_ROOT=/app

## Set SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8056)
ENV TERRARIUM_SELF_ENDPOINT=localhost:8888
## Set SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8055)
ENV TERRARIUM_SELF_ENDPOINT=localhost:8055

## Set API access config
# API_ALLOW_ORIGINS (ex: https://cloud-barista.org,xxx.xxx.xxx.xxx or * for all)
Expand Down Expand Up @@ -83,4 +83,4 @@ ENV TERRARIUM_AUTOCONTROL_DURATION_MS=10000
ENTRYPOINT [ "/app/mc-terrarium" ]

# Exposing the port that the application will run on
EXPOSE 8888
EXPOSE 8055
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ compose-up: ## Up services by docker compose
echo "Creating terrarium_network..."; \
docker network create terrarium_network; \
fi
@echo "Pulling the latest edge images..."
@docker pull cloudbaristaorg/mc-terrarium:edge
@echo "Starting services by docker compose..."
@docker compose up

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Note - There may be an issue regarding Credential settings. Contributions are we
- Required a Docker network, `terrarium_network`

> [!NOTE]
> services in other docker composes can access the `mc-terrarium` service, like `http://mc-terrarium:8888/terrarium`.
> services in other docker composes can access the `mc-terrarium` service, like `http://mc-terrarium:8055/terrarium`.
> _Condition: Set up `terrarium_network` in external docker compose_
You can do this by running the following command:
Expand All @@ -65,7 +65,7 @@ make compose

You can find the default username and password to access to API dashboard when the API server runs.

URL: http://localhost:8888/terrarium/swagger/index.html
URL: http://localhost:8055/terrarium/swagger/index.html

Note - You can find API documentation on Swagger UI.

Expand Down
2 changes: 1 addition & 1 deletion api/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2059,7 +2059,7 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "latest",
Host: "localhost:8888",
Host: "localhost:8055",
BasePath: "/terrarium",
Schemes: []string{},
Title: "Multi-Cloud Terrarium REST API",
Expand Down
2 changes: 1 addition & 1 deletion api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"version": "latest"
},
"host": "localhost:8888",
"host": "localhost:8055",
"basePath": "/terrarium",
"paths": {
"/httpVersion": {
Expand Down
2 changes: 1 addition & 1 deletion api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ definitions:
example: asia-northeast3
type: string
type: object
host: localhost:8888
host: localhost:8055
info:
contact:
name: API Support
Expand Down
6 changes: 3 additions & 3 deletions cmd/mc-terrarium/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ func init() {
// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html

// @host localhost:8888
// @host localhost:8055
// @BasePath /terrarium

// @securityDefinitions.basic BasicAuth
func main() {

log.Info().Msg("preparing to run mc-terrarium server...")

// Set the default port number "8888" for the REST API server to listen on
port := flag.String("port", "8888", "port number for the restapiserver to listen to")
// Set the default port number "8055" for the REST API server to listen on
port := flag.String("port", "8055", "port number for the restapiserver to listen to")
flag.Parse()

// Validate port
Expand Down
6 changes: 3 additions & 3 deletions conf/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
terrarium:
root: # To be set in runtime

## Set SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8888)
## Set SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8055)
self:
endpoint: localhost:8888
endpoint: localhost:8055

## Set API access config
api:
# Set API_ALLOW_ORIGINS (ex: https://cloud-barista.org,http://localhost:8888 or * for all)
# Set API_ALLOW_ORIGINS (ex: https://cloud-barista.org,http://localhost:8055 or * for all)
allow:
origins: "*"

Expand Down
6 changes: 3 additions & 3 deletions conf/setup.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
SCRIPT_DIR=`dirname ${BASH_SOURCE[0]-$0}`
export TERRARIUM_ROOT=`cd $SCRIPT_DIR && cd .. && pwd`

## Set TERRARIUM_SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8888)
export TERRARIUM_SELF_ENDPOINT=localhost:8888
## Set TERRARIUM_SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8055)
export TERRARIUM_SELF_ENDPOINT=localhost:8055

## Set API access config
# TERRARIUM_API_ALLOW_ORIGINS (ex: https://cloud-barista.org,http://localhost:8888 or * for all)
# TERRARIUM_API_ALLOW_ORIGINS (ex: https://cloud-barista.org,http://localhost:8055 or * for all)
export TERRARIUM_API_ALLOW_ORIGINS=*
# Set API_AUTH_ENABLED=true currently for basic auth for all routes (i.e., url or path)
export TERRARIUM_API_AUTH_ENABLED=true
Expand Down
6 changes: 3 additions & 3 deletions conf/template-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
mcterrarium:
root: # To be set in runtime

## Set SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8888)
## Set SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8055)
self:
endpoint: localhost:8888
endpoint: localhost:8055

## Set API access config
api:
# Set API_ALLOW_ORIGINS (ex: https://cloud-barista.org,http://localhost:8888 or * for all)
# Set API_ALLOW_ORIGINS (ex: https://cloud-barista.org,http://localhost:8055 or * for all)
allow:
origins: "*"

Expand Down
6 changes: 3 additions & 3 deletions conf/template-setup.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
SCRIPT_DIR=`dirname ${BASH_SOURCE[0]-$0}`
export TERRARIUM_ROOT=`cd $SCRIPT_DIR && cd .. && pwd`

## Set TERRARIUM_SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8888)
export TERRARIUM_SELF_ENDPOINT=localhost:8888
## Set TERRARIUM_SELF_ENDPOINT, to access Swagger API dashboard outside (Ex: export SELF_ENDPOINT=x.x.x.x:8055)
export TERRARIUM_SELF_ENDPOINT=localhost:8055

## Set API access config
# TERRARIUM_API_ALLOW_ORIGINS (ex: https://cloud-barista.org,http://localhost:8888 or * for all)
# TERRARIUM_API_ALLOW_ORIGINS (ex: https://cloud-barista.org,http://localhost:8055 or * for all)
export TERRARIUM_API_ALLOW_ORIGINS=*
# Set API_AUTH_ENABLED=true currently for basic auth for all routes (i.e., url or path)
export TERRARIUM_API_AUTH_ENABLED=true
Expand Down
14 changes: 7 additions & 7 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ networks:

services:
mc-terrarium:
image: cloudbaristaorg/mc-terrarium:edge
image: cloudbaristaorg/mc-terrarium:0.0.9
container_name: mc-terrarium
build:
context: .
dockerfile: Dockerfile
networks:
- terrarium_network
ports:
- target: 8888
published: 8888
- target: 8055
published: 8055
protocol: tcp
env_file:
- ./secrets/credentials # AWS credentials
Expand All @@ -23,7 +23,7 @@ services:
- ./container-volume/mc-terrarium-container/.terrarium:/app/.terrarium
environment:
# - TERRARIUM_ROOT=/app
# - TERRARIUM_SELF_ENDPOINT=localhost:8888
# - TERRARIUM_SELF_ENDPOINT=localhost:8055
# - TERRARIUM_API_ALLOW_ORIGINS=*
# - TERRARIUM_API_AUTH_ENABLED=true
# - TERRARIUM_API_USERNAME=default
Expand All @@ -33,13 +33,13 @@ services:
# - TERRARIUM_LOGFILE_MAXBACKUPS=3
# - TERRARIUM_LOGFILE_MAXAGE=30
# - TERRARIUM_LOGFILE_COMPRESS=false
- TERRARIUM_LOGLEVEL=debug
# - TERRARIUM_LOGLEVEL=info
# - TERRARIUM_LOGWRITER=both
# - TERRARIUM_NODE_ENV=production
# - TERRARIUM_AUTOCONTROL_DURATION_MS=10000
healthcheck: # for MC-Terrarirum
test: [ "CMD", "curl", "-f", "http://localhost:8888/terrarium/readyz" ]
interval: 1m
test: [ "CMD", "curl", "-f", "http://localhost:8055/terrarium/readyz" ]
interval: 5m
timeout: 5s
retries: 3
start_period: 10s
2 changes: 1 addition & 1 deletion secrets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ docker run \
--env-file "${PWD}"/secrets/credentials \
--env-file "${PWD}"/secrets/credential-azure.env \
--mount type=bind,source="${PWD}"/secrets/,target=/app/secrets/ \
-p 8888:8888 \
-p 8055:8055 \
--name mc-terrarium \
cloudbaristaorg/mc-terrarium:latest
```

0 comments on commit 1e35006

Please sign in to comment.