Skip to content

Commit

Permalink
Merge pull request #4 from Tynab/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Tynab committed Jul 28, 2023
2 parents fbb54d9 + 1c734e5 commit a62f39d
Show file tree
Hide file tree
Showing 163 changed files with 2,461 additions and 374 deletions.
26 changes: 13 additions & 13 deletions console/YANLib.Benchmarks/YANLib.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\lib\YANLib\YANLib.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\lib\YANLib\YANLib.csproj" />
</ItemGroup>

</Project>
38 changes: 38 additions & 0 deletions database/YANLIB.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
CREATE DATABASE YANLIB;

USE YANLIB;

CREATE SCHEMA sample;

CREATE TABLE sample.DeveloperTypes
(
Code INT PRIMARY KEY NOT NULL,
Name NVARCHAR(100) NOT NULL,
IsActive BIT NOT NULL,
CreatedDate DATETIME NOT NULL,
ModifiedDate DATETIME
);

CREATE TABLE sample.Developers
(
Id VARCHAR(20) PRIMARY KEY NOT NULL,
Name NVARCHAR(100) NOT NULL,
Phone VARCHAR(20),
IdCard VARCHAR(20) NOT NULL,
DeveloperTypeCode INT NOT NULL,
IsActive BIT NOT NULL,
Version INT NOT NULL,
CreatedDate DATETIME NOT NULL,
ModifiedDate DATETIME,
FOREIGN KEY (DeveloperTypeCode) REFERENCES sample.DeveloperTypes(Code)
);

CREATE TABLE sample.Certificates
(
Id VARCHAR(20) PRIMARY KEY NOT NULL,
Name NVARCHAR(100) NOT NULL,
GPA DOUBLE PRECISION,
DeveloperId VARCHAR(20),
CreatedDate DATETIME NOT NULL,
ModifiedDate DATETIME
);
3 changes: 3 additions & 0 deletions docker-compose.dcproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<None Include="elasticsearch\.dockerignore" />
<None Include="elasticsearch\config\elasticsearch.yml" />
<None Include="elasticsearch\Dockerfile" />
<None Include="es-ingest\.dockerignore" />
<None Include="es-ingest\config\elasticsearch.yml" />
<None Include="es-ingest\Dockerfile" />
<None Include="extensions\curator\.dockerignore" />
<None Include="extensions\curator\config\curator.yml" />
<None Include="extensions\curator\config\delete_log_files_curator.yml" />
Expand Down
7 changes: 2 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ services:
depends_on:
- elasticsearch
restart: unless-stopped

rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
Expand All @@ -119,8 +119,6 @@ services:
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS:-}
networks:
- yan
depends_on:
- logstash
restart: unless-stopped

zookeeper:
Expand All @@ -132,8 +130,6 @@ services:
- ALLOW_ANONYMOUS_LOGIN=yes
networks:
- yan
depends_on:
- logstash
restart: unless-stopped

kafka:
Expand Down Expand Up @@ -183,6 +179,7 @@ networks:
volumes:
setup:
elasticsearch:
es-ingest:

# Run with
# docker-compose \
Expand Down
6 changes: 6 additions & 0 deletions es-ingest/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore Docker build files
Dockerfile
.dockerignore

# Ignore OS artifacts
**/.DS_Store
7 changes: 7 additions & 0 deletions es-ingest/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG ELASTIC_VERSION

# https://www.docker.elastic.co/
FROM docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION}

# Add your elasticsearch plugins setup here
# Example: RUN elasticsearch-plugin install analysis-icu
18 changes: 18 additions & 0 deletions es-ingest/config/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
## Default Elasticsearch configuration from Elasticsearch base image.
## https://github.com/elastic/elasticsearch/blob/main/distribution/docker/src/docker/config/elasticsearch.yml
#
cluster.name: docker-cluster-neo
network.host: 0.0.0.0

## 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

# server.publicBaseUrl: https://my-elasticsearch-cluster.example.com

## Set the built-in users' passwords.
# Run the following command from the Elasticsearch directory:
# ./bin/elasticsearch-setup-passwords interactive
5 changes: 3 additions & 2 deletions extensions/curator/curator-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ services:
curator:
build:
context: extensions/curator/
container_name: curator
init: true
volumes:
- ./config/curator.yml:/.curator/curator.yml:ro,Z
- ./config/delete_log_files_curator.yml:/.curator/delete_log_files_curator.yml:ro,Z
- ./extensions/curator/config/curator.yml:/.curator/curator.yml:ro,Z
- ./extensions/curator/config/delete_log_files_curator.yml:/.curator/delete_log_files_curator.yml:ro,Z
environment:
ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-}
networks:
Expand Down
2 changes: 1 addition & 1 deletion extensions/enterprise-search/config/enterprise-search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
## --------------------- REQUIRED ---------------------

# Encryption keys to protect application secrets.
secret_management.encryption_keys:
secret_management.encryption_keys: [680f94e568c90364bedf927b2f0f49609702d3eab9098688585a375b14274546]
# example:
#- 680f94e568c90364bedf927b2f0f49609702d3eab9098688585a375b14274546

