Selaa lähdekoodia

添加 docker配置

zhulangren@gmail.com 3 vuotta sitten
vanhempi
commit
6c7ce20535

+ 24 - 0
docker/app/Configuration/Database.json

@@ -0,0 +1,24 @@
+{
+    "$schema": "https://gitee.com/dotnetchina/Furion/raw/net6/schemas/v3/furion-schema.json",
+
+    "DbConnection": {
+        // 具体配置见SqlSugar官网(第一个为默认库不需要设置ConfigId)
+        "ConnectionConfigs": [
+            {
+                "DbType": "MySql", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
+                "ConnectionString": "server=mysql;Database=admin;Uid=root;Pwd=root;",
+                "EnableInitDb": true, // 启用库表初始化
+                "EnableDiffLog": false, // 启用库表差异日志
+                "EnableUnderLine": true // 启用驼峰转下划线
+            },
+            {
+                "ConfigId": "test",
+                "DbType": "MySql",
+                "ConnectionString": "server=mysql;Database=test;Uid=root;Pwd=root;",
+                "EnableInitDb": true, // 启用库表初始化
+                "EnableDiffLog": false, // 启用库表差异日志
+                "EnableUnderLine": true // 启用驼峰转下划线
+            }
+        ]
+    }
+}

+ 46 - 0
docker/docker-compose.yml

@@ -0,0 +1,46 @@
+version: "3"
+
+services:
+  nginx:
+    image: nginx:1.20.2
+    ports:
+      - "9100:80"
+    volumes:
+      - "./nginx/dist:/usr/share/nginx/html"
+      - "./nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro"
+    links:
+      - adminNet
+  mysql:
+    image: mysql:5.7
+    ports:
+      - 9101:3306
+    restart: unless-stopped
+    privileged: true
+    ulimits:
+       nproc: 655350
+       nofile:
+         soft: 131072
+         hard: 400000
+    #healthcheck:
+    #  test: "/usr/bin/mysql --user=root --password=root --execute \"SHOW DATABASES;\""
+    #  interval: 10s # 间隔时间
+    #  timeout: 3s  # 超时时间
+    #  retries: 50   # 重试次数
+    environment:
+      MYSQL_ROOT_HOST: "%"
+      MYSQL_DATABASE: admin
+      MYSQL_ROOT_PASSWORD: root
+    volumes:
+      - ./mysql/mysql:/var/lib/mysql
+      - ./mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf
+  adminNet:
+    image: mcr.microsoft.com/dotnet/aspnet:6.0
+    ports:
+      - "9102:5050"
+    volumes:
+      - "./app:/app"
+    working_dir: /app
+    command: ["/app/wait-for-it.sh", "mysql:3306", "-t", "120", "--","dotnet", "Admin.NET.Web.Entry.dll"]
+    depends_on:
+      - mysql
+

+ 51 - 0
docker/mysql/mysql.cnf

@@ -0,0 +1,51 @@
+[client]
+default-character-set=utf8
+ 
+[mysqld]
+character-set-server=utf8
+log-bin=mysql-bin
+server-id=1
+pid-file        = /var/run/mysqld/mysqld.pid
+socket          = /var/run/mysqld/mysqld.sock
+datadir         = /var/lib/mysql
+sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
+symbolic-links=0
+secure_file_priv =
+wait_timeout=86400
+interactive_timeout=86400
+default-time_zone = '+8:00'
+skip-external-locking
+skip-name-resolve
+open_files_limit = 10240
+max_connections = 1000
+max_connect_errors = 6000
+table_open_cache = 800
+max_allowed_packet = 40m
+sort_buffer_size = 2M
+join_buffer_size = 1M
+thread_cache_size = 32
+query_cache_size = 64M
+transaction_isolation = READ-COMMITTED
+tmp_table_size = 128M
+max_heap_table_size = 128M
+log-bin = mysql-bin
+sync-binlog = 1
+binlog_format = ROW
+binlog_cache_size = 1M
+key_buffer_size = 128M
+read_buffer_size = 2M
+read_rnd_buffer_size = 4M
+bulk_insert_buffer_size = 64M
+lower_case_table_names = 1
+explicit_defaults_for_timestamp=true
+skip_name_resolve = ON
+event_scheduler = ON
+log_bin_trust_function_creators = 1
+innodb_buffer_pool_size = 512M
+innodb_flush_log_at_trx_commit = 1
+innodb_file_per_table = 1
+innodb_log_buffer_size = 4M
+innodb_log_file_size = 256M
+innodb_max_dirty_pages_pct = 90
+innodb_read_io_threads = 4
+innodb_write_io_threads = 4

+ 46 - 0
docker/nginx/conf/nginx.conf

@@ -0,0 +1,46 @@
+worker_processes  1;
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    include       mime.types;
+    default_type  application/octet-stream;
+    sendfile        on;
+    keepalive_timeout  65;
+
+    gzip on;
+    gzip_min_length  1k;
+    gzip_buffers     16 64K;
+    gzip_http_version 1.1;
+    gzip_comp_level 5;
+    gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
+    gzip_vary on;
+    gzip_proxied   expired no-cache no-store private auth;
+    gzip_disable   "MSIE [1-6]\.";
+
+    server {
+        listen       80;
+        server_name  localhost;
+        charset utf-8;
+
+        location / {
+            root   /usr/share/nginx/html;
+            try_files $uri $uri/ /index.html;
+            index  index.html index.htm;
+        }		
+        location /prod-api/ {
+            proxy_set_header Host $http_host;
+            proxy_set_header X-Real-IP $remote_addr;
+            proxy_set_header REMOTE-HOST $remote_addr;
+            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+            proxy_pass http://adminNet:5050/;
+        }
+
+        error_page   500 502 503 504  /50x.html;
+        location = /50x.html {
+            root   html;
+        }
+    }
+}