GitBash 的 shell 命令行工具,可以试用grep命令过滤:

注意,需要把 adb.exe 添加到环境变量中,如下:

Snipaste_2023-10-12_14-16-36.png

1
2
3
4
5
6
7
8
9
10
11
12
# 产设备列表
adb.exe devices

# 显示手机已安装应用目录
# -s 设备名
adb.exe -s 340782513600AP8 shell pm list packages -3

# 过滤com.test.masablazorapp包日志
adb.exe -s 340782513600AP8 logcat | grep com.test.masablazorapp

# 把日志保存到指定目录
adb.exe -s 340782513600AP8 logcat -v time > e:\log.txt *:E
阅读全文 »

方法1

Snipaste_2023-10-08_15-32-57.png

加载 PuTTYgen生成的私钥,导出openssh的秘钥:

Snipaste_2023-10-08_15-34-10.png

保存文件名为id_rsa的文件,不需要拓展名(保存到 c:\用户\用户名\.ssh,即Git默认的ssh存储地址)

保存公钥:将配置 TortoiseGit 密钥时的公钥,复制一份,保存到c:\用户\用户名\.ssh,命名为id_rsa.pub。当然也可以就着上一步私钥转换的时候,直接保存公钥到默认文件夹。

这样,相当于配置了一回 Git 的 SSH (不通过 ssh-keygen -t rsa-C “邮箱” 命令配置,而是通过 PuTTYgen 将 TortoiseGit 的密钥转换成合适的格式) ,让 openSSH 与 PuTTY 使用相同的密钥,Git Bash 使用 openSSH 连接,而 TortoiseGit 使用 PuTTY 连接,互相不干扰。

方法2

TortoiseGit–> Settings,将Network(网络)中的SSH client(SSH客户端)改为Git目录下的ssh.exe(C:\Program Files\Git\usr\bin)。

Snipaste_2023-10-08_15-50-28.png

方法3

重新运行向导

C:\Program Files\Git\usr\bin

配置多个ssh

找到 C:\Program Files\Git\etc\ssh目录,找到 ssh_config,在文件最后一行添加:

1
2
3
4
5
6
7
Host github.com
User syxdevcode
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_rsa
ServerAliveInterval 300
ServerAliveCountMax 10

错误排查

no matching host key type found. Their offer: ssh-rsa,ssh-dss

找到 C:\Program Files\Git\etc\ssh目录,找到 ssh_config,在文件最后一行添加

1
2
3
4
Host *
KexAlgorithms +diffie-hellman-group1-sha1
HostkeyAlgorithms +ssh-dss,ssh-rsa
PubkeyAcceptedKeyTypes +ssh-dss,ssh-rsa

Powershell脚本