Expand Down
3 changes: 2 additions & 1 deletion extensions/enterprise-search/enterprise-search-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ services:
context: extensions/enterprise-search/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
container_name: enterprise-search
volumes:
- ./config/enterprise-search.yml:/usr/share/enterprise-search/config/enterprise-search.yml:ro,Z
- ./extensions/enterprise-search/config/enterprise-search.yml:/usr/share/enterprise-search/config/enterprise-search.yml:ro,Z
environment:
JAVA_OPTS: -Xms2g -Xmx2g
ENT_SEARCH_DEFAULT_PASSWORD: 'changeme'
Expand Down
3 changes: 2 additions & 1 deletion extensions/filebeat/filebeat-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
ELASTIC_VERSION: ${ELASTIC_VERSION}
# Run as 'root' instead of 'filebeat' (uid 1000) to allow reading
# 'docker.sock' and the host's filesystem.
container_name: filebeat
user: root
command:
# Log to stderr.
Expand All @@ -17,7 +18,7 @@ services:
# see: https://www.elastic.co/guide/en/beats/libbeat/current/config-file-permissions.html
- --strict.perms=false
volumes:
- ./config/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro,Z
- ./extensions/filebeat/config/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro,Z
- type: bind
source: /var/lib/docker/containers
target: /var/lib/docker/containers
Expand Down
1 change: 1 addition & 0 deletions extensions/fleet/agent-apmserver-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
context: extensions/fleet/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
container_name: apm-server
volumes:
- apm-server:/usr/share/elastic-agent/state:Z
environment:
Expand Down
1 change: 1 addition & 0 deletions extensions/fleet/fleet-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
context: extensions/fleet/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
container_name: fleet-server
volumes:
- fleet-server:/usr/share/elastic-agent/state:Z
environment:
Expand Down
3 changes: 2 additions & 1 deletion extensions/heartbeat/heartbeat-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
context: extensions/heartbeat/
args:
ELASTIC_VERSION: ${ELASTIC_VERSION}
container_name: heartbeat
command:
# Log to stderr.
- -e
Expand All @@ -14,7 +15,7 @@ services:
# see: https://www.elastic.co/guide/en/beats/libbeat/current/config-file-permissions.html
- --strict.perms=false
volumes:
- ./config/heartbeat.yml:/usr/share/heartbeat/heartbeat.yml:ro,Z
- ./extensions/heartbeat/config/heartbeat.yml:/usr/share/heartbeat/heartbeat.yml:ro,Z
environment:
HEARTBEAT_INTERNAL_PASSWORD: ${HEARTBEAT_INTERNAL_PASSWORD:-}
BEATS_SYSTEM_PASSWORD: ${BEATS_SYSTEM_PASSWORD:-}
Expand Down
1 change: 1 addition & 0 deletions extensions/logspout/logspout-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
logspout:
build:
context: extensions/logspout
container_name: logspout
volumes:
- type: bind
source: /var/run/docker.sock
Expand Down
4 changes: 2 additions & 2 deletions extensions/metricbeat/config/metricbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ metricbeat.autodiscover:
metricbeat.modules:
- module: elasticsearch
hosts: [ http://elasticsearch:9200 ]
username: monitoring_internal
username: elastic
password: ${MONITORING_INTERNAL_PASSWORD}
xpack.enabled: true
period: 10s
Expand All @@ -30,7 +30,7 @@ metricbeat.modules:
enabled: true
- module: kibana
hosts: [ http://kibana:5601 ]
username: monitoring_internal
username: elastic
password: ${MONITORING_INTERNAL_PASSWORD}
xpack.enabled: true
period: 10s
Expand Down
3 changes: 2 additions & 1 deletion extensions/metricbeat/metricbeat-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
ELASTIC_VERSION: ${ELASTIC_VERSION}
# Run as 'root' instead of 'metricbeat' (uid 1000) to allow reading
# 'docker.sock' and the host's filesystem.
container_name: metricbeat
user: root
command:
# Log to stderr.
Expand All @@ -20,7 +21,7 @@ services:
# from within a container.
- --system.hostfs=/hostfs
volumes:
- ./config/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro,Z
- ./extensions/metricbeat/config/metricbeat.yml:/usr/share/metricbeat/metricbeat.yml:ro,Z
- type: bind
source: /
target: /hostfs
Expand Down
9 changes: 8 additions & 1 deletion host/YANLib.HttpApi.Host/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,27 @@ public class Program
public async static Task<int> Main(string[] args)
{
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((t, f) => f.Enrich.FromLogContext().ReadFrom.Configuration(t.Configuration));
_ = await builder.AddApplicationAsync<YANLibHttpApiHostModule>();

var app = builder.Build();

await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;

return default;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly!");

return 1;
}
finally
Expand Down
Loading

0 comments on commit a62f39d

Please sign in to comment.