parent
							
								
									42478f21d9
								
							
						
					
					
						commit
						6439824468
					
				| @ -1,12 +0,0 @@ | ||||
| #!/bin/bash | ||||
| # | ||||
| # | ||||
| # shellcheck disable=SC2006 | ||||
| s_path=`pwd` | ||||
| 
 | ||||
| #first build fir_client | ||||
| docker pull node:14.17.3 | ||||
| \cp -a build_client.sh fir_client/ | ||||
| docker run --rm --privileged=true -v "${s_path}"/fir_client:/fir_client -it node:14.17.3  sh /fir_client/build_client.sh | ||||
| 
 | ||||
| cd "${s_path}"/fir_ser/ && docker build . -t flyapps | ||||
| @ -1,7 +0,0 @@ | ||||
| #!/bin/bash | ||||
| # | ||||
| # | ||||
| 
 | ||||
| cd /fir_client/ && yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build | ||||
| 
 | ||||
| 
 | ||||
| @ -0,0 +1,67 @@ | ||||
| version: '3.2' | ||||
| 
 | ||||
| services: | ||||
|   buildflyapps: | ||||
|     image: 'flyapps' | ||||
|     build: | ||||
|       context: ../../fir_ser | ||||
|       dockerfile: Dockerfile | ||||
|     command: | ||||
|         - echo | ||||
|         - success | ||||
| 
 | ||||
