Former-commit-id: 8ac42810283b761e55e05fcacc001220a3bfd484
TangShanKaiPing
wanggang 5 years ago
parent 1a50e3b67b
commit f00a3e1006

@ -0,0 +1,21 @@
1.nano /etc/rc.local
#https://linuxize.com/post/how-to-install-and-use-docker-compose-on-ubuntu-18-04/
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#echo `date +"%Y-%m-%d %H:%M:%S"` > /root/start.log
exit 0
2.chmod +x /etc/rc.local

@ -0,0 +1,3 @@
#this file contains services override for development only
#docker-compose up
version: "3.8"

@ -1,3 +1,5 @@
#this file contains the shard service for both development and production services
#nginx mysql srs influxdb
#https://docs.docker.com/compose/compose-file/
version: "3.8"
@ -10,14 +12,4 @@ services:
- ./nginx/conf/edusoa.key:/etc/nginx/edusoa.key
- ./nginx/conf/edusoa.pem:/etc/nginx/edusoa.pem
- ./nginx/log:/var/log/nginx
ports:
- 80:80
- 443:443
networks:
default:
ipv4_address: 172.16.0.10
networks:
default:
ipam:
config:
- subnet: 172.16.0.0/16
network_mode: "host"

@ -12,14 +12,13 @@ events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
types {
application/vnd.android.package-archive apk;
application/iphone pxl ipa;
text/plain plist;
text/plain plist;
}
sendfile on;
@ -27,16 +26,16 @@ http {
keepalive_timeout 65;
upstream go-fastdfs {
server 10.10.24.104:8180;
ip_hash;
}
server 10.10.24.104:8180;
ip_hash;
}
server {
listen 80;
listen 443 ssl;
server_name iot.edusoa.com;
#ssl on;
#ssl on;
ssl_certificate edusoa.pem;
ssl_certificate_key edusoa.key;
ssl_session_timeout 5m;

@ -0,0 +1,14 @@
usercenter:
image: mcr.microsoft.com/dotnet/core/runtime-deps:3.1-focal
volumes:
- ./UserCenter:/UserCenter
ports:
- 8010:8010
command: bash -c "
chmod +x /UserCenter/UserCenter
&& cd /UserCenter
&& ./UserCenter
"
networks:
default:
ipv4_address: 172.16.0.11

@ -1,64 +0,0 @@
using Application.Models;
using Infrastructure.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Raven.Embedded;
using System;
using System.Linq;
using UserCenter.Services;
namespace UserCenter.Controllers
{
public class MessageController : Controller
{
private readonly IHubContext<PageHub> _pageHubContext;
public MessageController(IHubContext<PageHub> pageHubContext)
{
this._pageHubContext = pageHubContext;
}
public IActionResult SendMessage(string content = "窗前明月光,疑是地上霜")
{
var message = new Message
{
Id = Guid.NewGuid().ToString(),
Type = "通知",
FromId = "admin",
FromName = "管理员",
ToId = "iot",
ToName = "智慧教室",
Content = content + DateTime.Now.Ticks,
Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds()
};
using (var store = EmbeddedServer.Instance.GetDocumentStore("Embedded"))
{
using (var session = store.OpenSession())
{
session.Store(message);
session.SaveChanges();
if (message.Type == "通知")
{
this._pageHubContext.Clients.All.SendAsync("receive", message);
}
}
}
return Json(message);
}
public IActionResult GetMessage(string toId, int pageIndex = 0, int pageSize = 20)
{
using (var store = EmbeddedServer.Instance.GetDocumentStore("Embedded"))
{
using (var session = store.OpenSession())
{
var list = session.Query<Message>()
.Where(o => o.Type == "通知" && o.ToId == toId)
.OrderByDescending(o => o.Timestamp)
.Paged(pageIndex, pageSize);
return Json(list);
}
}
}
}
}

@ -2,13 +2,9 @@ using Infrastructure.Data;
using Infrastructure.Email;
using Infrastructure.Sms;
using Infrastructure.Web;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Raven.Embedded;
using System;
namespace UserCenter
{
@ -16,7 +12,6 @@ namespace UserCenter
{
public Startup(IConfiguration configuration, IWebHostEnvironment env) : base(configuration, env)
{
EmbeddedServer.Instance.StartServer();
}
public override void ConfigureServices(IServiceCollection services)
@ -24,23 +19,9 @@ namespace UserCenter
services.AddTransient<IDbConfig, DbConfig>();
services.AddTransient<IRoleService, RoleService>();
services.AddTransient<IEmailSender, EmailSender>();
services.AddTransient<ISmsSender, EmptySmsSender>();
services.AddTransient<ISmsSender, NetEasySmsSender>();
//services.AddSingleton<FaceRecognitionService>();
base.ConfigureServices(services);
}
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
base.Configure(app, env, loggerFactory);
//app.ApplicationServices.GetRequiredService<FaceRecognitionService>();
}
public override void CreateDatabase(IServiceProvider services)
{
//if (this.env.IsDevelopment())
{
base.CreateDatabase(services);
}
}
}
}

@ -14,7 +14,6 @@
<PackageReference Include="AspNet.Security.OAuth.GitHub" Version="3.1.1" />
<PackageReference Include="AspNet.Security.OAuth.QQ" Version="3.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
<PackageReference Include="RavenDB.Embedded" Version="4.2.102" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />

@ -12,7 +12,6 @@ events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
@ -26,10 +25,10 @@ http {
keepalive_timeout 65;
upstream go-fastdfs {
server 10.10.24.104:8180;
ip_hash;
}
upstream go-fastdfs {
server 10.10.24.104:8180;
ip_hash;
}
server {
listen 80;
@ -45,6 +44,8 @@ http {
ssl_ciphers HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM;
ssl_prefer_server_ciphers on;
set $ip 'localhost';
location / {
#proxy_set_header Host $host:$server_port;
if ($http_user_agent ~* "(mobile|android|ipad|iphone|ipod|tablet)") {
@ -70,7 +71,7 @@ http {
}
location ^~ /UserCenter/ {
proxy_pass http://localhost:8010/UserCenter/;
proxy_pass http://[$ip]:8010/UserCenter/;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

@ -1,117 +0,0 @@
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Loading…
Cancel
Save