Skip to content

Commit

Permalink
fix: deploy database and local deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
cchalop1 committed Sep 3, 2024
1 parent 800fe01 commit d511cfa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
28 changes: 4 additions & 24 deletions internal/adapter/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ var servicesConfigMap = map[string]ServicesConfig{
{Name: "MONGO_INITDB_ROOT_PASSWORD", Value: "", IsSecret: true},
},
Config: container.Config{
Image: "mongo:latest",
Cmd: []string{"mongo"},
Image: "mongo",
ExposedPorts: map[nat.Port]struct{}{
"27017/tcp": {},
},
Expand All @@ -54,25 +53,6 @@ var servicesConfigMap = map[string]ServicesConfig{
},
},
},
"Mysql": {
Name: "MySQL",
Icon: "https://upload.wikimedia.org/wikipedia/fr/thumb/6/62/MySQL.svg/1200px-MySQL.svg.png",
Env: []dto.Env{
{Name: "MYSQL_ROOT_PASSWORD", Value: "", IsSecret: true},
{Name: "MYSQL_DATABASE", Value: "", IsSecret: false},
},
Config: container.Config{
Image: "mysql:latest",
Cmd: []string{"mysql"},
ExposedPorts: map[nat.Port]struct{}{
"3306/tcp": {},
},
Env: []string{
"MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD",
"MYSQL_DATABASE=$MYSQL_DATABASE",
},
},
},
"Redis": {
Name: "Redis",
Icon: "https://grafikart.fr/uploads/icons/redis.svg",
Expand All @@ -81,7 +61,7 @@ var servicesConfigMap = map[string]ServicesConfig{
},
Config: container.Config{
Image: "redis:latest",
Cmd: []string{"redis --requirepass $REDIS_PASSWORD"},
Cmd: []string{"redis-server", "--requirepass", "$REDIS_PASSWORD"},
ExposedPorts: map[nat.Port]struct{}{
"6379/tcp": {},
},
Expand All @@ -95,8 +75,8 @@ var servicesConfigMap = map[string]ServicesConfig{
{Name: "KEYCLOAK_PASSWORD", Value: "", IsSecret: true},
},
Config: container.Config{
Image: "jboss/keycloak:latest",
Cmd: []string{"keycloak"},
Image: "quay.io/keycloak/keycloak",
Cmd: []string{"start-dev"},
ExposedPorts: map[nat.Port]struct{}{
"8080/tcp": {},
},
Expand Down
4 changes: 1 addition & 3 deletions internal/application/create-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func createServiceLinkToDeploy(deployService *service.DeployService, createServi

envs := generateEnvsForService(service.Env)

// replace in services config all the envs with the new values
replaceEnvForServicesConfig(&service, envs)

containerHostname := generateContainerHostname(service.Name, createServiceDto.DeployId)
Expand Down Expand Up @@ -136,14 +135,13 @@ func createServiceOnly(deployService *service.DeployService, serviceName string)

envs := generateEnvsForService(service.Env)

// replace in services config all the envs with the new values
replaceEnvForServicesConfig(&service, envs)

containerHostname := generateContainerHostname(service.Name, nil)

deployService.DockerAdapter.RunService(service, containerHostname)

envs = append(envs, dto.Env{Name: "localhost", Value: containerHostname})
envs = append(envs, dto.Env{Name: strings.ToUpper(service.Name) + "_HOSTNAME", Value: "localhost"})

domainService := domain.Service{
Id: utils.GenerateRandomPassword(5),
Expand Down
Binary file modified web/bun.lockb
Binary file not shown.

0 comments on commit d511cfa

Please sign in to comment.