From d5552efdfc9f40e4fcb6666ed32cb24383ab9b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=A7=D9=85=DB=8C=D8=B1=D8=AD=D8=B3=DB=8C=D9=86=20=D9=85?= =?UTF-8?q?=D9=82=DB=8C=D8=B3=D9=87?= Date: Sat, 7 May 2022 01:36:08 +0430 Subject: [PATCH] ops --- .DS_Store | Bin 8196 -> 8196 bytes .gitignore | 2 +- playbooks/server/addDomainAndEncrypt.yml | 20 +-- playbooks/server/template/stack-block.j2 | 2 + port-range | 1 + service_list.txt | 18 +++ stackDev/mongo/.gitignore | 1 + stackDev/mongo/stack.yml | 115 +++++++++-------- stacks/lvl2/.DS_Store | Bin 6148 -> 6148 bytes stacks/lvl3/stack.yml | 14 ++- stacks/lvl6/stack.serverless.yml | 151 +++++++++++++++++++++++ stacks/watcher/stack.yml | 36 ++++++ 12 files changed, 286 insertions(+), 74 deletions(-) create mode 100644 service_list.txt create mode 100644 stackDev/mongo/.gitignore create mode 100644 stacks/lvl6/stack.serverless.yml create mode 100644 stacks/watcher/stack.yml diff --git a/.DS_Store b/.DS_Store index 543cf062fe459501db0bfe0f7244f17f6ead5d7e..a790280d6c87fe8cbbe8f2779b1edd1a08468656 100644 GIT binary patch delta 152 zcmZp1XmQw}CJ?*HhJk^Bg+Y%YogtH_UW)As(cDw`GO3? z;N<+=0-zoS2J;D~P-X HF!6N&hW;&r diff --git a/.gitignore b/.gitignore index 5d2935c..1e15e17 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ .DS_* password -.DS* \ No newline at end of file +.DS_Store \ No newline at end of file diff --git a/playbooks/server/addDomainAndEncrypt.yml b/playbooks/server/addDomainAndEncrypt.yml index 5dc1891..444c78b 100644 --- a/playbooks/server/addDomainAndEncrypt.yml +++ b/playbooks/server/addDomainAndEncrypt.yml @@ -8,10 +8,10 @@ src: template/nginx-server-block.j2 dest: /tmp/new-nginx-server-block.{{item.server_name}}.conf with_items: - - server_name: tetris.game.igarson.app + - server_name: doz.game.igarson.app server_config: "" - service_port: 6005 - conf_file: games.conf + service_port: 6006 + conf_file: games.conf - name: append /tmp/new-nginx-server-block.conf to specific conf @@ -19,20 +19,20 @@ cat /tmp/new-nginx-server-block.{{item.server_name}}.conf >> /etc/nginx/sites-available/{{ item.conf_file }} rm -rf /tmp/new-nginx-server-block.{{item.server_name}}.conf with_items: - - server_name: tetris.game.igarson.app + - server_name: doz.game.igarson.app server_config: "" - service_port: 6005 - conf_file: games.conf + service_port: 6006 + conf_file: games.conf - name: encrypt all domains shell: | certbot --nginx -d {{item.server_name}} -n --redirect with_items: - - server_name: tetris.game.igarson.app + - server_name: doz.game.igarson.app server_config: "" - service_port: 6005 - conf_file: games.conf + service_port: 6006 + conf_file: games.conf - name: Reload nginx to activate specified site service: name=nginx state=restarted @@ -41,7 +41,7 @@ cron: name: renew_certificates special_time: weekly - job: certbot renew --post-hook "systemctl reload nginx" + job: certbot renew --post-hook "systemctl reload nginx" diff --git a/playbooks/server/template/stack-block.j2 b/playbooks/server/template/stack-block.j2 index c7c849f..df7a7bd 100644 --- a/playbooks/server/template/stack-block.j2 +++ b/playbooks/server/template/stack-block.j2 @@ -1,3 +1,5 @@ + + {{item.service_name}}: image: {{item.registry}} environment: diff --git a/port-range b/port-range index 11fc252..c69312b 100644 --- a/port-range +++ b/port-range @@ -7,6 +7,7 @@ 6003 quiz ==> must change 6023 api quiz ==> must change 6005 tetris +6006 doz } diff --git a/service_list.txt b/service_list.txt new file mode 100644 index 0000000..79a7998 --- /dev/null +++ b/service_list.txt @@ -0,0 +1,18 @@ +mongoprimary:27017 +mongosecondary:27017 +mongoarbiter:27017 +pg-0:5432 +pg-1:5432 +rabbitmq:5672 +redismaster:6379 +ls:8010 +core:8080 +yaus:8000 +menu:80 +admin:80 +capitan:80 +website:3000 +twentyfortyeight:80 +sudoku:80 +tetris:80 +doz:80 \ No newline at end of file diff --git a/stackDev/mongo/.gitignore b/stackDev/mongo/.gitignore new file mode 100644 index 0000000..f670147 --- /dev/null +++ b/stackDev/mongo/.gitignore @@ -0,0 +1 @@ +archive.gz \ No newline at end of file diff --git a/stackDev/mongo/stack.yml b/stackDev/mongo/stack.yml index e291af9..d169b1d 100644 --- a/stackDev/mongo/stack.yml +++ b/stackDev/mongo/stack.yml @@ -5,20 +5,19 @@ networks: external: true volumes: - mongoprimary-data: - mongosecondary-data: + mongo0: services: mongoprimary: image: registry.vnfco.ir/library/bitnami/mongodb:4.4.11-debian-10-r5 volumes: - - mongoprimary-data:/bitnami/mongodb + - mongo0:/bitnami/mongodb environment: - - MONGODB_REPLICA_SET_MODE=primary - - MONGODB_REPLICA_SET_NAME=igrep + # - MONGODB_REPLICA_SET_MODE=primary + # - MONGODB_REPLICA_SET_NAME=igrep - MONGODB_ADVERTISED_HOSTNAME=mongoprimary - MONGODB_ROOT_PASSWORD=cWv1WQvWEp+LPdax9We/M6PeT7KgyTE9zKmC5y1ieqz4JtpLiVifJrQg0VHYhE6l - - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica + # - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica deploy: update_config: parallelism: 1 @@ -37,61 +36,61 @@ services: - mother - mongosecondary: - image: registry.vnfco.ir/library/bitnami/mongodb:4.4.11-debian-10-r5 - environment: - - MONGODB_REPLICA_SET_MODE=secondary - - MONGODB_REPLICA_SET_NAME=igrep - - MONGODB_ADVERTISED_HOSTNAME=mongosecondary - - MONGODB_INITIAL_PRIMARY_HOST=mongoprimary - - MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017 - - MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=cWv1WQvWEp+LPdax9We/M6PeT7KgyTE9zKmC5y1ieqz4JtpLiVifJrQg0VHYhE6l - - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica - volumes: - - mongosecondary-data:/bitnami/mongodb - deploy: - update_config: - parallelism: 1 - delay: 10s - order: start-first - restart_policy: - condition: any - delay: 5s - max_attempts: 3 - window: 120s - mode: replicated - replicas: 1 - ports: - - "27012:27017" - networks: - - mother + # mongosecondary: + # image: registry.vnfco.ir/library/bitnami/mongodb:4.4.11-debian-10-r5 + # environment: + # - MONGODB_REPLICA_SET_MODE=secondary + # - MONGODB_REPLICA_SET_NAME=igrep + # - MONGODB_ADVERTISED_HOSTNAME=mongosecondary + # - MONGODB_INITIAL_PRIMARY_HOST=mongoprimary + # - MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017 + # - MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=cWv1WQvWEp+LPdax9We/M6PeT7KgyTE9zKmC5y1ieqz4JtpLiVifJrQg0VHYhE6l + # - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica + # volumes: + # - mongosecondary-data:/bitnami/mongodb + # deploy: + # update_config: + # parallelism: 1 + # delay: 10s + # order: start-first + # restart_policy: + # condition: any + # delay: 5s + # max_attempts: 3 + # window: 120s + # mode: replicated + # replicas: 1 + # ports: + # - "27012:27017" + # networks: + # - mother - mongoarbiter: - image: registry.vnfco.ir/library/bitnami/mongodb:4.4.11-debian-10-r5 - environment: - - MONGODB_REPLICA_SET_MODE=arbiter - - MONGODB_REPLICA_SET_NAME=igrep - - MONGODB_ADVERTISED_HOSTNAME=mongoarbiter - - MONGODB_INITIAL_PRIMARY_HOST=mongoprimary - - MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017 - - MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=cWv1WQvWEp+LPdax9We/M6PeT7KgyTE9zKmC5y1ieqz4JtpLiVifJrQg0VHYhE6l - - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica - deploy: - update_config: - parallelism: 1 - delay: 10s - order: start-first - restart_policy: - condition: any - delay: 5s - max_attempts: 3 - window: 120s - mode: replicated - replicas: 1 - networks: - - mother + # mongoarbiter: + # image: registry.vnfco.ir/library/bitnami/mongodb:4.4.11-debian-10-r5 + # environment: + # - MONGODB_REPLICA_SET_MODE=arbiter + # - MONGODB_REPLICA_SET_NAME=igrep + # - MONGODB_ADVERTISED_HOSTNAME=mongoarbiter + # - MONGODB_INITIAL_PRIMARY_HOST=mongoprimary + # - MONGODB_INITIAL_PRIMARY_PORT_NUMBER=27017 + # - MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD=cWv1WQvWEp+LPdax9We/M6PeT7KgyTE9zKmC5y1ieqz4JtpLiVifJrQg0VHYhE6l + # - MONGODB_REPLICA_SET_KEY=keyissetforlocalreplica + # deploy: + # update_config: + # parallelism: 1 + # delay: 10s + # order: start-first + # restart_policy: + # condition: any + # delay: 5s + # max_attempts: 3 + # window: 120s + # mode: replicated + # replicas: 1 + # networks: + # - mother diff --git a/stacks/lvl2/.DS_Store b/stacks/lvl2/.DS_Store index 1e269dfd7185f511f66d8f184debf5d9cd33de18..b4dadeec4c9d96eb657b5127d360ba254dd12e33 100644 GIT binary patch delta 82 zcmZoMXfc=|#>B!ku~2NHo+2a1#(>?7i$5?kF>*}iVX~OKgJ}Yrg@KNOk@;jlW~a@T lOs|&?6runC delta 67 zcmZoMXfc=|#>B)qu~2NHo+2ar#(>?7jO>$nSS&WHvp!(j*zlNXGdl-A2T;joL5}at Vlles)IT(O|k%56_bA-qmW&l=k5D@?X diff --git a/stacks/lvl3/stack.yml b/stacks/lvl3/stack.yml index 87cd632..f7f65e1 100644 --- a/stacks/lvl3/stack.yml +++ b/stacks/lvl3/stack.yml @@ -79,20 +79,23 @@ services: - node.role == worker volumes: - type: bind - source: /volume/ig/api/storage + source: /volume/ig target: /target/storage + - type: bind + source: /data/backup + target: /target/backup - type: bind source: /volume/config/core/application-prod.properties target: /target/classes/application-prod.properties - type: bind source: /volume/ig/api/logs/http.log - targer: /target/logs/http.log + target: /target/logs/http.log - type: bind source: /volume/ig/api/logs/error.log - targer: /target/logs/error.log + target: /target/logs/error.log - type: bind source: /volume/ig/api/logs/archive - targer: /target/logs/archive + target: /target/logs/archive - type: bind source: /etc/localtime target: /etc/localtime @@ -112,13 +115,14 @@ services: image: registry.vnfco.ir/ig/sms:latest environment: - QUEUE_NAME=ig-sms - - RABBIT_URI=amqp://test:test@192.168.0.108:5672 + - RABBIT_URI=amqp://igarsonAgent:muyXHzymcTYLzk3wYnIwG+UJWECKy0ViUDO+UlCmPF3XS+2kliuV0TaA0mWf6lT@rabbitmq:5672 - SMS_SERVICE_URI=https://api.kavenegar.com/v1/ - USERAPIKEY=3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B - SECRETKEY=!#u*(!@ofOAJDU31y+ - LINENUMBER=2000500666 - VERIFICATION_SERVICE_CONTEXT_PATH=/verify/lookup.json - SMS_SERVICE_CONTEXT_PATH=/sms/lookup.json + - TZ=Asia/Tehran deploy: update_config: diff --git a/stacks/lvl6/stack.serverless.yml b/stacks/lvl6/stack.serverless.yml new file mode 100644 index 0000000..e5a2a6c --- /dev/null +++ b/stacks/lvl6/stack.serverless.yml @@ -0,0 +1,151 @@ + +version: "3.7" + +networks: + mother: + external: true + + +# ig games stack + +services: + + twentyfortyeight: + image: registry.vnfco.ir/ig/game/2048:latest + environment: + - TZ=Asia/Tehran + # - NODE_ENV=production + # - REACT_APP_SIGNAL_URL=https://ls.igarson.app + # - REACT_APP_PATH_URL=/api/v1 + # - REACT_APP_STORAGE_URL=https://storage.igarson.app + # - REACT_APP_SIGNAL_URL_PATH=/restauranthub + # - REACT_APP_LOG_LENGTH=20 + # - REACT_APP_SOCKET_SECRET=GodProtectedKeyTools + # - REACT_APP_SECRET_KEY_GAME=6JCvBmi1ADry5Qk0bLaV+5klnAqYaVtjn+HSHG4N4pOAEl480saobylNWcudDxhvgw6q0yzVmbYH+lQIS3RmEHLXRHYAHxsdXl5MBuqU/p1oCC3SWmYke1SWHkoTUOm1f8SBZ1HucOxBHv7psqFUu5lG38P/EPiozv6/0qDU+vVFFp6v9ZTigBihLll0mU6qR14krot8+y9tOnrLDkHxw3wLvWsB4wgd9+RAY97Gzzs7ix3nAXthsT+jPWdyuENiKSuKEyHKbDqciJRBGqktgYU9XkYIfZzEm4cxhscT9jqNsUg2ml+uJdDQOps2mL5LgNetWWmcP43xPIkxAwu5oK873GV3uZOdQqYE2CBYT66+/+Yp5xzoL4+qZUUiDEpfWKm+clRlAm1Keiur + deploy: + update_config: + parallelism: 1 + delay: 10s + order: start-first + restart_policy: + condition: any + delay: 5s + window: 120s + resources: + limits: + cpus: '0.5' + memory: 50M + replicas: 1 + mode: replicated + placement: + constraints: + - node.role == worker + ports: + - 6001:80 + volumes: + - "/etc/localtime:/etc/localtime:ro" + - "/etc/timezone:/etc/timezone:ro" + networks: + - mother + + + + sudoku: + image: registry.vnfco.ir/ig/game/sudoku:latest + environment: + - TZ=Asia/Tehran + # - NODE_ENV=production + # - REACT_APP_SIGNAL_URL=https://ls.igarson.app + # - REACT_APP_PATH_URL=/api/v1 + # - REACT_APP_STORAGE_URL=https://storage.igarson.app + # - REACT_APP_SIGNAL_URL_PATH=/restauranthub + # - REACT_APP_LOG_LENGTH=20 + # - REACT_APP_SOCKET_SECRET=GodProtectedKeyTools + # - REACT_APP_SECRET_KEY_GAME=6JCvBmi1ADry5Qk0bLaV+5klnAqYaVtjn+HSHG4N4pOAEl480saobylNWcudDxhvgw6q0yzVmbYH+lQIS3RmEHLXRHYAHxsdXl5MBuqU/p1oCC3SWmYke1SWHkoTUOm1f8SBZ1HucOxBHv7psqFUu5lG38P/EPiozv6/0qDU+vVFFp6v9ZTigBihLll0mU6qR14krot8+y9tOnrLDkHxw3wLvWsB4wgd9+RAY97Gzzs7ix3nAXthsT+jPWdyuENiKSuKEyHKbDqciJRBGqktgYU9XkYIfZzEm4cxhscT9jqNsUg2ml+uJdDQOps2mL5LgNetWWmcP43xPIkxAwu5oK873GV3uZOdQqYE2CBYT66+/+Yp5xzoL4+qZUUiDEpfWKm+clRlAm1Keiur + deploy: + update_config: + parallelism: 1 + delay: 10s + order: start-first + restart_policy: + condition: any + delay: 5s + window: 120s + resources: + limits: + cpus: '0.5' + memory: 50M + replicas: 1 + mode: replicated + placement: + constraints: + - node.role == worker + ports: + - 6002:80 + volumes: + - "/etc/localtime:/etc/localtime:ro" + - "/etc/timezone:/etc/timezone:ro" + networks: + - mother + + + tetris: + image: registry.vnfco.ir/ig/game/tetris:latest + environment: + - TZ=Asia/Tehran + deploy: + update_config: + parallelism: 1 + delay: 10s + order: start-first + restart_policy: + condition: any + delay: 5s + window: 120s + resources: + limits: + cpus: '0.5' + memory: 50M + replicas: 1 + mode: replicated + placement: + constraints: + - node.role == worker + ports: + - 6005:80 + volumes: + - "/etc/localtime:/etc/localtime:ro" + - "/etc/timezone:/etc/timezone:ro" + networks: + - mother + + doz: + image: registry.vnfco.ir/ig/game/doz:latest + environment: + - TZ=Asia/Tehran + deploy: + update_config: + parallelism: 1 + delay: 10s + order: start-first + restart_policy: + condition: any + delay: 5s + window: 120s + resources: + limits: + cpus: '0.5' + memory: 20M + replicas: 1 + mode: replicated + placement: + constraints: + - node.role == worker + ports: + - 6006:80 + volumes: + - "/etc/localtime:/etc/localtime:ro" + - "/etc/timezone:/etc/timezone:ro" + networks: + - mother + diff --git a/stacks/watcher/stack.yml b/stacks/watcher/stack.yml new file mode 100644 index 0000000..e213d1b --- /dev/null +++ b/stacks/watcher/stack.yml @@ -0,0 +1,36 @@ +version: "3.7" + +networks: + mother: + external: true + + +services: + + watcher: + image: registry.vnfco.ir/ig/watcher:latest + environment: + deploy: + update_config: + parallelism: 1 + delay: 10s + order: start-first + restart_policy: + condition: any + delay: 5s + window: 120s + resources: + limits: + cpus: '0.1' + memory: 10M + replicas: 1 + mode: replicated + placement: + constraints: + - node.role == manager + volumes: + - "/etc/localtime:/etc/localtime:ro" + - "/etc/timezone:/etc/timezone:ro" + - "/volume/watcher/service_list:/usr/app/src/service_list:ro" + networks: + - mother \ No newline at end of file