deploy.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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=8080/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=6379/tcp --permanent
  15. firewall-cmd --add-port=3306/tcp --permanent
  16. firewall-cmd --add-port=9100/tcp --permanent
  17. firewall-cmd --add-port=9200/tcp --permanent
  18. firewall-cmd --add-port=9201/tcp --permanent
  19. firewall-cmd --add-port=9202/tcp --permanent
  20. firewall-cmd --add-port=9203/tcp --permanent
  21. firewall-cmd --add-port=9300/tcp --permanent
  22. service firewalld restart
  23. }
  24. # 启动基础环境(必须)
  25. base(){
  26. docker-compose up -d ruoyi-mysql ruoyi-redis ruoyi-nacos
  27. }
  28. # 启动程序模块(必须)
  29. modules(){
  30. docker-compose up -d ruoyi-ui ruoyi-gateway ruoyi-system
  31. }
  32. # 关闭所有环境/模块
  33. stop(){
  34. docker-compose stop
  35. }
  36. # 删除所有环境/模块
  37. rm(){
  38. docker-compose rm
  39. }
  40. rm_data(){
  41. rm -rf mysql/data
  42. rm -rf nacos/logs
  43. rm -rf redis/data
  44. rm -rf nginx/logs
  45. rm -rf ruoyi/gateway/jar/gateway.jar
  46. rm -rf ruoyi/modules/file/jar/service-file.jar
  47. rm -rf ruoyi/modules/gen/jar/service-gen.jar
  48. rm -rf ruoyi/modules/job/jar/service-job.jar
  49. rm -rf ruoyi/modules/system/jar/service-system-biz.jar
  50. rm -rf ruoyi/visual/monitor/jar/monitor.jar
  51. }
  52. # 根据输入参数,选择执行对应方法,不输入则执行使用说明
  53. case "$1" in
  54. "port")
  55. port
  56. ;;
  57. "base")
  58. base
  59. ;;
  60. "modules")
  61. modules
  62. ;;
  63. "stop")
  64. stop
  65. ;;
  66. "rm")
  67. rm
  68. ;;
  69. "rm_data")
  70. rm_data
  71. ;;
  72. *)
  73. usage
  74. ;;
  75. esac