deploy.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. # 使用说明,用来提示输入参数
  3. usage() {
  4. echo "Usage: sh 执行脚本.sh [port|base|modules|stop|rm]"
  5. exit 1
  6. }
  7. # 开启所需端口
  8. port(){
  9. firewall-cmd --add-port=80/tcp --permanent
  10. firewall-cmd --add-port=38080/tcp --permanent
  11. firewall-cmd --add-port=8848/tcp --permanent
  12. firewall-cmd --add-port=9848/tcp --permanent
  13. firewall-cmd --add-port=9849/tcp --permanent
  14. firewall-cmd --add-port=9999/tcp --permanent
  15. firewall-cmd --add-port=6379/tcp --permanent
  16. firewall-cmd --add-port=3306/tcp --permanent
  17. firewall-cmd --add-port=39100/tcp --permanent
  18. firewall-cmd --add-port=39200/tcp --permanent
  19. firewall-cmd --add-port=39201/tcp --permanent
  20. firewall-cmd --add-port=39202/tcp --permanent
  21. firewall-cmd --add-port=39203/tcp --permanent
  22. firewall-cmd --add-port=39300/tcp --permanent
  23. firewall-cmd --add-port=39204/tcp --permanent
  24. service firewalld restart
  25. }
  26. # 启动基础环境(必须)
  27. base(){
  28. docker-compose up -d vctgo-mysql vctgo-redis vctgo-nacos
  29. }
  30. # 启动程序模块(必须)
  31. modules(){
  32. docker-compose up -d vctgo-nginx vctgo-gateway vctgo-auth vctgo-system vctgo-gen vctgo-file vctgo-monitor vctgo-demo vctgo-job
  33. }
  34. # 关闭所有环境/模块
  35. stop(){
  36. docker-compose stop
  37. }
  38. # 删除所有环境/模块
  39. rm(){
  40. docker-compose rm
  41. }
  42. # 根据输入参数,选择执行对应方法,不输入则执行使用说明
  43. case "$1" in
  44. "port")
  45. port
  46. ;;
  47. "base")
  48. base
  49. ;;
  50. "modules")
  51. modules
  52. ;;
  53. "stop")
  54. stop
  55. ;;
  56. "rm")
  57. rm
  58. ;;
  59. *)
  60. usage
  61. ;;
  62. esac