dsiuy42084 2019-04-21 09:38
浏览 51
已采纳

长时间运行的UI和API问题[关闭]

I have a web app that grabs an Apache 'access.conf' file from internal GitHub, and then sends it via an HTTPS type of authenticated request to our server farm in a temporary dir.

When the file gets to Server 1. A few things are done: 1. Via a script, existing access.conf is renamed to access.conf.back, and new file is moved in its place from temp to /etc/httpd/conf.d. 2. File is tested via apachectl -t 3. If the check fails, it means, a restart of apache gracefully will not succeed, therefore, do not reload, and move old file into place, and go to step 6. 5. If the check is passed, do: apachectl -k graceful 6. Go to next step for each server in list

This is all OK, but I need some direction from experienced web developers on how to show this in a nice table with a green tick mark for "good", and a red cross for "bad".

How would I go about displaying the status of the above three steps, plus the "deployment" of access.conf to the server, so that'd be three operations, "file sent," "file checked", "server restarted." This should all be in real time.

API: /deployfile/access.conf Now that's what I've been asked to do for the WebUI. I also have a ReST API which also does the deployment part. It would take the request, and do it. And store the result in a table, and return a unique transaction id.

API: /deployfile/status/id For the Status API, from above, it would display the deployment results in a JSON object taken from a transaction table.

API: /restartservices/id Finally, the restarting of Apache would also be an API, and after each restart, it would wait a few minutes for the load balancer to see that its healthy again, and then go to the next server. This would be done in another thread, as it would be time consuming.

API: /restartservices/status/id Again, display the results in JSON.

So anyhow, I am familiar with Vue, but wanted how this is done properly in the industry?

I may be over-thinking this, but better to ask.

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • douping4436 2019-04-23 17:37
    关注

    Use Server Side Events. There are many libraries for Go that do this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划