Skip to content

Commit

Permalink
230529
Browse files Browse the repository at this point in the history
  • Loading branch information
Tynab committed May 28, 2023
1 parent 1cedc88 commit 94260a7
Show file tree
Hide file tree
Showing 15 changed files with 370 additions and 134 deletions.
25 changes: 0 additions & 25 deletions .dockerignore

This file was deleted.

6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ ELASTIC_VERSION=8.7.1
#
# Superuser role, full access to cluster management and data indices.
# https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-users.html
ELASTIC_PASSWORD='admin123@'
ELASTIC_PASSWORD='changeme'

# User 'logstash_internal' (custom)
#
# The user Logstash uses to connect and send data to Elasticsearch.
# https://www.elastic.co/guide/en/logstash/current/ls-security.html
LOGSTASH_INTERNAL_PASSWORD='admin123@'
LOGSTASH_INTERNAL_PASSWORD='changeme'

# User 'kibana_system' (built-in)
#
# The user Kibana uses to connect and communicate with Elasticsearch.
# https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-users.html
KIBANA_SYSTEM_PASSWORD='admin123@'
KIBANA_SYSTEM_PASSWORD='changeme'

# Users 'metricbeat_internal', 'filebeat_internal' and 'heartbeat_internal' (custom)
#
Expand Down
1 change: 0 additions & 1 deletion docker-compose.dcproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<DependentUpon>docker-compose.yml</DependentUpon>
</None>
<None Include="docker-compose.yml" />
<None Include=".dockerignore" />
<None Include="elasticsearch\.dockerignore" />
<None Include="elasticsearch\config\elasticsearch.yml" />
<None Include="elasticsearch\Dockerfile" />
Expand Down
42 changes: 18 additions & 24 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ services:
dockerfile: host/YANLib.HttpApi.Host/Dockerfile

setup:
profiles:
- setup
build:
context: setup/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
init: true
container_name: setup
volumes:
- ./setup/entrypoint.sh:/entrypoint.sh:ro,Z
- ./setup/lib.sh:/lib.sh:ro,Z
- ./setup/roles:/roles:ro,Z
- setup:/state:Z
environment:
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-}
KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-}
BEATS_SYSTEM_PASSWORD: ${BEATS_SYSTEM_PASSWORD:-}
LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-}
METRICBEAT_INTERNAL_PASSWORD: ${METRICBEAT_INTERNAL_PASSWORD:-}
FILEBEAT_INTERNAL_PASSWORD: ${FILEBEAT_INTERNAL_PASSWORD:-}
HEARTBEAT_INTERNAL_PASSWORD: ${HEARTBEAT_INTERNAL_PASSWORD:-}
MONITORING_INTERNAL_PASSWORD: ${MONITORING_INTERNAL_PASSWORD:-}
KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-}
BEATS_SYSTEM_PASSWORD: ${BEATS_SYSTEM_PASSWORD:-}
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-}
KAFKA_CLIENT_USERS: ${KAFKA_CLIENT_USERS:-}
KAFKA_CLIENT_PASSWORDS: ${KAFKA_CLIENT_PASSWORDS:-}
networks:
- demo
- yanlib
depends_on:
- elasticsearch

Expand All @@ -42,31 +42,31 @@ services:
context: elasticsearch/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
container_name: elasticsearch
volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro,Z
- elasticsearch:/usr/share/elasticsearch/data:Z
ports:
- 9200:9200
- 9300:9300
environment:
node.name: elasticsearch
ES_JAVA_OPTS: -Xms512m -Xmx512m
# Bootstrap password.
# Used to initialize the keystore during the initial startup of
# Elasticsearch. Ignored on subsequent runs.
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-}
# Use single node discovery in order to disable production mode and avoid bootstrap checks.
# see: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
# see: https://www.elastic.co/guide/en/elasticsearch/reference/7.17/bootstrap-checks.html
discovery.type: single-node
networks:
- demo
- yanlib
restart: unless-stopped

logstash:
build:
context: logstash/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
container_name: logstash
volumes:
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro,Z
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro,Z
Expand All @@ -80,7 +80,7 @@ services:
LS_JAVA_OPTS: -Xms256m -Xmx256m
LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-}
networks:
- demo
- yanlib
depends_on:
- elasticsearch
restart: unless-stopped
Expand All @@ -90,50 +90,46 @@ services:
context: kibana/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
container_name: kibana
volumes:
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro,Z
ports:
- 5601:5601
environment:
KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-}
networks:
- demo
- yanlib
depends_on:
- elasticsearch
restart: unless-stopped

rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
ports:
- 5672:5672
- 15672:15672
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER:-}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-}
networks:
- demo
- yanlib
depends_on:
- logstash
restart: unless-stopped

