Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker-Compose & PS build errors - can't bring up the solution #582

Open
HazMat1337 opened this issue Apr 19, 2022 · 10 comments
Open

Docker-Compose & PS build errors - can't bring up the solution #582

HazMat1337 opened this issue Apr 19, 2022 · 10 comments

Comments

@HazMat1337
Copy link

HazMat1337 commented Apr 19, 2022

Hello,

I have not been able to start your solution yet.
The PS build scripts do not work on my machine. I had to adjust those so it compiles at least.
When bringing up Docker as per your tutorial the services keep restarting. I started adding the ABP framework requirements to docker but has not worked out so far. Could you provide an updated docker-compose with maybe also SQL server set-up already? Would be good to have a "one-line" startup solution. Thank you! Here are my adapted files so far.

JFYI: I also tried the "dotnet new --install LINGYUN.Abp.MicroService.Templates::5.2.0" approach as in your Readme but 5.2.0 is not available yet.

docker-compose.yml:

version: '3.4'

services:
  admin-api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30010:80"

  sts-api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30015:80"

  localization-api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30030:80"

  platform-api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30025:80"

  messages-api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30020:80"

  task-api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30040:80"
      
  webhook-api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30045:80"

  workflow-api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30050:80"

  sts-server:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "44385:80"

  internal-apigateway:
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://0.0.0.0:80
    ports:
      - "30000:80"
      
  sqlserver:
    environment:
      - SA_PASSWORD=yourStrong(!)Password
      - ACCEPT_EULA=Y
    ports:
      - "1433:1433"

  mongodb:
    ports:
      - "27017:27017"

  rabbitmq:
    ports:
      - "15672:15672"
      - "5672:5672"

  redis:
    ports:
      - "6379:6379"

  elasticsearch:
    volumes:
      - ./elk/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
    environment:
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ports:
      - "9200:9200"

  logstash:
    volumes:
      - ./elk/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
      - ./elk/logstash/pipeline:/usr/share/logstash/pipeline:ro
    environment:
      - "LS_JAVA_OPTS=-Xmx256m -Xms256m"
    ports:
      - "9600"
      - "5000"

  kibana:
    volumes:
      - ./elk/kibana/config/:/usr/share/kibana/config:ro
    ports:
      - 51510:5601

docker-compose.override.yml:

version: '3.4'

services:
  sts-server:
    build:
      context: ./build/aspnet-core/services/Publish/identityserver
    volumes:
      - /var/opt/abp/logs/ids-sts:/app/Logs
      - /var/opt/abp/data/ids-sts/Modules:/app/Modules
    restart: always
    networks:
      - framework

  sts-api:
    build:
      context: ./build/aspnet-core/services/Publish/identityserver4-admin
    volumes:
      - /var/opt/abp/logs/ids-admin:/app/Logs
      - /var/opt/abp/data/ids-admin/Modules:/app/Modules
    depends_on:
      - sts-server
    restart: always
    networks:
      - framework

  admin-api:
    build:
      context: ./build/aspnet-core/services/Publish/admin
    volumes:
      - /var/opt/abp/logs/backend-admin:/app/Logs
      - /var/opt/abp/data/backend-admin/Modules:/app/Modules
    depends_on:
      - sts-server
    restart: always
    networks:
      - framework

  localization-api:
    build:
      context: ./build/aspnet-core/services/Publish/localization
    volumes:
      - /var/opt/abp/logs/localization:/app/Logs
      - /var/opt/abp/data/localization/Modules:/app/Modules
    restart: always
    depends_on:
      - sts-server
    networks:
      - framework

  platform-api:
    build:
      context: ./build/aspnet-core/services/Publish/platform
    volumes:
      - /var/opt/abp/logs/platform:/app/Logs
      - /var/opt/abp/data/platform/Modules:/app/Modules
      - /var/opt/abp/data/platform:/app/file-blob-storing
    depends_on:
      - sts-server
    restart: always
    networks:
      - framework

  messages-api:
    build:
      context: ./build/aspnet-core/services/Publish/messages
    volumes:
      - /var/opt/abp/logs/messages:/app/Logs
      - /var/opt/abp/data/messages/Modules:/app/Modules
    depends_on:
      - sts-server
    restart: always
    networks:
      - framework

  task-api:
    build:
      context: ./build/aspnet-core/services/Publish/task-management
    volumes:
      - /var/opt/abp/logs/task-management:/app/Logs
      - /var/opt/abp/data/task-management/Modules:/app/Modules
    depends_on:
      - sts-server
    restart: always
    networks:
      - framework

  webhook-api:
    build:
      context: ./build/aspnet-core/services/Publish/webhooks
    volumes:
      - /var/opt/abp/logs/webhooks:/app/Logs
      - /var/opt/abp/data/webhooks/Modules:/app/Modules
    depends_on:
      - sts-server
    restart: always
    networks:
      - framework
      
  workflow-api:
    build:
      context: ./build/aspnet-core/services/Publish/workflows
    volumes:
      - /var/opt/abp/logs/webhooks:/app/Logs
      - /var/opt/abp/data/webhooks/Modules:/app/Modules
    depends_on:
      - sts-server
    restart: always
    networks:
      - framework

  internal-apigateway:
    build:
      context: ./build/aspnet-core/services/Publish/internal-apigateway
    volumes:
      - /var/opt/abp/logs/internal-apigateway:/app/Logs
      - /var/opt/abp/data/internal-apigateway/Modules:/app/Modules
    restart: always
    networks:
      - framework
      
  sqlserver:
    image: mcr.microsoft.com/mssql/server
    volumes:
      - dbdata:/var/opt/mssql
    networks:
      - framework
      
  mongodb:
    image: mongo
    networks:
      - framework
      
  rabbitmq:
    image: 'rabbitmq:3-management-alpine'
    networks:
      - framework
      
  redis:
    image: redis:alpine
    networks:
      - framework
      
  elasticsearch:
    image: 'docker.elastic.co/elasticsearch/elasticsearch:7.8.0'
    volumes:
      - esdata:/usr/share/elasticsearch/data
    networks:
      - framework
      
  logstash:
    image: 'docker.elastic.co/logstash/logstash:7.8.0'
    depends_on:
      - elasticsearch
    networks:
      - framework
      
  kibana:
    image: 'docker.elastic.co/kibana/kibana:7.8.0'
    depends_on:
      - elasticsearch
    networks:
      - framework
            
