Skip to content

Commit

Permalink
New release with data-portal and updated images
Browse files Browse the repository at this point in the history
  • Loading branch information
vvalerio-priv committed Dec 5, 2023
1 parent 9758a99 commit 96dd4ad
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 43 deletions.
40 changes: 19 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ Use "opensource-docker [command] --help" for more information about a command.
Deploy an enviroment with .env set up on docker
Usage:
opensource-docker deploy [flags]
epos-docker-cli deploy [flags]
Flags:
--autoupdate string Auto update the images versions (true|false)
--dockercompose string Docker compose file, use default if not provided
--env string Environment variable file, use default if not provided
--externalip string IP address used to expose the services, use automatically generated if not provided
-h, --help help for deploy
```

Expand Down Expand Up @@ -125,11 +127,6 @@ EPOS Data Portal:
http://<your-ip>:<GUI_PORT><DEPLOY_PATH>
```

EPOS Backoffice:
```
http://<your-ip>:<BACKOFFICE_GUI_PORT><DEPLOY_PATH>
```

EPOS API Gateway:
```
http://<your-ip>:<API_PORT><DEPLOY_PATH><API_PATH>
Expand All @@ -140,21 +137,20 @@ http://<your-ip>:<API_PORT><DEPLOY_PATH><API_PATH>

| Name | Standard Value | Description |
|--|--|--|
| API_HOST_ENV | ${API_HOST_ENV} | API Host Environment IP provided by user, if not set is generated automatically using machine IP |
| API_HOST | ${API_HOST} | API Host IP, if not set is generated automatically using machine IP |
| EXECUTE_HOST | ${API_HOST} | Internal variable to setup redirections for the external access service, if not set is generated automatically using machine IP |
| DEPLOY_PATH | / | Context path of the environment|
| BASE_CONTEXT | empty value | Context path name of the environment (similar to DEPLOY_PATH but without the initial /) |
| API_PATH | /api/v1 | API GATEWAY access path|
| GUI_PORT | 8000 | Port used by EPOS Data Portal or other GUIs |
| BACKOFFICE_GUI_PORT | 9000 | Port used by EPOS Backoffice UI or other Backoffice GUIs |
| API_PORT | 8080 | Port used by EPOS API Gateway |
| IS_MONITORING_AUTH | false | Variable used to protect monitoring endpoint via JWT |
| IS_AAI_ENABLED | false | Variable used to protect backoffice endpoints via AAI service |
| DATA_PORTAL_PORT | 32000 | Port used by EPOS Data Portal or other GUIs |
| API_PORT | 33000 | Port used by EPOS API Gateway |

### RabbitMQ configuration

| Name | Standard Value | Description |
|--|--|--|
| BROKER_HOST | rabbitmq | Name of the RabbitMQ container |
| BROKER_USERNAME | changeme | RabbitMQ username |
| BROKER_PASSWORD | changeme | RabbitMQ password |
| BROKER_VHOST | changeme | RabbitMQ vhost |
Expand All @@ -163,10 +159,11 @@ http://<your-ip>:<API_PORT><DEPLOY_PATH><API_PATH>

| Name | Standard Value | Description |
|--|--|--|
| POSTGRESQL_HOST | metadata-catalogue:5432 | Name and port of the metadata catalogue container |
| POSTGRES_USER | postgres | Database user |
| POSTGRESQL_PASSWORD | changeme | Database password |
| POSTGRES_DB | cerif | Database name |
| POSTGRESQL_CONNECTION_STRING | jdbc:postgresql://postgrescerif:5432/${POSTGRES_DB}?user=${POSTGRES_USER}&password=${POSTGRESQL_PASSWORD} | Database connection string based on previous configurations |
| POSTGRESQL_CONNECTION_STRING | jdbc:postgresql:///${POSTGRESQL_HOST}/${POSTGRES_DB}?user=${POSTGRES_USER}&password=${POSTGRESQL_PASSWORD} | Database connection string based on previous configurations |
| PERSISTENCE_NAME | EPOSDataModel | Persistence Name of scientific metadata |
| PERSISTENCE_NAME_PROCESSING | EPOSProcessing | Persistence Name of processing metadata |

Expand Down Expand Up @@ -210,7 +207,7 @@ http://<your-ip>:<API_PORT><DEPLOY_PATH><API_PATH>
| IS_AAI_ENABLED | false | |
| SECURITY_KEY | empty | |
| AAI_SERVICE_ENDPOINT | empty | |
| FACETS_DEFAULT | false | |
| FACETS_DEFAULT | true | |
| FACETS_TYPE_DEFAULT | categories | |
| REDIS_SERVER | redis-server | |
| INGESTOR_HASH | 3F58A1895982CC81A2E5CEDA7DD9AC7009DF9998 | |
Expand All @@ -221,14 +218,15 @@ http://<your-ip>:<API_PORT><DEPLOY_PATH><API_PATH>
|--|--|--|
| MESSAGE_BUS_IMAGE | rabbitmq | 3.11.7-management |
| REDIS_IMAGE | redis | 7.0.11 |
| GATEWAY_IMAGE | epos-api-gateway | 1.1.0 |
| RESOURCES_SERVICE_IMAGE | resources-service | 1.3.2 |
| INGESTOR_IMAGE | ingestor-service | 1.3.1 |
| EXTERNAL_ACCESS_IMAGE | external-access-service | 1.3.2 |
| BACKOFFICE_SERVICE_IMAGE | backoffice-service | 2.1.0 |
| CONVERTER_IMAGE | converter-service | 1.1.5 |
| DATA_METADATA_SERVICE_IMAGE | data-metadata-service | 2.3.17 |
| METADATA_DB_IMAGE | metadata-database-deploy | 2.2.0 |
| DATAPORTAL_IMAGE | data-portal | 1.0.0 |
| GATEWAY_IMAGE | epos-api-gateway | 1.3.4 |
| RESOURCES_SERVICE_IMAGE | resources-service | 1.4.1 |
| INGESTOR_IMAGE | ingestor-service | 1.4.4 |
| EXTERNAL_ACCESS_IMAGE | external-access-service | 1.4.6 |
| BACKOFFICE_SERVICE_IMAGE | backoffice-service | 2.3.7 |
| CONVERTER_IMAGE | converter-service | 1.2.1 |
| DATA_METADATA_SERVICE_IMAGE | data-metadata-service | 2.7.5 |
| METADATA_DB_IMAGE | metadata-database-deploy | 2.4.13 |

## Maintenance

Expand Down
25 changes: 13 additions & 12 deletions cmd/configurations/env.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# ENVIRONMENT CONFIGURATION
# ************************************************************************************************************

#API_HOST_ENV="192.168.0.1"
API_HOST=${API_HOST_ENV}
EXECUTE_HOST=${API_HOST_ENV}
DEPLOY_PATH="/"
BASE_CONTEXT=""
API_PATH="/api/v1"
API_PORT=8080
DATA_PORTAL_PORT=32000
API_PORT=33000

# ************************************************************************************************************
# RABBITMQ CONFIGURATION
Expand All @@ -23,7 +23,7 @@ BROKER_VHOST="changeme"
# POSTGRESQL CONFIGURATION
# ************************************************************************************************************

POSTGRESQL_HOST=postgrescerif:5432
POSTGRESQL_HOST=metadata-catalogue:5432
POSTGRES_USER="postgres"
POSTGRESQL_PASSWORD="changeme"
POSTGRES_DB="cerif"
Expand Down Expand Up @@ -72,7 +72,7 @@ IS_AAI_ENABLED=false
SECURITY_KEY=
AAI_SERVICE_ENDPOINT=

FACETS_DEFAULT=false
FACETS_DEFAULT=true
FACETS_TYPE_DEFAULT=categories
REDIS_SERVER=redis-server
INGESTOR_HASH=3F58A1895982CC81A2E5CEDA7DD9AC7009DF9998
Expand All @@ -81,12 +81,13 @@ INGESTOR_HASH=3F58A1895982CC81A2E5CEDA7DD9AC7009DF9998
# DOCKER IMAGES AND TAGS
# ************************************************************************************************************
MESSAGE_BUS_IMAGE="rabbitmq:3.11.7-management"
GATEWAY_IMAGE="epos-api-gateway:1.2.0"
RESOURCES_SERVICE_IMAGE="resources-service:1.4.0"
DATA_METADATA_SERVICE_IMAGE="data-metadata-service:2.5.0"
INGESTOR_IMAGE="ingestor-service:1.4.0"
EXTERNAL_ACCESS_IMAGE="external-access-service:1.4.0"
BACKOFFICE_SERVICE_IMAGE="backoffice-service:2.2.0"
CONVERTER_IMAGE="converter-service:1.2.0"
METADATA_DB_IMAGE="metadata-database-deploy:2.4.0"
REDIS_IMAGE="redis:7.0.11"
DATAPORTAL_IMAGE="data-portal:1.0.0"
GATEWAY_IMAGE="epos-api-gateway:1.3.4"
RESOURCES_SERVICE_IMAGE="resources-service:1.4.1"
INGESTOR_IMAGE="ingestor-service:1.4.4"
EXTERNAL_ACCESS_IMAGE="external-access-service:1.4.6"
BACKOFFICE_SERVICE_IMAGE="backoffice-service:2.3.7"
CONVERTER_IMAGE="converter-service:1.2.1"
DATA_METADATA_SERVICE_IMAGE="data-metadata-service:2.7.5"
METADATA_DB_IMAGE="metadata-database-deploy:2.4.13"
18 changes: 12 additions & 6 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
package cmd

import (
"github.com/joho/godotenv"
"github.com/spf13/cobra"
"os"
"os/exec"
"time"

"github.com/joho/godotenv"
"github.com/spf13/cobra"
)

var deployCmd = &cobra.Command{
Expand All @@ -32,6 +33,7 @@ var deployCmd = &cobra.Command{
Long: `Deploy an enviroment with .env set up on docker`,
Run: func(cmd *cobra.Command, args []string) {
env, _ := cmd.Flags().GetString("env")
externalip, _ := cmd.Flags().GetString("externalip")
dockercomposefile, _ := cmd.Flags().GetString("dockercompose")
autoupdate, _ := cmd.Flags().GetString("autoupdate")
isDefaultEnv := false
Expand All @@ -53,8 +55,11 @@ var deployCmd = &cobra.Command{
if autoupdate == "true" {
checkImagesUpdate()
}

setupIPs()
if externalip == "" {
setupIPs()
} else {
setupProvidedIPs(externalip)
}
printSetup(env, dockercomposefile)
command := exec.Command("docker-compose",
"-f",
Expand All @@ -72,7 +77,7 @@ var deployCmd = &cobra.Command{
os.Exit(0)
}
printTask("Installing rabbitmq container on the machine")
time.Sleep(8 * time.Second)
time.Sleep(15 * time.Second)
printTask("Installing all remaining containers on the machine")
command = exec.Command("docker-compose",
"-f",
Expand All @@ -87,7 +92,7 @@ var deployCmd = &cobra.Command{
printError("Creation of container failed, cause: " + err.Error())
os.Exit(0)
}
time.Sleep(20 * time.Second)
time.Sleep(30 * time.Second)
printTask("Restarting gateway")
command = exec.Command("docker-compose",
"-f",
Expand All @@ -108,6 +113,7 @@ var deployCmd = &cobra.Command{

func init() {
deployCmd.Flags().String("env", "", "Environment variable file, use default if not provided")
deployCmd.Flags().String("externalip", "", "IP address used to expose the services, use automatically generated if not provided")
deployCmd.Flags().String("dockercompose", "", "Docker compose file, use default if not provided")
deployCmd.Flags().String("autoupdate", "", "Auto update the images versions (true|false)")
}
11 changes: 11 additions & 0 deletions cmd/docker-compose/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@
version: '3.7'

services:
dataportal:
image: "${DOCKER_REGISTRY}/${DATAPORTAL_IMAGE}"
container_name: data-portal
ports:
- "${DATA_PORTAL_PORT}:80"
networks:
- epos_network
restart: always
environment:
- BASE_URL="/"
- API_HOST="http://gateway:5000/api/v1"
gateway:
image: "${DOCKER_REGISTRY}/${GATEWAY_IMAGE}"
container_name: gateway
Expand Down
17 changes: 13 additions & 4 deletions cmd/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/google/go-github/v52/github"
"github.com/hashicorp/go-version"
"github.com/jedib0t/go-pretty/v6/table"
"io/ioutil"
"net"
"net/http"
"os"
"path/filepath"
"strings"
"time"

"github.com/google/go-github/v52/github"
"github.com/hashicorp/go-version"
"github.com/jedib0t/go-pretty/v6/table"
)

const colorReset = "\033[0m"
Expand Down Expand Up @@ -102,6 +103,13 @@ func setupIPs() {
os.Setenv("LOCAL_IP", os.Getenv("API_HOST_ENV"))
}

func setupProvidedIPs(externalip string) {
os.Setenv("API_HOST", "http://"+externalip+":"+os.Getenv("API_PORT")+os.Getenv("DEPLOY_PATH")+"/api")
os.Setenv("EXECUTE_HOST", "http://"+externalip+":"+os.Getenv("API_PORT"))
os.Setenv("HOST", "http://"+externalip+":"+os.Getenv("GUI_PORT"))
os.Setenv("LOCAL_IP", externalip)
}

func print_urls() {

fmt.Println(string(colorCyan), `Open Source Docker deploy
Expand All @@ -121,6 +129,7 @@ func print_urls() {
Copyright (C) 2023 EPOS ERIC`, string(colorReset))
t := table.NewWriter()
t.SetTitle("EPOS ACCESS POINTS")
t.AppendRow(table.Row{"EPOS Data Portal", "http://" + os.Getenv("API_HOST_ENV") + ":" + os.Getenv("DATA_PORTAL_PORT")})
t.AppendRow(table.Row{"EPOS API Gateway", "http://" + os.Getenv("API_HOST_ENV") + ":" + os.Getenv("API_PORT") + os.Getenv("DEPLOY_PATH") + os.Getenv("API_PATH") + "/ui/"})
t.SetStyle(table.StyleColoredBlackOnGreenWhite)
fmt.Println(t.Render())
Expand Down Expand Up @@ -227,5 +236,5 @@ func getLastDockerImageTag(repo string) string {
}

func getVersion() string {
return "0.3.4"
return "0.4.0"
}

0 comments on commit 96dd4ad

Please sign in to comment.