From 0d8ff4771d6b89d70e4c5ba108aabf314c586487 Mon Sep 17 00:00:00 2001 From: ykxiao Date: Fri, 4 Aug 2023 10:32:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=AC=E5=9C=B0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 46 ++++++++++++++----- gitea/Dockerfile | 2 + nginx/sites/mes-swoole-api.conf.back | 45 ++++++++++++++++++ .../supervisord.d/laravel-worker.conf.example | 7 +-- 4 files changed, 86 insertions(+), 14 deletions(-) create mode 100644 gitea/Dockerfile create mode 100644 nginx/sites/mes-swoole-api.conf.back diff --git a/docker-compose.yml b/docker-compose.yml index 5e14a3e..a02062b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,8 @@ networks: driver: ${NETWORKS_DRIVER} backend: driver: ${NETWORKS_DRIVER} + custom_network: + driver: bridge volumes: mysql: driver: ${VOLUMES_DRIVER} @@ -194,6 +196,8 @@ services: - "${WORKSPACE_VUE_CLI_UI_HOST_PORT}:8000" - "${WORKSPACE_ANGULAR_CLI_SERVE_HOST_PORT}:4200" - "${WORKSPACE_VITE_PORT}:5173" + - "${TCP_HOST_PORT}:5291" + - "${UDP_HOST_PORT}:5292" tty: true environment: - PHP_IDE_CONFIG=${PHP_IDE_CONFIG} @@ -203,8 +207,8 @@ services: - DOCKER_CERT_PATH=/certs/client - CHOKIDAR_USEPOLLING=true networks: - - frontend - - backend + - custom_network + container_name: workspace links: - docker-in-docker @@ -316,7 +320,7 @@ services: depends_on: - workspace networks: - - backend + - custom_network links: - docker-in-docker @@ -371,7 +375,7 @@ services: extra_hosts: - "dockerhost:${DOCKER_HOST_IP}" networks: - - backend + - custom_network ### Laravel Horizon ############################################ laravel-horizon: build: @@ -443,8 +447,7 @@ services: depends_on: - php-fpm networks: - - frontend - - backend + - custom_network ### OpenResty Server ######################################### openresty: @@ -555,7 +558,7 @@ services: ports: - "${MYSQL_PORT}:3306" networks: - - backend + - custom_network ### Percona ################################################ percona: @@ -756,7 +759,8 @@ services: ports: - "${REDIS_PORT}:6379" networks: - - backend + - custom_network + container_name: redis ### Redis Cluster ########################################## redis-cluster: @@ -858,7 +862,8 @@ services: depends_on: - php-fpm networks: - - backend + - custom_network + container_name: rabbitmq ### Mercure ############################################# mercure: @@ -1455,7 +1460,8 @@ services: ports: - 9010:9000 networks: - - backend + - custom_network + container_name: portainer ### Gitlab ################################################ gitlab: @@ -1487,7 +1493,8 @@ services: - "${GITLAB_HOST_HTTPS_PORT}:443" - "${GITLAB_HOST_SSH_PORT}:22" networks: - - backend + - custom_network + container_name: gitlab depends_on: - redis - postgres @@ -2136,3 +2143,20 @@ services: networks: - frontend - backend + + ### gitea ################################################## + gitea: + build: ./gitea + volumes: + - ./gitea:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + networks: + - custom_network + container_name: gitea + ports: + - "4300:3000" + - "2221:2222" + + + diff --git a/gitea/Dockerfile b/gitea/Dockerfile new file mode 100644 index 0000000..5269587 --- /dev/null +++ b/gitea/Dockerfile @@ -0,0 +1,2 @@ +FROM gitea/gitea:latest-rootless +LABEL maintainer="ykxiao " diff --git a/nginx/sites/mes-swoole-api.conf.back b/nginx/sites/mes-swoole-api.conf.back new file mode 100644 index 0000000..4ca9744 --- /dev/null +++ b/nginx/sites/mes-swoole-api.conf.back @@ -0,0 +1,45 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} +server { + listen 80; + server_name mes.api.com; + root /var/www/mes-admin-api/public; + index index.php; + + location = /index.php { + # Ensure that there is no such file named "not_exists" + # in your "public" directory. + try_files /not_exists @swoole; + } + # any php files must not be accessed + #location ~* \.php$ { + # return 404; + #} + location / { + try_files $uri $uri/ @swoole; + } + + location @swoole { + set $suffix ""; + + if ($uri = /index.php) { + set $suffix ?$query_string; + } + + proxy_http_version 1.1; + proxy_set_header Host $http_host; + proxy_set_header Scheme $scheme; + proxy_set_header SERVER_PORT $server_port; + proxy_set_header REMOTE_ADDR $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + + # IF https + # proxy_set_header HTTPS "on"; + + proxy_pass http://workspace:4200$suffix; + } +} diff --git a/php-worker/supervisord.d/laravel-worker.conf.example b/php-worker/supervisord.d/laravel-worker.conf.example index 0907600..eb76efe 100644 --- a/php-worker/supervisord.d/laravel-worker.conf.example +++ b/php-worker/supervisord.d/laravel-worker.conf.example @@ -1,8 +1,9 @@ [program:laravel-worker] process_name=%(program_name)s_%(process_num)02d -command=php /var/www/artisan queue:work --sleep=3 --tries=3 +command=php /var/www/mes-admin-api/artisan queue:work --tries=3 autostart=true autorestart=true -numprocs=8 -user=laradock +numprocs=3 +user=root redirect_stderr=true +stdout_logfile=/var/www/mes-admin-api/storage/logs/laravel-worker.log