volumes:
  dbdata:
  esdata:
      
networks:
  framework:
      name: ly_app_net

build-aspnetcore-release.ps1:

. "./build-aspnetcore-common.ps1"

# Build all solutions
foreach ($service in $serviceArray) {
    Set-Location $service.Path
    $publishPath = $rootFolder + "/aspnet-core/services/Publish/" + $service.Service
    dotnet restore
    dotnet publish -c Release -o $publishPath --no-cache --no-restore
    Copy-Item (Join-Path $service.Path "Dockerfile") -Destination $publishPath -Recurse
}

Set-Location $rootFolder

build-aspnetcore-common.ps1:

# COMMON PATHS 

$rootFolder = (Get-Item -Path "./" -Verbose).FullName

# List of solutions used only in development mode
[PsObject[]]$serviceArray = @()

$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/"; Service = "admin" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.IdentityServer/"; Service = "identityserver" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.IdentityServer.HttpApi.Host/"; Service = "identityserver4-admin" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/"; Service = "localization" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/"; Service = "platform" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/"; Service = "messages" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.TaskManagement.HttpApi.Host/"; Service = "task-management" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.WebhooksManagement.HttpApi.Host/"; Service = "webhooks" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/"; Service = "workflows" }
$serviceArray += [PsObject]@{ Path = $rootFolder + "/../gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/"; Service = "internal-apigateway" }

Write-host ""
Write-host ":::::::::::::: !!! You are in development mode !!! ::::::::::::::" -ForegroundColor red -BackgroundColor  yellow
Write-host "" 
@colinin
Copy link
Owner

colinin commented Apr 20, 2022

Your docker-compose context is defined in the ./build/aspnet-core/services/Publish/ subdirectory, and the build script build-aspnetcore-release.ps1 output is in the /aspnet-core/services/Publish/ subdirectory

@HazMat1337
Copy link
Author

Sorry but I don't understand what you are referring to.

The build script build-aspnetcore-release.ps1 is run from the ./build directory and outputs therefore to ./build/aspnet-core/services/Publish/. This is exactly the path the docker-compose references to. I also have not changed the files in terms of the paths. They are the original ones provided by you.

When I run docker by docker-compose -f docker-compose.yml -f docker-compose.override.yml up --build -d the microservices restart constantly with the following issues:

image

So I'm assuming this has to do with Redis. It's not present in your docker-compose, so not sure if it every worked for you. I have it within my docker-compose version shown above and it's up and running but I assume the microservices are not pointed into the right location (ip:port).

@colinin
Copy link
Owner

colinin commented Apr 21, 2022

As you can see from the error stack, the application did not find the redis configuration in appsettings.json or appsettings.{env}.json when it started, please check

@colinin
Copy link
Owner

colinin commented Apr 21, 2022

build-aspnetcore-release.ps1 uses a relative path to build, so the output directory is not under the build directory

@HazMat1337
Copy link
Author

Thank you, I'm just not able to get it to run. Can you provide a docker-compose which covers all the requirements to run it? Like RabbitMQ, the database, Redis, etc.
I have not changed a single configuration and thought getting up and running would be much easier but so many tools are required which aren't mentioned in your Readme.

@colinin
Copy link
Owner

colinin commented Apr 26, 2022

Maybe you need to add the -f docker-compose.configuration, yml

@HazMat1337
Copy link
Author

No doesn't work. I also had to change the whole references in docker-compose.configuration.yml because the names don't match any longer (i.e., admin-service must be admin-api, etc.). I was hoping you would provide a Docker compatibility but this just doesn't work and is buggy as hell. Not going to play with it any further and trashing plans to use this project.

@colinin
Copy link
Owner

colinin commented Apr 28, 2022

I would consider incorporating middleware into docker-compose as well

@colinin
Copy link
Owner

colinin commented Apr 26, 2024

#943 once deploy script has been added to this commit,

Warning:
Middleware, because join so many of the footprint is very high, you can cancel ELK, rabbitmq, mysql and so on, and modify the docker-compose.override.configuration.yml configured to use the existing environment

@dongfo
Copy link

dongfo commented May 23, 2024

with the GA of aspire,we can use aspire to develop,and generate docker compose yaml or k8s yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants