最新【阿里云系列】-基于云效构建部署NodeJS项目到ACK_云效 node,拥有百万粉丝的大牛讲述学前端的历程

最后

总的来说,面试官要是考察思路就会从你实际做过的项目入手,考察你实际编码能力,就会让你在电脑敲代码,看你用什么编辑器、插件、编码习惯等。所以我们在回答面试官问题时,有一个清晰的逻辑思路,清楚知道自己在和面试官说项目说技术时的话就好了

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

EXPOSE 80 443
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
CMD [“/entrypoint.sh”]


#### 02.编写nginx配置文件(nginx-prod.conf)



gzip on;
gzip_disable “msie6”;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml text/html;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;

server {
listen 8080 default_server;
server_tokens off;

server_name order.test.com.cn;

将该服务下的所有请求实体的大小限制为50m

client_max_body_size 50m;

root /usr/share/nginx/html;

index /test-web/index.html;

location ~ ^/(css|js)/ {
# These assets include a digest in the filename, so they will never change
expires max;
}

location @router {
rewrite ^.*$ /test-web/index.html last;
}

location ~* ^.+.(html|htm)$ {
# Very short caching time to ensure changes are immediately recognized
expires 5m;
}

location /api/v1/ {
proxy_pass http://192.168.10.41/;#后端api网关服务在ACK中的集群IP
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location / {
add_header Cache-Control “no-cache, no-store”;
add_header X-Frame-Options “DENY”;
add_header X-Content-Type-Options “nosniff”;
add_header ‘Access-Control-Allow-Origin’ “https://order.test.com.cn”;
add_header ‘Access-Control-Allow-Credentials’ ‘true’;
add_header Access-Control-Allow-Methods “GET,POST,PUT,DELETE , OPTIONS”; # 添加允许的请求方法
add_header ‘Access-Control-Allow-Headers’ *;
# add_header Content-Security-Policy “default-src ‘self’;https://legit1.com https://legit2.com; report-uri /reportingurl;”;
add_header Content-Security-Policy “default-src ‘self’;” always;
try_files $uri $uri/ @router;
}
}


#### 03. 编写启动nginx文件(entrypoint.sh)



#!/bin/sh

Replace env vars in JavaScript files

#echo “Replacing env vars in JS”
#for file in /usr/share/nginx/html/js/app.*.js;
#do

echo “Processing $file …”;

# Use the existing JS file as template

if [ ! -f $file.tmpl.js ]; then

cp $file $file.tmpl.js

fi

envsubst ‘ V U E _ A P P _ B A C K E N D _ H O S T , VUE\_APP\_BACKEND\_HOST, VUE_APP_BACKEND_HOST,VUE_APP_MATOMO_HOST,$VUE_APP_MATOMO_ID’ < $file.tmpl.js > $file

#done

echo “Starting Nginx”
nginx -g ‘daemon off;’


#### 04.编写部署ack的yaml文件



apiVersion: apps/v1
kind: Deployment
metadata:
name: test-web
namespace: prod
labels:
app: test-web
spec:
replicas: 1
selector:
matchLabels:
app: test-web
template:
metadata:
labels:
app: test-web
spec:
containers:
- name: test-web
image: registry-vpc.cn-shanghai.aliyuncs.com/prod-acr/test-web:${IMAGE-TAG}
ports:
- containerPort: 8080

resources:

limits:

cpu: “500m”


apiVersion: v1
kind: Service
metadata:
name: test-web
namespace: prod
labels:
app: test-web
spec:
selector:
app: test-web
ports:

分享

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

//img-blog.csdnimg.cn/img_convert/173f06f98b5862f7043f8d2121d6c595.png)

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值