Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

系统设计 memo #29

Open
bxb100 opened this issue Jan 2, 2023 · 4 comments
Open

系统设计 memo #29

bxb100 opened this issue Jan 2, 2023 · 4 comments
Labels
Horizon 视角

Comments

@bxb100
Copy link
Owner

bxb100 commented Jan 2, 2023

No description provided.

@bxb100 bxb100 added the Horizon 视角 label Jan 2, 2023
@bxb100
Copy link
Owner Author

bxb100 commented Jan 2, 2023

如何优化报表

问题来源: 求各位大佬给些报表优化的思路?

可能的解决方案

  • 使用 ETL, 通过 CDC1 来将数据转换到 ClickHouse 这种列式数据库或者计算放到缓存中, 然后报表请求到新的数据源中
  • 使用 PlanetScale Boost 类似的 readyset 中间件来缓存查询语句, 相当于实时更新 view 数据
  • 使用 Apache Flink 来实时转换数据, 然后直接存储对应聚合搜索的结果, 相当于运算放到 的地方去2
    • 阿里云有个最佳实践 link
  • 使用 Spark3

Footnotes

  1. https://debezium.io/

  2. https://nightlies.apache.org/flink/flink-docs-master/zh/docs/try-flink/table_api/

  3. https://www.youtube.com/watch?v=ChISx0-cMpU

@bxb100
Copy link
Owner Author

bxb100 commented Feb 5, 2023

如何自由的控制 env

看到 https://github.com/Infisical/infisical , 比较好奇它的运行机制. 然后发散性的想了一下, 如何接入 https://github.com/hashicorp/vault 做出同样效果: 将 vault 的秘钥注入到一个类似 python virtual env 中, 然后直接在这个环境中运行application, 通过环境变量获取秘钥(和 nix shell 一样)

下面这段代码是 infisical 的执行环境

func executeMultipleCommandWithEnvs(fullCommand string, secretsCount int, env []string) error {
	shell := [2]string{"sh", "-c"}
	if runtime.GOOS == "windows" {
		shell = [2]string{"cmd", "/C"}
	} else {
		currentShell := os.Getenv("SHELL")
		if currentShell != "" {
			shell[0] = currentShell
		}
	}

	cmd := exec.Command(shell[0], shell[1], fullCommand)
	cmd.Stdin = os.Stdin
	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr
	cmd.Env = env

	color.Green("Injecting %v Infisical secrets into your application process", secretsCount)
	log.Debugf("executing command: %s %s %s \n", shell[0], shell[1], fullCommand)

	return execCmd(cmd)
}

其实和 var=value cmd 差不多

@bxb100 bxb100 changed the title 系统设计 系统设计 memo Feb 7, 2023
@bxb100
Copy link
Owner Author

bxb100 commented Mar 2, 2023

如何在 iframe 中无感登录

来源: https://www.v2ex.com/t/920543

解决方式:

  • 使用同样的单点登录, 然后两个 web 都跳转并且 setCookie
  • 对于 a.d.c 和 b.d.c 使用 d.c 的 cookie
  • 前端使用 Event1 传递 iframe 可用的 token 但是要对 iframe 中网页可控)

Footnotes

  1. https://stackoverflow.com/questions/28672152/pass-an-event-to-an-iframe-from-the-parent-window-javascript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Horizon 视角
Projects
None yet
Development

No branches or pull requests

1 participant