|   buildclient: | ||||
|     container_name: buildclient | ||||
|     image: 'node:14.17.3' | ||||
|     working_dir: /fir_client | ||||
|     volumes: | ||||
|       - /etc/localtime:/etc/localtime:ro | ||||
|       - ../../fir_client:/fir_client | ||||
|       - ../../data/web/:/web | ||||
|     command: | ||||
|         - bash | ||||
|         - -c | ||||
|         - yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build index && yarn build short && ([ ! -e /web/fir_client ] && \cp -a dist_index /web/fir_client || \cp -a dist_index/* /web/fir_client/) && ([ ! -e /web/fir_client/short ] && \cp -a dist_short /web/fir_client/short || \cp -a dist_short/* /web/fir_client/short/)  && echo build success | ||||
| 
 | ||||
|   buildindex: | ||||
|     container_name: buildindex | ||||
|     image: 'node:14.17.3' | ||||
|     working_dir: /fir_client | ||||
|     volumes: | ||||
|       - /etc/localtime:/etc/localtime:ro | ||||
|       - ../../fir_client:/fir_client | ||||
|       - ../../data/web/:/web | ||||
|     command: | ||||
|         - bash | ||||
|         - -c | ||||
|         - yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build index && ([ ! -e /web/fir_client ] && \cp -a dist_index /web/fir_client || \cp -a dist_index/* /web/fir_client/) && echo build success | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|   buildshort: | ||||
|     container_name: buildshort | ||||
|     image: 'node:14.17.3' | ||||
|     working_dir: /fir_client | ||||
|     volumes: | ||||
|       - /etc/localtime:/etc/localtime:ro | ||||
|       - ../../fir_client:/fir_client | ||||
|       - ../../data/web/:/web | ||||
|     command: | ||||
|         - sh | ||||
|         - -c | ||||
|         - yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build short && ([ ! -e /web/fir_short ] && \cp -a dist_short /web/fir_short || \cp -a dist_short/* /web/fir_short/) && echo build success | ||||
| 
 | ||||
| 
 | ||||
|   buildadmin: | ||||
|     container_name: buildadmin | ||||
|     image: 'node:14.17.3' | ||||
|     working_dir: /fir_admin | ||||
|     volumes: | ||||
|       - /etc/localtime:/etc/localtime:ro | ||||
|       - ../../fir_admin:/fir_admin | ||||
|       - ../../data/web/:/web | ||||
|     command: | ||||
|         - sh | ||||
|         - -c | ||||
|         - yarn config set registry https://registry.npm.taobao.org && yarn install && yarn build:prod && ([ ! -e /web/fir_admin ] && \cp -a dist /web/fir_admin || \cp -a dist/* /web/fir_admin/) && echo build success | ||||
| 
 | ||||
| @ -0,0 +1,45 @@ | ||||
| version: '3' | ||||
| 
 | ||||
| networks: | ||||
|     flyapps: | ||||
|         external: true | ||||
|         name: flyapps | ||||
| 
 | ||||
| services: | ||||
|   flyapps: | ||||
|     container_name: flyapps | ||||
|     restart: always | ||||
|     image: 'flyapps' | ||||
|     working_dir: /data/fir_ser | ||||
|     volumes: | ||||
|       - /etc/localtime:/etc/localtime:ro | ||||
|       - ../../fir_ser:/data/fir_ser | ||||
|       - ../../data/flyapps/files:/data/fir_ser/files | ||||
|       - ../../data/logs/flyapps/:/data/fir_ser/logs | ||||
|       - ../../data/flyapps/supersign/:/data/fir_ser/supersign | ||||
|     networks: | ||||
|          flyapps: | ||||
|            ipv4_address: 172.31.31.100 | ||||
|     external_links: | ||||
|         - mariadb:mariadb  | ||||
|         - redis:redis | ||||
|     sysctls: | ||||
|         - net.core.somaxconn=4096 | ||||
|   nginx: | ||||
|     container_name: nginx | ||||
|     restart: always | ||||
|     image: 'nginx:1.21.3' | ||||
|     volumes: | ||||
|       - /etc/localtime:/etc/localtime:ro | ||||
|       - ../../data/web:/data | ||||
|       - ../../nginx.conf.d:/etc/nginx/conf.d | ||||
|     networks: | ||||
|          flyapps: | ||||
|            ipv4_address: 172.31.31.200 | ||||
|     ports: | ||||
|         - 80:80 | ||||
|         - 443:443 | ||||
|     external_links: | ||||
|         - flyapps:flyapps | ||||
|     depends_on: | ||||
|         - flyapps | ||||
| @ -0,0 +1,9 @@ | ||||
| #!/bin/bash | ||||
| # | ||||
| # | ||||
| 
 | ||||
| for i in flyapps mariadb redis buildclient buildshort buildadmin;do echo $i;docker rm -f $i;done | ||||
| 
 | ||||
| 
 | ||||
| docker network rm flyapps | ||||
| 
 | ||||
| @ -0,0 +1,27 @@ | ||||
| #!/bin/bash | ||||
| # | ||||
| # | ||||
| 
 | ||||
| which dockerd | ||||
| if [ $? -ne 0 ];then | ||||
| 	dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo | ||||
| 	dnf install docker-ce -y | ||||
| fi | ||||
| which docker-compose | ||||
| if [ $? -ne 0 ];then | ||||
| 	curl -L https://get.daocloud.io/docker/compose/releases/download/v2.5.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose | ||||
| 	chmod +x /usr/local/bin/docker-compose | ||||
| fi | ||||
| 
 | ||||
| data_path="$(dirname $(dirname `pwd`))/data" | ||||
| mkdir -pv ${data_path}/{flyapps,web,mariadb,redis,logs/{mariadb,nginx,flyapps}} | ||||
| chown 1001.1001 -R ${data_path}/{flyapps,web,mariadb,redis,logs/{mariadb,nginx,flyapps}} | ||||
| systemctl start docker && docker network create flyapps --driver bridge --subnet=172.31.31.0/24 | ||||
| systemctl enable docker | ||||
| systemctl status docker | ||||
| 
 | ||||
| 
 | ||||
| #docker pull 'bitnami/mariadb:10.7.3' | ||||
| #docker pull 'bitnami/redis:6.2.7' | ||||
| #docker pull 'nginx:1.21.3' | ||||
| #docker pull 'node:14.17.3' | ||||
| @ -0,0 +1 @@ | ||||
| Asia/Shanghai | ||||
| @ -0,0 +1,43 @@ | ||||
| version: '3.2' | ||||
| 
 | ||||
|   | ||||
| 
 | ||||
| networks: | ||||
|     flyapps: | ||||
|         external: true | ||||
|         name: flyapps | ||||
| 
 | ||||
| services: | ||||
| 
 | ||||
|   mariadb: | ||||
|     image: bitnami/mariadb:10.7.3 | ||||
|     container_name: mariadb  | ||||
|     restart: always | ||||
|     environment: | ||||
|             - MARIADB_ROOT_PASSWORD=rootIPD.xx2.19 | ||||
|             - MARIADB_DATABASE=flyappnew | ||||
|             - MARIADB_USER=flyuser | ||||
|             - MARIADB_PASSWORD=KGzKjZpWBp4R4RSa | ||||
|               #- ALLOW_EMPTY_PASSWORD=yes | ||||
|             - MARIADB_ENABLE_SLOW_QUERY=1 | ||||
|             - MARIADB_LONG_QUERY_TIME=3 | ||||
|             - MARIADB_SKIP_TEST_DB=yes | ||||
|             - MARIADB_EXTRA_FLAGS=--max-connect-errors=3000 --max_connections=30000 | ||||
|     ports: | ||||
|       - 3306:3306 | ||||
|     networks: | ||||
|          flyapps: | ||||
|            ipv4_address: 172.31.31.90 | ||||
|     volumes: | ||||
|        - ../init/timezone:/etc/timezone:ro | ||||
|        - /etc/localtime:/etc/localtime:ro | ||||
|        - ../../data/mariadb:/bitnami/mariadb/data | ||||
|        - ../../data/logs/mariadb:/data/logs/mariadb | ||||
|        - ./server.cnf:/opt/bitnami/mariadb/conf/my_custom.cnf:ro | ||||
| 
 | ||||
| #  adminer: | ||||
| #    image: adminer | ||||
| #    ports: | ||||
| #      - 8080:8080 | ||||
| #    networks: | ||||
| #         - fungame | ||||
| @ -0,0 +1,108 @@ | ||||
| # | ||||
| # These groups are read by MariaDB server. | ||||
| # Use it for options that only the server (but not clients) should see | ||||
| # | ||||
| # See the examples of server my.cnf files in /usr/share/mysql/ | ||||
| # | ||||
| 
 | ||||
| 
 | ||||
| # this is only for the mysqld standalone daemon | ||||
| [mysqld] | ||||
| binlog_cache_size = 192K | ||||
| thread_stack = 384K | ||||
| join_buffer_size = 4096K | ||||
| query_cache_type = 1 | ||||
| max_heap_table_size = 1024M | ||||
| 
 | ||||
| default_storage_engine = InnoDB | ||||
| performance_schema_max_table_instances = 400 | ||||
| table_definition_cache = 400 | ||||
| skip-external-locking | ||||
| key_buffer_size = 512M | ||||
| max_allowed_packet = 1G | ||||
| table_open_cache = 1024 | ||||
| sort_buffer_size = 2048K | ||||
| net_buffer_length = 4K | ||||
| read_buffer_size = 2048K | ||||
| read_rnd_buffer_size = 1024K | ||||
| myisam_sort_buffer_size = 16M | ||||
| thread_cache_size = 192 | ||||
| query_cache_size = 256M | ||||
| tmp_table_size = 1024M | ||||
| sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES | ||||
| 
 | ||||
| 
 | ||||
| max_connections = 30000 | ||||
| max_connect_errors = 1000 | ||||
| open_files_limit = 65535 | ||||
| 
 | ||||
| expire_logs_days = 10 | ||||
| #log_queries_not_using_indexes=on | ||||
| 
 | ||||
| character-set-client-handshake = FALSE | ||||
| character-set-server = utf8mb4 | ||||
| collation-server = utf8mb4_general_ci | ||||
| init_connect='SET NAMES utf8mb4' | ||||
| #character-set-server=utf8 | ||||
| skip_name_resolve | ||||
| event_scheduler=1 | ||||
| #skip-grant-tables | ||||
| 
 | ||||
| 
 | ||||
| #innodb_data_home_dir = /var/lib/mysql/ | ||||
| #innodb_data_file_path = ibdata1:10M:autoextend | ||||
| #innodb_log_group_home_dir = /var/lib/mysql/ | ||||
| #innodb_buffer_pool_size = 1024M | ||||
| #innodb_log_file_size = 128M | ||||
| #innodb_log_buffer_size = 32M | ||||
| #innodb_flush_log_at_trx_commit = 1 | ||||
| #innodb_lock_wait_timeout = 50 | ||||
| #innodb_max_dirty_pages_pct = 90 | ||||
| #innodb_read_io_threads = 4 | ||||
| #innodb_write_io_threads = 4 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| # | ||||
| # Allow server to accept connections on all interfaces. | ||||
| # | ||||
| #bind-address=0.0.0.0 | ||||
| # | ||||
| # this is only for embedded server | ||||
| # This group is only read by MariaDB servers, not by MySQL. | ||||
| # If you use the same .cnf file for MySQL and MariaDB, | ||||
| # you can put MariaDB-only options here | ||||
| [mariadb] | ||||
| #autoset_open_files_limit | ||||
| #enable_slow_query_log | ||||
| 
 | ||||
| #audit | ||||
| plugin_load_add=server_audit | ||||
| server_audit_logging=on | ||||
| server_audit_events=connect,query | ||||
| server_audit=force_plus_permanent | ||||
| server_audit_events=QUERY_DDL,QUERY_DML,CONNECT | ||||
| server_audit_output_type=file | ||||
| server_audit_file_rotate_now=on | ||||
| server_audit_file_rotations=9 | ||||
| server_audit_file_rotate_size=1G | ||||
| server_audit_file_path=/data/logs/mariadb | ||||
| 
 | ||||
| 
 | ||||
| log_error=/data/logs/mariadb/mariadb.err.log | ||||
| 
 | ||||
| log_output=FILE | ||||
| slow_query_log | ||||
| long_query_time=3 | ||||
| slow_query_log_file=/data/logs/mariadb/mariadb-slow.log | ||||
| log_queries_not_using_indexes=ON  #Logging Queries That Don't Use Indexes | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| #server_id=2 | ||||
| log-bin=/data/logs/mariadb/mysql-bin | ||||
| 
 | ||||
| # This group is only read by MariaDB-10.5 servers. | ||||
| # If you use the same .cnf file for MariaDB of different versions, | ||||
| # use this group for options that older servers don't understand | ||||
| 
 | ||||
| @ -0,0 +1,25 @@ | ||||
| version: '3.2' | ||||
| 
 | ||||
| 
 | ||||
| networks: | ||||
|     flyapps: | ||||
|         external: true | ||||
|         name: flyapps | ||||
| 
 | ||||
| services: | ||||
|   redis: | ||||
|     image: 'bitnami/redis:6.2.7' | ||||
|     container_name: redis | ||||
|     restart: always | ||||
|     volumes: | ||||
|          - ../init/timezone:/etc/timezone:ro | ||||
|          - /etc/localtime:/etc/localtime:ro | ||||
|          - ../../data/redis:/bitnami/redis/data | ||||
|     environment: | ||||
|       #- REDIS_REPLICATION_MODE=master | ||||
|       #- ALLOW_EMPTY_PASSWORD=yes | ||||
|       - REDIS_PASSWORD=nineven | ||||
|     networks: | ||||
|       - flyapps | ||||
|     #ports: | ||||
|     #  - 6379:6379 | ||||
| @ -0,0 +1,13 @@ | ||||
| #!/bin/bash | ||||
| # | ||||
| # | ||||
| 
 | ||||
| cd ../build/ | ||||
| 
 | ||||
| for i in buildclient buildadmin;do | ||||
| 	docker-compose up ${i} | ||||
| done | ||||
| 
 | ||||
| docker-compose build | ||||
| 
 | ||||
| 
 | ||||
| @ -0,0 +1,9 @@ | ||||
| #!/bin/bash | ||||
| # | ||||
| # | ||||
| 
 | ||||
| cd ../mariadb/ && docker-compose up -d | ||||
| cd ../redis/ && docker-compose up -d | ||||
| 
 | ||||
| cd ../flyapps/ && docker-compose up -d | ||||
| 
 | ||||
| @ -0,0 +1,10 @@ | ||||
| #!/bin/bash | ||||
| # | ||||
| # | ||||
| 
 | ||||
| 
 | ||||
| cd ../flyapps/ && docker-compose down | ||||
| 
 | ||||
| cd ../redis/ && docker-compose down | ||||
| 
 | ||||
| cd ../mariadb/ && docker-compose down | ||||
| @ -1,41 +0,0 @@ | ||||
| #!/bin/bash | ||||
| # | ||||
| # | ||||
| 
 | ||||
| # shellcheck disable=SC2006 | ||||
| s_path=`pwd` | ||||
| 
 | ||||
| docker network create flyapps | ||||
| docker run --net flyapps --name redis -d  redis:6.2.5 redis-server --requirepass nineven --bind '0.0.0.0' | ||||
| 
 | ||||
| docker run --net flyapps --name mariadb -e MARIADB_ROOT_PASSWORD=root  -v "${s_path}"/data/mysql:/var/lib/mysql  -d  mariadb:10.5 | ||||
| sleep 3 | ||||
| 
 | ||||
| code=1 | ||||
| count=1 | ||||
| while [ ${code} -ne 0 ];do | ||||
|         docker exec -it mariadb mysql -proot -e 'show databases;' | ||||
|         code=$? | ||||
|         ((count+=1)) | ||||
|         if [ "$count" -gt 30 ];then | ||||
|                 echo "30s away, but mysql service is not available" | ||||
|                 exit 1 | ||||
|         fi | ||||
|         sleep 2 | ||||
|         echo "check whether mysql service is ready..." | ||||
| done | ||||
| 
 | ||||
| docker exec -it mariadb mysql -proot -e 'create database flyappnew default character set utf8 COLLATE utf8_general_ci;' | ||||
| docker exec -it mariadb mysql -proot -e "grant all on flyappnew.* to flyuser@'%' identified by 'KGzKjZpWBp4R4RSa';" | ||||
| 
 | ||||
| 
 | ||||
| docker run --sysctl net.core.somaxconn=4096 --net flyapps \ | ||||
| 	-v "${s_path}"/fir_ser:/data/fir_ser \ | ||||
| 	-v "${s_path}"/data/files:/data/fir_ser/files \ | ||||
| 	-v "${s_path}"/data/supersign:/data/fir_ser/supersign \ | ||||
| 	--name flyapps -d flyapps | ||||
| 
 | ||||
| docker run --net flyapps --name nginx -d -p 80:80  -p 443:443 \ | ||||
|   -v "${s_path}"/fir_client/dist:/data/fir_client  \ | ||||
|   -v "${s_path}"/nginx.conf.d:/etc/nginx/conf.d nginx:1.21.3 | ||||
| 
 | ||||
					Loading…
					
					
				
		Reference in new issue