Sign inSign up

ponylin1985/webapi3.test

By ponylin1985

•Updated almost 7 years ago

Image
0

87

ponylin1985/webapi3.test repository overview

This is a ASP.NET Core and Zayni Framework web api application docker image for testing.

If you want to know more about Zayni Framework. You can go to ZayniFramework's gitlab⁠ project.

⁠Run the docker container (with docker run)
  • Put the config files (WebAPI.Test.dll.config, serviceHostConfig.json, serviceClientConfig.json) in your computer.
    • You can download the config file from gitlab.
    • Use git clone https://gitlab.com/ponylin1985/ZayniFramework.git to get the config files.
    • In the Readme.md⁠ file, section The Performance Test Report about the Middle.Service module. You can find more detail about the configuration files.
  • Open you terminal.
  • Run the command. docker pull ponylin1985/webapi.test:alpine-x64
  • Run the command. docker run -d -v /YourConfigurationPath:/app/Configs -p 5590:5590 -p 5580:5580 -p 2221:2221 -p 1110:1110 -p 5000:5000 ponylin1985/webapi.test:alpine-x64
⁠Use the docker-compose to run the docker container
version: "3"

services:
  api-service-host:
    image: "webapi.test:alpine-x64"
    volumes:
      # Configuration Path. Change the left-side path if you want to.
      - ~/GitRepo/MyGitLab/ZayniFramework/Test/WebAPI.Test/Configs:/app/Configs

      # File Log Path. Change the left-side path if you want to.
      - ~/ApplicationLog/WebAPI.Test:/app/Log
    ports:
      - 1110:1110   # gRPC Host Service Port
      - 5590:5590   # TCPSocket Host Port
      - 5580:5580   # WebSocket Host Port
      - 5000:5000   # ASP.NET Core Http Port
      - 5100:5100   # HttpCore Host Port
      - 2221:2221   # Remote Telnet Command Service Port
    container_name: zayni.webapi.test.alpine
⁠Configuration Example
⁠WebAPI.Test.dll.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="ZayniFramework" type="ZayniFramework.Common.ZayniConfigSection, ZayniFramework.Common"/>
    </configSections>
    <ZayniFramework>
        <LoggingSettings eventLogEnable="false" logEnable="true">
            <DefaultTextLogger>
                <add name="_DefaultLog" enable="true" maxSize="8" consoleOutput="true" consoleColor="Yellow">
                    <!-- ZayniFramework框架預設的文字日誌檔 -->
                    <LogFile path="Log/Zayni/Tracing.log"/>
                    <!-- <Filter filterType="deny" category="Information,Warning"/> -->
                </add>
                <add name="WebAPI.Test" enable="false" maxSize="8" consoleOutput="true" consoleColor="Yellow">
                    <!-- WebAPI.Test 的文字日誌檔 -->
                    <LogFile path="Log/Zayni/WebAPI.Test.log"/>
                    <!--<Filter filterType="deny" category="Information,Warning"/>-->
                </add>
                <add name="RedisCacheTrace" enable="false" maxSize="8">
                    <!-- ZaynigFramework Caching 模組對 Redis 請求回應的日誌紀錄 -->
                    <LogFile path="Log/Zayni/Redis.Tracing.Test.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/Middle.ServiceHost.Tracing.log"/>
                    <!-- <Filter filterType="deny" category="Information,Warning"/> -->
                </add>
                <add name="ServiceHostTrace:TCPSocketHost" enable="false" maxSize="8">
                    <!--ZaynigFramework Middle Service 的服務動作日誌記錄-->
                    <LogFile path="Log/Zayni/TCPSocketHost.Tracing.log"/>
                </add>
                <add name="ServiceHostActionLog" enable="true" maxSize="8" consoleOutput="true" consoleColor="Green">
                    <!-- ZaynigFramework Middle Service 的服務動作日誌記錄 -->
                    <LogFile path="Log/Zayni/ServiceHostAction.Tracing.log"/>
                    <!-- <Filter filterType="deny" category="Information,Warning"/> -->
                </add>
            </DefaultTextLogger>
        </LoggingSettings>
        <CachingSettings managerMode="memory">
            <CachePool resetEnable="true" cleanerIntervalSecond="5" maxCapacity="10000" refreshIntervalMinute="1"/>
            <CacheData timeoutInterval="1"/>
            <RedisCache>
                <add name="Local-Dev" isDefault="true" dbActionLog="false" host="localhost" port="6379" password="Admin123" dbNumber="10" responseTimeout="60000"/>
            </RedisCache>
        </CachingSettings>
        <DataAccessSettings>
            <DatabaseProviders>
                <add name="Zayni" dataBaseProvider="MySQL" sqlLogEnable="true"/>
                <add name="ZayniUnitTest" dataBaseProvider="MySQL" sqlLogEnable="true"/>
            </DatabaseProviders>
        </DataAccessSettings>
    </ZayniFramework>
    <appSettings>
        <add key="TelnetServerPort" value="2221" />
        <add key="TelnetServerPassword" value="Admin123" />
    </appSettings>
    <connectionStrings>
        <add name="Zayni" connectionString="SERVER=localhost;DATABASE=zayni;UID=XXX;PASSWORD=XXXX;Allow User Variables=True;Charset=utf8;Convert Zero Datetime=True;SslMode=none"
             providerName="MySql.Data.MySqlClient"/>
        <add name="ZayniUnitTest" connectionString="SERVER=localhost;DATABASE=zayni;UID=XXX;PASSWORD=XXXX;Allow User Variables=True;Charset=utf8;Convert Zero Datetime=True;SslMode=none"
             providerName="MySql.Data.MySqlClient"/>
    </connectionStrings>