在服务器创建 deploy.ps1 powershell脚本,具体代码如下:
注意:前端代码的备份文件夹的上级目录需要手动创建一次。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
## IIS站点发布
cd "D:\Git\workspace\mywebsite\Admin.NET"
dotnet publish -p:PublishDir=D:\Git\publish\mywebsite --arch x64
$website="mywebsiteApiNew" # 站点名称
$sourceFolder='D:\Git\publish\mywebsite' # 发布的源文件路径
$url="10.10.0.3"
$port="8100"
$username="test" #需要在IIS管理用户中进行创建
$password="123123"
$webDeployFolder='C:\Program Files\IIS\Microsoft Web Deploy V3'
$msdeploy=Join-Path -Path $webDeployFolder -ChildPath "msdeploy.exe"
$scriptFolder=Join-Path -Path $webDeployFolder -ChildPath "Scripts"
cd "$scriptFolder"
. .\BackupScripts.ps1
# Turns on all backup functionality
TurnOn-Backups -On $true # 启用备份
# Turns off all backup functionality
# TurnOn-Backups -On $false # 关闭备份
# Changes default global backup behavior to enabled
Configure-Backups -Enabled $true
# Changes default backup behavior for site to enabled
Configure-Backups -SiteName "$website" -Enabled $true
# Changes the path of where backups are stored to a sibling directory named "siteName_snapshots".
# For more information about path variables, see the "backupPath" attribute in the section
# "Configuring Backup Settings on the Server for Global usage manually in IIS Config"
Configure-Backups -BackupPath "{SitePathParent}\{siteName}_snapshots"
# 最大备份文件数 Configures default backup limit to 5 backups
Configure-Backups -NumberOfBackups 8
# Configures sync behavior to fail if a sync fails for any reason
Configure-Backups -ContinueSyncOnBackupFailure $false
# Adds providers to skip when performing a backup
Configure-Backups -AddExcludedProviders @("dbmysql","dbfullsql")
# StopAppPool:
& $msdeploy -verb:sync -allowUntrusted -source:recycleApp -dest:recycleApp="$website",recycleMode="StopAppPool",computerName="https://${url}:${port}/msdeploy.axd?site=$website",username="$username",password="$password",AuthType="Basic"
# sync
& $msdeploy -verb:sync -allowUntrusted -source:contentPath=$sourceFolder -dest:contentPath="$website/",computerName="https://${url}:${port}/msdeploy.axd?site=$website",username="$username",password="$password",AuthType="Basic" -skip:objectName=dirPath,absolutePath='Configuration' -skip:objectName=dirPath,absolutePath='logs'
# StartAppPool:
& $msdeploy -verb:sync -allowUntrusted -source:recycleApp -dest:recycleApp="$website",recycleMode="StartAppPool",computerName="https://${url}:${port}/msdeploy.axd?site=$website",username="$username",password="$password",AuthType="Basic"
# 前端站点发布
# vue nginx 站点发布
$baseDir="D:\Git\workspace\mywebsite\Web"
& cd $baseDir
& yarn build
$sourceFolder=Join-Path -Path $baseDir -ChildPath "dist" # 源文件
$webSiteFolder="D:\WebSite\mywebsiteNew" # 站点根目录
$webSiteFolder
$destFolder=Join-Path -Path $webSiteFolder -ChildPath "web" # 手动创建web目录
$destFolder
$backFolder=Join-Path -Path $webSiteFolder -ChildPath "web_back" # 手动创建web_back目录
$backFolder
$now=Get-Date -Format "yyyy-MM-dd_HHmmss"
$backFileName=-join ($now,".zip")
$fullFolder=Join-Path -Path $backFolder -ChildPath $backFileName
Compress-Archive -Path $destFolder -DestinationPath $fullFolder -Force # 1,备份成压缩包
$removeFolder=-join($destFolder,"\*")
Remove-Item $removeFolder -Recurse -Force # 2,删除 原站点 所有文件/文件夹
$fullSourceFolder=-join ($sourceFolder,"\*")
Copy-Item -Path $fullSourceFolder -Destination $destFolder -Recurse # 3,复制新文件

在 Jenkins => Build Steps 中配置 PowerShell脚本如下:

1
2
3
4
$webSiteFolder="D:\Git\workspace\mywebsite" # 站点根目录
$webSiteFolder
& cd $webSiteFolder
. .\deploy.ps1

PowerShell脚本

脚本中使用到了 yarn 工具,需要提前在系统中安装。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# vue nginx 站点发布
$baseDir="D:\Git\workspace\mywebsite\Web"
& cd $baseDir
& yarn build
$sourceFolder=Join-Path -Path $baseDir -ChildPath "dist" # 源文件
$webSiteFolder="D:\WebSite\mywebsite" # 站点根目录
$webSiteFolder
$destFolder=Join-Path -Path $webSiteFolder -ChildPath "web" # 手动创建web目录
$destFolder
$backFolder=Join-Path -Path $webSiteFolder -ChildPath "web_back" # 手动创建web_back目录
$backFolder
$now=Get-Date -Format "yyyy-MM-dd_HHmmss"
$backFileName=-join ($now,".zip")
$fullFolder=Join-Path -Path $backFolder -ChildPath $backFileName
Compress-Archive -Path $destFolder -DestinationPath $fullFolder -Force # 1,备份成压缩包
$removeFolder=-join($destFolder,"\*")
Remove-Item $removeFolder -Recurse -Force # 2,删除 原站点 所有文件/文件夹
$fullSourceFolder=-join ($sourceFolder,"\*")
Copy-Item -Path $fullSourceFolder -Destination $destFolder -Recurse # 3,复制新文件

参考:

使用PowerShell压缩和解压ZIP包

配置Windows Server服务器

安装.NET SDK

在服务器上下载安装 .NET SDK。

下载地址: 下载 .NET 6.0

安装WebDeploy

下载地址:web-deploy下载

