新增Docker

This commit is contained in:
wenyongda 2022-11-22 13:14:34 +08:00
parent 92615012d8
commit ad20c63e55
8 changed files with 216 additions and 1 deletions

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM nginx:1.23.2
COPY public/ /usr/share/nginx/html/deploy/
COPY nginx.conf /etc/nginx/nginx.conf
COPY conf.d/ /etc/nginx/conf.d/
COPY cert/ /usr/local/nginx/cert/

63
conf.d/default.conf Normal file
View File

@ -0,0 +1,63 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html/dist;
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 /usr/share/nginx/html;
#}
location /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://120.46.194.61:7274/api;
}
# 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;
#}
}
server {
listen 80;
location / {
#网站主页路径。此路径仅供参考,具体请您按照实际目录操作。
#例如,您的网站主页在 Nginx 服务器的 /etc/www 目录下,则请修改 root 后面的 html 为 /etc/www。
root /usr/share/nginx/html/deploy;
index index.html index.htm;
}
}

33
nginx.conf Normal file
View File

@ -0,0 +1,33 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}

View File

@ -282,7 +282,14 @@ docker search jenkins
![image-20221121125608385](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20221121125608385.png)
拉取镜像
```shell
docker pull jenkins/jenkins
```
查看镜像
```shell
docker images
```
@ -292,6 +299,8 @@ docker images
启动镜像
```shell
cd /usr/local
mkdir jenkins_home
docker run -d -uroot -p 8889:8080 -p 50000:50000 --name jenkins -v /usr/bin/docker:/usr/bin/docker -v /var/run/docker.sock:/var/run/docker.sock -v /etc/sysconfig/docker:/etc/sysconfig/docker -v /usr/local/jenkins_home:/var/jenkins_home -v /etc/localtime:/etc/localtime jenkins/jenkins
```
@ -303,7 +312,28 @@ docker logs jenkins
![image-20221121131635658](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20221121131635658.png)可以找到初始密码
## docker安装Nginx
```shell
docker image build -f ./XiaodaERP/Dockerfile -t aspnetcore .
docker pull nginx
docker run -d -p 80:80 -p 443:443 --name nginxweb --privileged=true
-v /usr/local/nginx/html/:/usr/share/nginx/html
-v /usr/local/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
-v /usr/local/nginx/conf/conf.d:/etc/nginx/conf.d
-v /usr/local/nginx/logs:/var/log/nginx nginx
ps aux | grep "nginx: worker process" | awk '{print $1}'
```
## docker安装SQL Server
```shell
mkdir /etc/sqlserver_data
chmod -R 777 /etc/sqlserver_data
docker pull mcr.microsoft.com/mssql/server
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=Wyd210213" -p 1433:1433 --memory 2000M --name sqlserver2022 -v /etc/sqlserver_data:/var/opt/mssql -d mcr.microsoft.com/mssql/server
```

View File

@ -89,3 +89,36 @@ IIS服务器应用程序池必须为无代码托管
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>![1668787835347](http://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/1668787835347.png)
```
在模块中删除WebDAVModule
## Jenkins安装NodeJS环境
在Jenkins 系统管理中 插件管理 可用插件中安装`NodeJS Plugin`
并在系统管理中 全局工具配置中配置NodeJS
![image-20221122094753314](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20221122094753314.png)
## 部署.Net Core 至 Docker容器
## Windows Server 部署Vue
### 本地Nginx
```shell
yarn
yarn build
# 删除文件夹
rmdir /q /s C:\Program" "Files\nginx-1.23.2\html\dist
# 复制文件夹到指定目录
xcopy /y /e /i C:\Users\Administrator\Documents\source\XiaoDaERP-Vben\dist C:\Program" "Files\nginx-1.23.2\html\dist
```
Linux远程服务器
```shell
# 发送文件文件夹到Linux远程服务器上
pscp -r -l root -pw Wyd210213 C:\Users\Administrator\Documents\source\XiaoDaERP-Vben\dist 8.140.174.251:/usr/local/nginx/html
```

View File

@ -542,3 +542,42 @@ sudo yum install dotnet-sdk-6.0
dotnet --info
```
## 安装Node.js
从官网下载Node.js安装包
地址:[Download | Node.js (nodejs.org)](https://nodejs.org/en/download/)
![image-20221122084035020](https://markdownhexo.oss-cn-hangzhou.aliyuncs.com/img/image-20221122084035020.png)
上传
```shell
# 解压
tar -xvf node-v18.12.1-linux-x64.tar.xz
# 重命名为nodejs
mv node-v18.12.1-linux-x64 nodejs
# 移动到指定目录
mv nodejs /usr/local
# 软链接方式让npm和node命令全局生效
ln -s /usr/local/nodejs/bin/npm /usr/local/bin/
ln -s /usr/local/nodejs/bin/node /usr/local/bin/
# or 加入环境变量
vim /etc/profile
# 加入下面行
export PATH=$PATH:/usr/local/nodejs/bin
# 查看nodejs是否安装成功
node -v
npm -v
# 如果报错
wget https://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz
tar -zxvf glibc-2.17.tar.gz
cd glibc-2.17
mkdir build
cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin #安装 make && make install
docker run -itd --name nodejs -v /usr/local/bin/npm:/usr/local/bin/npm n
```

View File

@ -0,0 +1,12 @@
# SQL Server
## 建库字符集问题
```sql
ALTER DATABASE ACT_DEV SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
ALTER DATABASE ACT_DEV COLLATE Chinese_PRC_CI_AS;
ALTER DATABASE ACT_DEV SET MULTI_USER;
```