zookeeper:
image: bitnami/zookeeper:latest
container_name: zookeeper
ports:
- 2181:2181
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
networks:
- demo
- yanlib
depends_on:
- logstash
restart: unless-stopped

kafka:
image: bitnami/kafka:latest
container_name: kafka
ports:
- 9092:9092
- 9093:9093
Expand All @@ -150,41 +146,39 @@ services:
KAFKA_CLIENT_USERS: ${KAFKA_CLIENT_USERS:-}
KAFKA_CLIENT_PASSWORDS: ${KAFKA_CLIENT_PASSWORDS:-}
networks:
- demo
- yanlib
depends_on:
- zookeeper
restart: unless-stopped

kafka-ui:
image: provectuslabs/kafka-ui:latest
container_name: kafka-ui
ports:
- 8080:8080
environment:
- KAFKA_CLUSTERS_0_NAME=local
- KAFKA_CLUSTERS_0_ZOOKEEPER=zookeeper:2181
- KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9093
networks:
- demo
- yanlib
depends_on:
- zookeeper
- kafka
restart: unless-stopped

redis:
image: redis:latest
container_name: redis
command: redis-server --requirepass ${REDIS_PASS:-}
ports:
- 6379:6379
networks:
- demo
- yanlib
restart: unless-stopped

networks:
demo:
yanlib:
driver: bridge

volumes:
setup:
elasticsearch:
elasticsearch:
6 changes: 1 addition & 5 deletions elasticsearch/config/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
cluster.name: docker-cluster
network.host: 0.0.0.0

node.name: elasticsearch

discovery.type: single-node

## X-Pack settings
## see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html
#
xpack.license.self_generated.type: trial
xpack.security.enabled: true
xpack.security.enabled: false

## Set the built-in users' passwords.
# Run the following command from the Elasticsearch directory:
Expand Down
15 changes: 3 additions & 12 deletions host/YANLib.HttpApi.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,20 @@
using System;
using System.Threading.Tasks;
using static Microsoft.AspNetCore.Builder.WebApplication;
using static Serilog.Events.LogEventLevel;
using static System.DateTime;

namespace YANLib;

public class Program
{
public async static Task<int> Main(string[] args)
{
Log.Logger = new LoggerConfiguration()
#if DEBUG
.MinimumLevel.Debug()
#else
.MinimumLevel.Information()
#endif
.MinimumLevel.Override("Microsoft", Information).MinimumLevel.Override("Microsoft.EntityFrameworkCore", Warning).Enrich.FromLogContext().WriteTo.Async(c => c.File($"Logs/{Now:yyyy-MM-dd}.log")).WriteTo.Async(c => c.Console()).CreateLogger();

Log.Logger = new LoggerConfiguration().MinimumLevel.Information().Enrich.FromLogContext().WriteTo.Async(c => c.Console()).CreateLogger();
try
{
Log.Information("Starting YANLib.HttpApi.Host.");
var builder = CreateBuilder(args);
builder.Host.AddAppSettingsSecretsJson().UseAutofac().UseSerilog();
await builder.AddApplicationAsync<YANLibHttpApiHostModule>();
_ = builder.Host.AddAppSettingsSecretsJson().UseAutofac().UseSerilog((t, f) => f.Enrich.FromLogContext().ReadFrom.Configuration(t.Configuration));
_ = await builder.AddApplicationAsync<YANLibHttpApiHostModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
Expand Down
19 changes: 14 additions & 5 deletions host/YANLib.HttpApi.Host/YANLib.HttpApi.Host.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="6.1.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Expressions" Version="3.4.1" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="6.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="6.0.0" />
<PackageReference Include="Volo.Abp.Swashbuckle" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="6.0.3" />
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="6.0.3" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="6.0.3" />
<PackageReference Include="Volo.Abp.Http.Client" Version="6.0.3" />
<PackageReference Include="Volo.Abp.Swashbuckle" Version="6.0.3" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="1.0.0-rc.*" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="1.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 9 additions & 4 deletions host/YANLib.HttpApi.Host/YANLibHttpApiHostModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Auditing;
using Volo.Abp.Autofac;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.Http.Client;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
Expand All @@ -25,14 +28,16 @@

namespace YANLib;
[DependsOn(
typeof(YANLibHttpApiModule),
typeof(AbpAutofacModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(YANLibHttpApiModule),
typeof(YANLibApplicationModule),
typeof(YANLibEntityFrameworkCoreModule),
typeof(AbpAutofacModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule)
typeof(AbpSwashbuckleModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpHttpClientModule)
)]
public class YANLibHttpApiHostModule : AbpModule
{
Expand Down
Loading

0 comments on commit 94260a7

Please sign in to comment.