resource "google_cloudbuild_trigger""fluentd-bq-gar-trigger"{
name ="fluentd-bq-gar-trigger"# could not contains underscore
location = var.region_id
# when use github then should use trigger_template
github {
name ="fluentd-home"
owner ="nvd11"
push {
branch ="main"
invert_regex = false # means trigger on branch}}
filename ="cloudbuild-gar.yaml"# projects/jason-hsbc/serviceAccounts/[email protected]
service_account = data.google_service_account.cloudbuild_sa.id}
为fluentd 镜像构建编写cloudbuild yaml
cloudbuld-gar.yaml
# just to update the docker image to GAR with the pom.xml versionsteps:-id: prepare service acccount json key file
name: ubuntu # https://hub.docker.com/_/mavenentrypoint: bash
args:-'-c'-|
ls -l
echo $$FLUENTD_INGRESS_JASON_HSBC_KEY > fluentd-ingress-jason-hsbc.json
ls -l
cat ./fluentd-ingress-jason-hsbc.jsonsecretEnv:-'FLUENTD_INGRESS_JASON_HSBC_KEY'-id: build and push docker image
name:'gcr.io/cloud-builders/docker'entrypoint: bash
args:-'-c'-|
set -x
echo "Building docker image with tag: $_APP_TAG"
docker build -t $_GAR_BASE/$PROJECT_ID/$_DOCKER_REPO_NAME/${_APP_NAME}:${_APP_TAG} .
docker push $_GAR_BASE/$PROJECT_ID/$_DOCKER_REPO_NAME/${_APP_NAME}:${_APP_TAG}logsBucket: gs://jason-hsbc_cloudbuild/logs/
options:# https://cloud.google.com/cloud-build/docs/build-config#optionslogging: GCS_ONLY # or CLOUD_LOGGING_ONLY https://cloud.google.com/cloud-build/docs/build-config#loggingavailableSecrets:secretManager:-versionName: projects/$PROJECT_ID/secrets/fluentd-ingress-jason-hsbc-key/versions/latest
env:'FLUENTD_INGRESS_JASON_HSBC_KEY'substitutions:_DOCKER_REPO_NAME: my-docker-repo
_APP_NAME: fluentd-bigquery
_APP_TAG: latest
_GAR_BASE: europe-west2-docker.pkg.dev
apiVersion: apps/v1
kind: Deployment
metadata:labels:# label of this deploymentapp: cloud-order # custom definedauthor: nvd11
name: deployment-cloud-order # name of this deploymentnamespace: default
spec:replicas:3# desired replica count, Please note that the replica Pods in a Deployment are typically distributed across multiple nodes.revisionHistoryLimit:10# The number of old ReplicaSets to retain to allow rollbackselector:# label of the Pod that the Deployment is managing,, it's mandatory, without it , we will get this error # error: error validating data: ValidationError(Deployment.spec.selector): missing required field "matchLabels" in io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector ..matchLabels:app: cloud-order
strategy:# Strategy of upodatetype: RollingUpdate # RollingUpdate or RecreaterollingUpdate:maxSurge: 25% # The maximum number of Pods that can be created over the desired number of Pods during the updatemaxUnavailable: 25% # The maximum number of Pods that can be unavailable during the updatetemplate:# Pod templatemetadata:labels:app: cloud-order # label of the Pod that the Deployment is managing. must match the selector, otherwise, will get the error Invalid value: map[string]string{"app":"bq-api-xxx"}: `selector` does not match template `labels`spec:# specification of the Podcontainers:-image: europe-west2-docker.pkg.dev/jason-hsbc/my-docker-repo/cloud-order:1.1.0 # image of the containerimagePullPolicy: Always
name: container-cloud-order
command:["bash"]args:-"-c"-|
java -jar -Dserver.port=8080 app.jar --spring.profiles.active=$APP_ENVIRONMENT --logging.file.name=/app/logs/app.logenv:# set env varaibles-name: APP_ENVIRONMENT # name of the environment variablevalue: prod # value of the environment variablevolumeMounts:# write log here-name: volume-log
mountPath: /app/logs/
readOnly:false# read only is set to falseports:-containerPort:8080name: cloud-order
-image: europe-west2-docker.pkg.dev/jason-hsbc/my-docker-repo/fluentd-bigquery:latest # image of the containerimagePullPolicy: Always
name: container-fluentd
command:["sh"]args:-"-c"-|
fluentd -c /app/config/fluentd.confvolumeMounts:# read log from here-name: volume-log
mountPath: /app/logs/
readOnly:false# read only is set to false-name: config-volume
mountPath: /app/config
readOnly:false# read only is set to falsevolumes:-name: volume-log
emptyDir:{}-name: config-volume
configMap:name: configmap-fluentd-cloud-order # name of the config mapitems:-key: fluent.conf # key of the config map itempath: fluentd.conf # name of the file, it will only contain the content of the keyrestartPolicy: Always # Restart policy for all containers within the PodterminationGracePeriodSeconds:10# The period of time in seconds given to the Pod to terminate gracefully
gateman@MoreFine-S500:emptydir$ bq query --nouse_legacy_sql'SELECT `timestamp`, message FROM `jason-hsbc`.LOGS.`cloud-order-logs` ORDER BY timestamp desc'
WARNING: This command is using service account impersonation. All API calls will be executed as [[email protected]].
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| timestamp | message |
+---------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|2024-09-08 19:33:14 |2024-09-08T19:33:13.058Z WARN 1 --- [main] JpaBaseConfiguration$JpaWebConfiguration: spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning ||2024-09-08 19:33:14 |2024-09-08T19:33:13.395Z INFO 1 --- [main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 4 endpoint(s) beneath base path '/actuator'||2024-09-08 19:33:14 |2024-09-08T19:33:13.459Z INFO 1 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080(http) with context path ''||2024-09-08 19:33:14 |2024-09-08T19:33:13.460Z INFO 1 --- [main] u.j.c.RefreshScopeRefreshedEventListener : Refreshing cached encryptable property sources on ServletWebServerInitializedEvent ||2024-09-08 19:33:14 |2024-09-08T19:33:13.461Z INFO 1 --- [main] CachingDelegateEncryptablePropertySource : Property Source commandLineArgs refreshed ||2024-09-08 19:33:14 |2024-09-08T19:33:13.461Z INFO 1 --- [main] CachingDelegateEncryptablePropertySource : Property Source systemProperties refreshed ||2024-09-08 19:33:14 |2024-09-08T19:33:13.461Z INFO 1 --- [main] CachingDelegateEncryptablePropertySource : Property Source systemEnvironment refreshed |...
终端仿真器是一款用其它显示架构重现可视终端的计算机程序。换句话说就是终端仿真器能使哑终端看似像一台连接上了服务器的客户机。终端仿真器允许最终用户用文本用户界面和命令行来访问控制台和应用程序。(LCTT 译注:终端仿真器原意指对大型机-哑终端方式的模拟,不过在当今的 Linux 环境中,常指通过远程或本地方式连接的伪终端,俗称“终端”。)
你能从开源世界中找到大量的终端仿真器,它们
功能:在控制台每秒输出一次
代码:
package Main;
import javax.swing.Timer;
import java.awt.event.*;
public class T {
private static int count = 0;
public static void main(String[] args){
1,获取样式属性值
top 与顶部的距离
left 与左边的距离
right 与右边的距离
bottom 与下边的距离
zIndex 层叠层次
例子:获取左边的宽度,当css写在body标签中时
<div id="adver" style="position:absolute;top:50px;left:1000p
spring data jpa 支持以方法名进行查询/删除/统计。
查询的关键字为find
删除的关键字为delete/remove (>=1.7.x)
统计的关键字为count (>=1.7.x)
修改需要使用@Modifying注解
@Modifying
@Query("update User u set u.firstna
项目中controller的方法跳转的到ModelAndView类,一直很好奇spring怎么实现的?
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* yo
(1)npm是什么
npm is the package manager for node
官方网站:https://www.npmjs.com/
npm上有很多优秀的nodejs包,来解决常见的一些问题,比如用node-mysql,就可以方便通过nodejs链接到mysql,进行数据库的操作
在开发过程往往会需要用到其他的包,使用npm就可以下载这些包来供程序调用
&nb
Controller层的拦截器继承于HandlerInterceptorAdapter
HandlerInterceptorAdapter.java 1 public abstract class HandlerInterceptorAdapter implements HandlerIntercep