通过选择“自定义”选项来激活“IIS 部署处理程序”功能。

Snipaste_2023-08-19_14-09-17.png

WebDeploy默认监听8172端口,可以按照以下操作自定义端口号:

Snipaste_2023-08-19_14-11-13.png

先停止服务,然后在修改端口,之前启动即可。

Snipaste_2023-08-19_14-11-59.png

阅读全文 »

简介

Jenkins是一个开源的、提供友好操作界面的持续集成(CI)工具,起源于Hudson(Hudson是商用的),主要用于持续、自动的构建/测试软件项目、监控外部任务的运行。Jenkins用Java语言编写,可在Tomcat等流行的servlet容器中运行,也可独立运行。通常与版本管理工具(SCM)、构建工具结合使用。常用的版本控制工具有SVN、GIT,构建工具有Maven、Ant、Gradle。

阅读全文 »

HTTP content-type

Content-Type(内容类型),一般是指网页中存在的 Content-Type,用于定义网络文件的类型和网页的编码,决定浏览器将以什么形式、什么编码读取这个文件,这就是经常看到一些 PHP 网页点击的结果却是下载一个文件或一张图片的原因。

Content-Type 标头告诉客户端实际返回的内容的内容类型。

语法格式:

Content-Type: text/html; charset=utf-8
Content-Type: multipart/form-data; boundary=something

阅读全文 »

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
upstream apiclusterhealthy{
server 10.10.0.17:30000;
server 10.10.0.19:30000;
server 10.10.0.39:30000;

ip_hash;
}

map $http_connection $connection_upgrade {
"~*Upgrade" $http_connection;
default keep-alive;
}

