Sign inSign up

ponylin1985/zayni3.sharedata.service

By ponylin1985

•Updated almost 7 years ago

A in-memory remote share data cache service implemented in .NET Core 3.0 and the Zayni Framework3.

Image
0

572

ponylin1985/zayni3.sharedata.service repository overview

This is Zayni Framework's built-in Remote.ShareData.Service. You can use it as an application cache service.

More detail or configuration example. Please go to the Zayni Framework's gitlab project⁠.

⁠Get this docker image.
  • Run docker pull ponylin1985/zayni.sharedata.service:alpine-x64 command in your terminal.
⁠Run the docker container.
  • Install the docker-compose first.
  • Use docker-compose.yml to run the container.
  • Run docker-compose up -d to start the container.
version: "3"

services:
  zayni.remote.sharedata.service:
    image: zayni.sharedata.service:alpine-x64
    volumes:
      - ~/GitRepo/MyGitLab/ZayniFramework/Source/Remote.ShareData.ServiceApp/serviceHostConfig.json:/app/serviceHostConfig.json
      - ~/GitRepo/MyGitLab/ZayniFramework/Source/Remote.ShareData.ServiceApp/App.config:/app/ZayniFramework.Remote.ShareData.Service.dll.config
      - ~/ApplicationLog/Remote.ShareData.ServiceApp:/app/Log
    ports:
      - 5555:5555   # gRPC Host port
      - 5592:5592   # TCPSocket Host port
      - 5582:5582   # WebSocket Host Port
      - 2222:2222   # Remote Telnet Command Service port
    container_name: zayni.sharedata.service.alpine
⁠App.config Example
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="ZayniFramework" type="ZayniFramework.Common.ZayniConfigSection, ZayniFramework.Common" />
    </configSections>
    <ZayniFramework>
        <LoggingSettings eventLogEnable="true" logEnable="true">
            <DefaultTextLogger>
                <add name="_DefaultLog" enable="true" maxSize="8" emailNotifyLoggerName="GmailErrorNotify">
                    <!-- ZayniFramework框架預設的文字日誌檔 -->
                    <LogFile path="Log/Zayni/Remote.ShareData.Tracing.log" />
                    <!-- <Filter filterType="deny" category="Information,Warning" /> -->
                </add>
                <add name="RedisCacheTrace" enable="false" maxSize="8">
                    <!-- ZaynigFramework Caching 模組對 Redis 請求回應的日誌紀錄 -->
                    <LogFile path="Log/Zayni/Remote.ShareData.RedisTracing.log" />
                    <Filter filterType="deny" category="Information,Warning" />
                </add>
                <add name="ServiceHostTrace" enable="true" maxSize="8" consoleOutput="true" consoleColor="Yellow">
                    <!-- ZaynigFramework Middle Service 的文字日誌記錄 -->
                    <LogFile path="Log/Zayni/Remote.ShareData.Middle.Service.Tracing.log" />
                    <!-- <Filter filterType="deny" category="Information,Warning" /> -->
                </add>
                <add name="ServiceHostActionLog" enable="true" maxSize="8" consoleOutput="true" consoleColor="Green">
                    <!-- ZaynigFramework Middle Service 的服務動作日誌記錄 -->
                    <LogFile path="Log/Zayni/Remote.ShareData.Service.Action.log" />
                </add>
            </DefaultTextLogger>
            <EmailNotifyLogger>
                <add name="GmailErrorNotify" smtpPort="587" smtpHost="smtp.gmail.com" enableSsl="true" smtpDomain="" smtpAccount="[email protected]" smtpPassword="asdflkKdjfe" fromEmailAddress="[email protected]" fromDisplayName="TruBuzz Gmail Monitor" toEmailAddress="[email protected]" />
            </EmailNotifyLogger>
        </LoggingSettings>
        <CachingSettings managerMode="memory">
            <CachePool resetEnable="true" cleanerIntervalSecond="5" maxCapacity="1000000" refreshIntervalMinute="10" />
            <CacheData timeoutInterval="60" />
        </CachingSettings>
        <DataAccessSettings>
            <DatabaseProviders>
                <add name="Zayni" dataBaseProvider="MSSQL" sqlLogEnable="true" />
            </DatabaseProviders>
        </DataAccessSettings>
    </ZayniFramework>
    <connectionStrings>
        <add name="Zayni" connectionString="Server=localhost,1433;Database=ZayniFramework;User Id=XXX;Password=XXX;Max Pool Size=20;Min Pool Size=5;Connection Lifetime=30;"
             providerName="System.Data.SqlClient" />
    </connectionStrings>
    <appSettings>
        <add key="TelnetServerPort" value="2222" />
        <add key="TelnetServerPassword" value="Admin123" />
    </appSettings>
</configuration>
⁠serviceHostConfig.json Example
{
    "enableConsoleTracingLog": true,
    "serviceHosts": [
        {
            "serviceName": "RemoteCache-UnitTest-TCPSocket",
            "remoteHostType": "TCPSocket",
            "hostName": "Local-Dev",
            "enableActionLogToDB": true,
            "enableActionLogToFile": true
        },
        {
            "serviceName": "RemoteCache-UnitTest-WebSocket",
            "remoteHostType": "WebSocket",
            "hostName": "Local-Dev",
            "enableActionLogToDB": true,
            "enableActionLogToFile": true
        },
        {
            "serviceName": "RemoteCache-UnitTest-gRPC",
            "remoteHostType": "gRPC",
            "hostName": "Local-Dev",
            "enableActionLogToDB": true,
            "enableActionLogToFile": true
        }
    ],
    "tcpSocketHostSettings": {
        "defaultHost": "Local-Dev",
        "hosts": [
            {
                "hostName": "Local-Dev",
                "tcpPort": 5592,
                "tcpBufferSizeKB": 5
            }
        ]
    },
    "webSocketHostSettings": {
        "defaultHost": "Local-Dev",
        "hosts": [
            {
                "hostName": "Local-Dev",
                "hostBaseUrl": "ws://0.0.0.0:5582"
            }
        ]
    },
    "gRPCHostSettings": {
        "defaultHost": "Local-Dev",
        "hosts": [
            {
                "hostName": "Local-Dev",
                "gRPCHostServer": "0.0.0.0",
                "port": 5555
            }
        ]
    }
}

Tag summary

Content type

Image

Digest

Size

64.3 MB

Last updated

almost 7 years ago

docker pull ponylin1985/zayni3.sharedata.service:3.3.19