</configuration>
⁠serviceHostConfig.json
{
    "enableConsoleTracingLog": true,
    "serviceHosts": [
        {
            "serviceName": "WebAPI.Test.TCPSocket",
            "remoteHostType": "TCPSocket",
            "hostName": "Local-Dev",
            "enableActionLogToDB": true,
            "enableActionLogToFile": true
        },
        {
            "serviceName": "WebAPI.Test.WebSocket",
            "remoteHostType": "WebSocket",
            "hostName": "Local-Dev",
            "enableActionLogToDB": true,
            "enableActionLogToFile": true,
            "autoStart": true
        },
        {
            "serviceName": "WebAPI.Test.gRPC",
            "remoteHostType": "gRPC",
            "hostName": "Local-Dev",
            "enableActionLogToDB": true,
            "enableActionLogToFile": true,
            "autoStart": true
        },
        {
            "serviceName": "WebAPI.Test.RabbitMQ",
            "remoteHostType": "RabbitMQ",
            "hostName": "Local-Dev",
            "enableActionLogToDB": true,
            "enableActionLogToFile": true,
            "autoStart": false
        },
        {
            "serviceName": "WebAPI.Test.HttpCore",
            "remoteHostType": "HttpCore",
            "hostName": "Local-Dev",
            "enableActionLogToDB": true,
            "enableActionLogToFile": true,
            "autoStart": true
        }
    ],
    "gRPCHostSettings": {
        "defaultHost": "Local-Dev",
        "hosts": [
            {
                "hostName": "Local-Dev",
                "gRPCHostServer": "0.0.0.0",
                "port": 1110
            }
        ]
    },
    "tcpSocketHostSettings": {
        "defaultHost": "Local-Dev",
        "hosts": [
            {
                "hostName": "Local-Dev",
                "tcpMsgEndsWith": "u0003",
                "tcpPort": 5590,
                "whitelist": [],
                "tcpBufferSizeKB": 5
            }
        ]
    },
    "webSocketHostSettings": {
        "defaultHost": "Local-Dev",
        "hosts": [
            {
                "hostName": "Local-Dev",
                "hostBaseUrl": "ws://0.0.0.0:5580",
                "whitelist": []
            }
        ]
    },
    "rabbitMQSettings": {
        "defaultHost": "Local-Dev",
        "hosts": [
            {
                "hostName": "Local-Dev",
                "mbHost": "localhost",
                "mbPort": 5672,
                "mbUserId": "pony",
                "mbPassword": "Admin123",
                "mbVHost": "ZayniTest",
                "msgRoutingKey": "Event.Client.",
                "msgQueue": "Middle.Server.ListenClient.Msg",
                "rpcQueue": "Middle.Server.RPC",
                "rpcRoutingKey": "RPC.Server.",
                "publishDefaultExchange": "Middle.Test.Topic",
                "publishExchange": "Middle.Test.Topic",
                "publishRoutingKey": "Event.Server."
            }
        ]
    },
    "httpCoreSettings": {
        "hosts": [
            {
                "hostName": "Local-Dev",
                "hostBaseUrl": "http://0.0.0.0:5100"
            }
        ]
    }
}
⁠serviceClientConfig.json
{
    "serviceClients": [
        {
            "serviceClientName": "ServiceHost.Test.Client.XXX",
            "remoteServiceName": "WebAPI.Test.TCPSocket",
            "remoteHostType": "InProcess",
            "enableActionLogToDB": true
        },
        {
            "serviceClientName": "ServiceHost.Test.Client",
            "remoteServiceName": "ServiceHost.Test.WebSocket",
            "remoteHostType": "WebSocket",
            "remoteClient": "Local-Dev",
            "enableActionLogToDB": true
        }
    ],
    "tcpSocketProtocol": {
        "defaultRemoteClient": "Local-Dev",
        "remoteClients": [
            {
                "name": "Local-Dev",
                "tcpServerHost": "localhost",
                "tcpServerPort": 5591,
                "tcpSendBufferSize": 5,
                "tcpReceiveBufferSize": 5,
                "connectionTimeout": 2,
                "tcpResponseTimeout": 1
            }
        ]
    },
    "webSocketProtocol": {
        "defaultRemoteClient": "Local-Dev",
        "remoteClients": [
            {
                "name": "Local-Dev",
                "webSocketHostBaseUrl": "ws://localhost:5581",
                "wsResponseTimeout": 5
            }
        ]
    },
    "gRPCProtocol": {
        "remoteClients": [
            {
                "name": "Local-Dev",
                "serverHost": "localhost",
                "serverPort": 1111
            }
        ]
    }
}

Tag summary

Content type

Image

Digest

Size

72.8 MB

Last updated

almost 7 years ago

docker pull ponylin1985/webapi3.test:alpine-x64