## server 内配置
#
location /cloud/hubs/ {
proxy_pass http://apiclusterhealthy; #转发请求的地址
rewrite ^/cloud/(.*)$ /$1 break;

# include /etc/nginx/nginxconfig.io/proxy.conf;
# Configuration for WebSockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_cache off;
# WebSockets were implemented after http/1.0
proxy_http_version 1.1;

# Configuration for ServerSentEvents
proxy_buffering off;

# Configuration for LongPolling or if your KeepAliveInterval is longer than 60 seconds
proxy_read_timeout 100s;

proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
阅读全文 »

配置

创建外部网络

如果没有外部网络,需要运行以下命令创建:

1
2
3
4
5
# 查看网络列表
docker network ls

# 创建网络
docker network create --driver bridge --subnet 10.10.13.0/24 --gateway 10.10.13.1 docker_compose_net

配置文件

创建目录:

1
mkdir -p nginx-proxy-manager/data nginx-proxy-manager/letsencrypt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
version: '3.8'

networks:
default:
external:
name: docker_compose_net

services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: unless-stopped
container_name: nginx-proxy-manager
ports:
- '9850:80'
- '9851:81'
- '9843:443'
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
1
2
3
4
5
6
7
8
9
10
11
# 启动
docker-compose -f /opt/nginx-proxy-manager/compose.yml up -d

# 重启
docker-compose -f /opt/nginx-proxy-manager/compose.yml restart

# 移除
docker-compose -f /opt/nginx-proxy-manager/compose.yml down -v

# 更新
docker-compose -f /opt/nginx-proxy-manager/compose.yml up -d --build

容器81端口为管理端口。

Default Admin User:

Email: admin@example.com
Password: changeme

参考:

https://github.com/NginxProxyManager/nginx-proxy-manager

一,快速启动

1,创建目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
mkdir -p /opt/consul/consul1/config
mkdir -p /opt/consul/consul1/data
mkdir -p /opt/consul/consul1/log

mkdir -p /opt/consul/consul2/config
mkdir -p /opt/consul/consul2/data
mkdir -p /opt/consul/consul2/log

mkdir -p /opt/consul/consul3/config
mkdir -p /opt/consul/consul3/data
mkdir -p /opt/consul/consul3/log

mkdir -p /opt/consul/consul4/config
mkdir -p /opt/consul/consul4/data
mkdir -p /opt/consul/consul4/log

# 授权
chmod 777 /opt/consul/consul1/config /opt/consul/consul1/data /opt/consul/consul1/log /opt/consul/consul2/config /opt/consul/consul2/data /opt/consul/consul2/log /opt/consul/consul3/config /opt/consul/consul3/data /opt/consul/consul3/log /opt/consul/consul4/config /opt/consul/consul4/data /opt/consul/consul4/log

2,配置yml文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
version: '3.5'

networks:
default:
external:
name: docker_compose_net

services:
consul1:
image: consul:latest
container_name: consul1
restart: unless-stopped
command: agent -server -client=0.0.0.0 -bootstrap-expect=3 -node=consul1
volumes:
- /opt/consul/consul1/data:/consul/data
- /opt/consul/consul1/config:/consul/config
- /opt/consul/consul1/log:/consul/log
consul2:
image: consul:latest
container_name: consul2
restart: unless-stopped
command: agent -server -client=0.0.0.0 -retry-join=consul1 -node=consul2
volumes:
- /opt/consul/consul2/data:/consul/data
- /opt/consul/consul2/config:/consul/config
- /opt/consul/consul2/log:/consul/log
consul3:
image: consul:latest
container_name: consul3
restart: unless-stopped
command: agent -server -client=0.0.0.0 -retry-join=consul1 -node=consul3
volumes:
- /opt/consul/consul3/data:/consul/data
- /opt/consul/consul3/config:/consul/config
- /opt/consul/consul3/log:/consul/log
consul4:
image: consul:latest
container_name: consul4
restart: unless-stopped
ports:
- 8500:8500
command: agent -client=0.0.0.0 -retry-join=consul1 -ui -node=client1
volumes:
- /opt/consul/consul4/data:/consul/data
- /opt/consul/consul4/config:/consul/config
- /opt/consul/consul4/log:/consul/log
阅读全文 »

1
docker run -d --restart=always --name="portainer" -p 9200:9000 -v /var/run/docker.sock:/var/run/docker.sock 6053537/portainer-ce

在浏览器打开 Host:9200,首次进入按照要求设置用户名,密码。

查看网络

1
iptables -L DOCKER

配置Docker

1
2
3
4
vim /etc/default/docker

#修改文件,此处设置等同于在创建容器时手动指定iptables=false参数
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 -iptables=false"
1
2
3
4
5
vim /etc/docker/daemon.json
{
"iptables": false
}
#此处对更改设置之前创建的容器也有效,编辑后需重启docker服务

重启docker服务

1
2
3
service docker start
service docker stop
service docker restart
阅读全文 »

构建Keycloak镜像

编写 Dockerfile 文件:

1
2
3
4
5
6
7
8
9
10
11
FROM quay.io/keycloak/keycloak:latest as builder

WORKDIR /opt/keycloak
# for demonstration purposes only, please make sure to use proper certificates in production instead
RUN keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -dname "CN=server" -alias server -ext "SAN:c=DNS:localhost,IP:127.0.0.1" -keystore conf/server.keystore
RUN /opt/keycloak/bin/kc.sh build

FROM quay.io/keycloak/keycloak:latest
COPY --from=builder /opt/keycloak/ /opt/keycloak/

ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]
1
docker build . -t mykeycloak:1.0.0
阅读全文 »

Alt + F1

命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 查看
esxcli storage

# 列出ESXi主机的所有LUN(逻辑单元)的路径信息
esxcli storage core path list

# 列出连接到ESXi的LUN列表
esxcli storage core device list

# 若要查询LUN的详细路径信息,可使用如下命令列出某个卷的信息。其中-d参数加上该lun的wwn号。
esxcli storage core path list -d naa.600b342a17eacb1d6e6bde340d0000d0

# 查询active总路径或单独某个lun的路径数量
esxcli storage core path list | grep “State: active” | wc -l

# 查询单独某个LUN的路径的数量,以LUN:2为例
esxcli storage core path list | grep “LUN: 2” | wc -l

# 查看系统版本
vmware -v

# 查看系统版本包括patch等信息
esxcli system version get

# 查看系统时间
esxcli system time get

# ESXi主机进入/退出,维护模式
esxcli system maintenanceMode set --enable true/false

# 系统重启/关机(必须处于维护模式,否则命令不生效)
esxcli system shutdown reboot/poweroff

# 查看接口ipv4地址
esxcli network ip interface ipv4 get

# 查看路由表
esxcli network ip route ipv4 list

# 查看ESXi主机网卡列表(nic)或up-link列表
esxcli network nic list

# 关闭/打开vmnic1接口
esxcli network nic down/up -n=vmnic1

阅读全文 »