├── Problemas com SSL.md
├── README.md
├── config
├── donate.jpg
├── izing
├── lib
├── _backend.sh
├── _frontend.sh
├── _inquiry.sh
├── _system.sh
└── manifest.sh
├── utils
├── _banner.sh
└── manifest.sh
└── variables
├── _background.sh
├── _fonts.sh
├── _general.sh
└── manifest.sh
/Problemas com SSL.md:
--------------------------------------------------------------------------------
1 | ## Liberar SSL pelo cloudflare alternativa
2 |
3 | ## RODAR OS COMANDOS ABAIXO ##
4 |
5 |
6 | ```bash
7 | sudo apt-get update
8 | ```
9 | ```bash
10 | sudo apt-get install certbot
11 | ```
12 |
13 | ```bash
14 | sudo apt-get install python3-certbot-dns-cloudflare
15 | ```
16 |
17 | ```bash
18 | sudo apt-get install python3-certbot-nginx
19 | ```
20 |
21 | Criar esse arquivo com dados abaixo, com nano para salvar aperta Ctrl + x
22 | ```bash
23 | nano cloudflare.ini
24 | ```
25 |
26 | ```bash
27 | dns_cloudflare_email = teu email
28 | dns_cloudflare_api_key = tua api
29 | ```
30 |
31 | exemplo usando usuario deploy, casom for outro trocar dados
32 | ```bash
33 | mkdir -p /home/deploy/.secrets/certbot/
34 | ```
35 |
36 | ```bash
37 | mv cloudflare.ini /home/deploy/.secrets/certbot
38 | ```
39 |
40 | ```bash
41 | sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /home/deploy/.secrets/certbot/cloudflare.ini -d frontend.seudominio.com.br -d backend.seudominio.com.br --dns-cloudflare-propagation-seconds 60
42 | ```
43 |
44 | ```bash
45 | sudo certbot --nginx
46 | ```
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://grupo.whazing.com.br)
2 |
3 | ## CRIAR SUBDOMINIO E APONTAR PARA O IP DA SUA VPS
4 |
5 | Testado ubuntu 20 e 22
6 |
7 |
8 | Editar arquivo config e colocar senhas de sua preferencia e seu email, dominios.
9 |
10 | Se quiser instalar 2 instancia mudar nome da instancia, porta backend, porta frontend e porta_postgre_intancia, não deve utilizar mesmas portas de outras instalações
11 |
12 | A opção atualizar vai pegar ultima versao do repositorio usado para instalar
13 |
14 | Nunca usar portas 80 e 443 para backend utilize porta 3000 a 3100 e frontend 4000 a 4100
15 |
16 |
17 | ## CHECAR PROPAGAÇÃO DO DOMÍNIO
18 |
19 | https://dnschecker.org/
20 |
21 | ## RODAR OS COMANDOS ABAIXO ##
22 |
23 | Antes de iniciar verifique no site acima se propagou o dns. Para não ter erro na instalaçao
24 |
25 | Para evitar erros recomendados atualizar sistema e apos atualizar reniciar para evitar erros
26 |
27 | ```bash
28 | apt -y update && apt -y upgrade
29 | ```
30 | ```bash
31 | reboot
32 | ```
33 |
34 |
35 | Depois reniciar seguir com a instalacao
36 |
37 | ```bash
38 | cd /root
39 | ```
40 | ```bash
41 | git clone https://github.com/cleitonme/izing.instalador.git izinginstalador
42 | ```
43 | Editar dados com seus dados, com nano para salvar aperta Ctrl + x
44 |
45 | Você pode definir o timezone desejado usando a variável de ambiente TIMEZONE. Caso não seja informado, o sistema usará o timezone padrão: America/Sao_Paulo.
46 | ```bash
47 | nano ./izinginstalador/config
48 | ```
49 |
50 | ```bash
51 | sudo chmod +x ./izinginstalador/izing
52 | ```
53 | ```bash
54 | cd ./izinginstalador
55 | ```
56 | ```bash
57 | sudo ./izing
58 | ```
59 |
60 | ## Problemas conexão whatsapp? ##
61 |
62 | Tente atualizar o Conector WWebJS whatsapp.js
63 |
64 |
65 | ## Recomendação de instalar e deixar Firewall ativado
66 |
67 | Seu servidor pode sofrer ataques externos que fazem sistema travar e ter quedas por favor instale e mantenha o firewall ativado.
68 | Utilizado UFW para saber mais de pesquisada no google.
69 |
70 | ## Instalando
71 | Seguem links sugerimos:
72 | - [Como usar autoinstalador do IZING - Video](https://youtu.be/-Woqu4W5Zzs?si=jcZYX3yPL60XkAd_)
73 | - [Como usar autoinstalador do IZING - Video opção 2](https://youtu.be/bZ-jXRtcGyc?si=B8oQxv0V0V36fgrF)
74 |
75 | ## Alterar Frontend
76 |
77 | Para mudar nome do aplicativo:
78 |
79 | /home/deploy/izing.io/frontend/quasar.conf
80 |
81 | /home/deploy/izing.io/frontend/src/index.template.html
82 |
83 | Para alterar logos e icones:
84 |
85 | pasta /home/deploy/izing.io/frontend/public
86 |
87 | Para alterar cores:
88 |
89 | /home/deploy/izing.io/frontend/src/css/app.sass
90 |
91 | /home/deploy/izing.io/frontend/src/css/quasar.variables.sass
92 |
93 | Sempre alterar usando usuario deploy você pode conectar servidor com aplicativo Bitvise SSH Client. Depois das alterações compilar novamente o Frontend
94 |
95 | ```bash
96 | su deploy
97 | ```
98 | ```bash
99 | cd /home/deploy/pastaondetainstalado/frontend/
100 | ```
101 | ```bash
102 | export NODE_OPTIONS=--openssl-legacy-provider
103 | ```
104 | ```bash
105 | npx quasar build -P -m pwa
106 | ```
107 |
108 | Testar as alterações em aba anonima
109 |
110 | ## Erros
111 |
112 | "Internal server error: SequelizeConnectionError: could not open file \"global/pg_filenode.map\": Permission denied"
113 |
114 | ```bash
115 | docker container restart postgresql
116 | ```
117 | ```bash
118 | docker exec -u root postgresql bash -c "chown -R postgres:postgres /var/lib/postgresql/data"
119 | ```
120 | ```bash
121 | docker container restart postgresql
122 | ```
123 |
124 | ## Acesso Portainer gerar senha
125 | "Your Portainer instance timed out for security purposes. To re-enable your Portainer instance, you will need to restart Portainer."
126 |
127 | ```bash
128 | docker container restart portainer
129 | ```
130 |
131 | Depois acesse novamente url http://seuip:9000/
132 |
133 |
134 | ## Recomendação de VPS boa e barata
135 |
136 | - [Powerful cloud VPS & Web hosting.](https://control.peramix.com/?affid=58)
137 |
138 | - Cupom 25% desconto "WHAZING"
139 |
140 | ```bash
141 | WHAZING
142 | ```
143 | #### Curtiu? Apoie o projeto!! Com sua doação, será possível continuar com as atualizações. Segue QR code (PIX)
144 |
145 | [
](donate.jpg)
146 |
147 | ## Consultoria particular
148 |
149 | Para quem gostaria de uma consultoria ou que eu faça instalação pode chamar no whatsapp (será cobrado por isso) 48 999416725
150 |
151 | - [Nova Versão com API Bayles](https://github.com/cleitonme/Whazing-SaaS.instalador)
152 |
--------------------------------------------------------------------------------
/config:
--------------------------------------------------------------------------------
1 | deploy_password=AKwWM4Qu2GRppJ7
2 | pg_pass=AKwWM4Qu2GRppJ7
3 | redis_pass=AKwWM4Qu2GRppJ7
4 | deploy_email=seuemail@gmail.com
5 | repositorio=https://github.com/cleitonme/izing.open.io.git
6 | nome_instancia=izing1
7 | porta_postgre_intancia=5432
8 | frontend_url=front.seusite.com.br
9 | frontend_porta=4000
10 | backend_url=back.seusite.com.br
11 | backend_porta=3000
--------------------------------------------------------------------------------
/donate.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cleitonme/izing.instalador/166afe5b2cb52f268698a801d46fcb20d640965e/donate.jpg
--------------------------------------------------------------------------------
/izing:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # reset shell colors
4 | tput init
5 |
6 | # https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself
7 | SOURCE="${BASH_SOURCE[0]}"
8 | while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
9 | PROJECT_ROOT="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
10 | SOURCE="$(readlink "$SOURCE")"
11 | [[ $SOURCE != /* ]] && SOURCE="$PROJECT_ROOT/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
12 | done
13 | PROJECT_ROOT="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
14 |
15 | # required imports
16 | source "${PROJECT_ROOT}"/variables/manifest.sh
17 | source "${PROJECT_ROOT}"/utils/manifest.sh
18 | source "${PROJECT_ROOT}"/lib/manifest.sh
19 |
20 | # user configs file
21 | if [[ ! -e "${PROJECT_ROOT}"/config ]]; then
22 | cat << EOF > "${PROJECT_ROOT}"/config
23 | deploy_password=${deploy_password}
24 | EOF
25 | fi
26 |
27 | # this file has passwords
28 | sudo su - root < /etc/apt/sources.list.d/google.list'
63 | sudo apt update
64 | sudo apt install -y google-chrome-stable
65 | EOF
66 |
67 | sleep 2
68 | }
69 |
70 | #######################################
71 | # sets environment variable for backend.
72 | # Arguments:
73 | # None
74 | #######################################
75 | backend_set_env() {
76 | print_banner
77 | printf "${WHITE} 💻 Configurando variáveis de ambiente (backend)...${GRAY_LIGHT}"
78 | printf "\n\n"
79 |
80 | sleep 2
81 |
82 | # ensure idempotency
83 | backend_url=$(echo "${backend_url/https:\/\/}")
84 | backend_url=${backend_url%%/*}
85 | backend_url=https://$backend_url
86 |
87 | # ensure idempotency
88 | frontend_url=$(echo "${frontend_url/https:\/\/}")
89 | frontend_url=${frontend_url%%/*}
90 | frontend_url=https://$frontend_url
91 |
92 | jwt_secret=$(openssl rand -base64 32)
93 | jwt_refresh_secret=$(openssl rand -base64 32)
94 |
95 | sudo su - deploy << EOF
96 | cat <<[-]EOF > /home/deploy/${nome_instancia}/backend/.env
97 | NODE_ENV=dev
98 | BACKEND_URL=${backend_url}
99 | FRONTEND_URL=${frontend_url}
100 |
101 | PROXY_PORT=443
102 | PORT=${backend_porta}
103 |
104 | # conexão com o banco de dados
105 | DB_DIALECT=postgres
106 | DB_PORT=${porta_postgre_intancia}
107 | DB_TIMEZONE=-03:00
108 | POSTGRES_HOST=localhost
109 | POSTGRES_USER=izing
110 | POSTGRES_PASSWORD=${pg_pass}
111 | POSTGRES_DB=postgres
112 |
113 | # Chaves para criptografia do token jwt
114 | JWT_SECRET=${jwt_secret}
115 | JWT_REFRESH_SECRET=${jwt_refresh_secret}
116 |
117 | # Dados de conexão com o REDIS
118 | IO_REDIS_SERVER=localhost
119 | IO_REDIS_PASSWORD=${redis_pass}
120 | IO_REDIS_PORT=6379
121 | IO_REDIS_DB_SESSION=2
122 |
123 | #CHROME_BIN=/usr/bin/google-chrome
124 | CHROME_BIN=/usr/bin/google-chrome-stable
125 |
126 | # tempo para randomização da mensagem de horário de funcionamento
127 | MIN_SLEEP_BUSINESS_HOURS=10000
128 | MAX_SLEEP_BUSINESS_HOURS=20000
129 |
130 | # tempo para randomização das mensagens do bot
131 | MIN_SLEEP_AUTO_REPLY=4000
132 | MAX_SLEEP_AUTO_REPLY=6000
133 |
134 | # tempo para randomização das mensagens gerais
135 | MIN_SLEEP_INTERVAL=2000
136 | MAX_SLEEP_INTERVAL=5000
137 |
138 | # dados do RabbitMQ / Para não utilizar, basta comentar a var AMQP_URL
139 | RABBITMQ_DEFAULT_USER=admin
140 | RABBITMQ_DEFAULT_PASS=123456
141 | # AMQP_URL='amqp://admin:123456@host.docker.internal:5672?connection_attempts=5&retry_delay=5'
142 |
143 | # api oficial (integração em desenvolvimento)
144 | API_URL_360=https://waba-sandbox.360dialog.io
145 |
146 | # usado para mosrar opções não disponíveis normalmente.
147 | ADMIN_DOMAIN=izing.io
148 |
149 | # Dados para utilização do canal do facebook
150 | FACEBOOK_APP_ID=3237415623048660
151 | FACEBOOK_APP_SECRET_KEY=3266214132b8c98ac59f3e957a5efeaaa13500
152 |
153 | # Forçar utilizar versão definida via cache (https://wppconnect.io/pt-BR/whatsapp-versions/)
154 | #WEB_VERSION=2.2409.2
155 |
156 | # Customizar opções do pool de conexões DB
157 | #POSTGRES_POOL_MAX=100
158 | #POSTGRES_POOL_MIN=10
159 | #POSTGRES_POOL_ACQUIRE=30000
160 | #POSTGRES_POOL_IDLE=10000
161 |
162 | # Limitar Uso do Izing Usuario e Conexões
163 | USER_LIMIT=99
164 | CONNECTIONS_LIMIT=99
165 | [-]EOF
166 | EOF
167 |
168 | sleep 2
169 | }
170 |
171 |
172 | #######################################
173 | # installs node.js dependencies
174 | # Arguments:
175 | # None
176 | #######################################
177 | backend_node_dependencies() {
178 | print_banner
179 | printf "${WHITE} 💻 Instalando dependências do backend...${GRAY_LIGHT}"
180 | printf "\n\n"
181 |
182 | sleep 2
183 |
184 | sudo su - deploy < /etc/nginx/sites-available/${nome_instancia}-backend << 'END'
353 | server {
354 | server_name $backend_hostname;
355 |
356 | location / {
357 | proxy_pass http://127.0.0.1:${backend_porta};
358 | proxy_http_version 1.1;
359 | proxy_set_header Upgrade \$http_upgrade;
360 | proxy_set_header Connection 'upgrade';
361 | proxy_set_header Host \$host;
362 | proxy_set_header X-Real-IP \$remote_addr;
363 | proxy_set_header X-Forwarded-Proto \$scheme;
364 | proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
365 | proxy_cache_bypass \$http_upgrade;
366 | }
367 | }
368 | END
369 |
370 | ln -s /etc/nginx/sites-available/${nome_instancia}-backend /etc/nginx/sites-enabled
371 | EOF
372 |
373 | sleep 2
374 | }
375 |
--------------------------------------------------------------------------------
/lib/_frontend.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # functions for setting up app frontend
4 |
5 | #######################################
6 | # installed node packages
7 | # Arguments:
8 | # None
9 | #######################################
10 | frontend_node_dependencies() {
11 | print_banner
12 | printf "${WHITE} 💻 Instalando dependências do frontend...${GRAY_LIGHT}"
13 | printf "\n\n"
14 |
15 | sleep 2
16 |
17 | sudo su - deploy < /home/deploy/${nome_instancia}/frontend/.env
68 | VUE_URL_API=${backend_url}
69 | VUE_FACEBOOK_APP_ID='23156312477653241'
70 | [-]EOF
71 | EOF
72 |
73 | sleep 2
74 | }
75 |
76 | #######################################
77 | # gera arquivo server.js
78 | #
79 | #
80 | #######################################
81 | frontend_serverjs() {
82 | print_banner
83 | printf "${WHITE} 💻 gerar arquivo server.js (frontend)...${GRAY_LIGHT}"
84 | printf "\n\n"
85 |
86 | sleep 2
87 |
88 | sudo su - deploy << EOF
89 | cat <<[-]EOF > /home/deploy/${nome_instancia}/frontend/server.js
90 | // simple express server to run frontend production build;
91 | const express = require('express')
92 | const path = require('path')
93 | const app = express()
94 | app.use(express.static(path.join(__dirname, 'dist/pwa')))
95 | app.get('/*', function (req, res) {
96 | res.sendFile(path.join(__dirname, 'dist/pwa', 'index.html'))
97 | })
98 | app.listen(${frontend_porta})
99 | [-]EOF
100 | EOF
101 |
102 | sleep 2
103 | }
104 |
105 | #######################################
106 | # starts frontend using pm2 in
107 | # production mode.
108 | # Arguments:
109 | # None
110 | #######################################
111 | frontend_start_pm2() {
112 | print_banner
113 | printf "${WHITE} 💻 Iniciando pm2 (backend)...${GRAY_LIGHT}"
114 | printf "\n\n"
115 |
116 | sleep 2
117 |
118 | sudo su - deploy < /etc/nginx/sites-available/${nome_instancia}-frontend << 'END'
144 | server {
145 | server_name $frontend_hostname;
146 |
147 | location / {
148 | proxy_pass http://127.0.0.1:${frontend_porta};
149 | proxy_http_version 1.1;
150 | proxy_set_header Upgrade \$http_upgrade;
151 | proxy_set_header Connection 'upgrade';
152 | proxy_set_header Host \$host;
153 | proxy_set_header X-Real-IP \$remote_addr;
154 | proxy_set_header X-Forwarded-Proto \$scheme;
155 | proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
156 | proxy_cache_bypass \$http_upgrade;
157 | }
158 | }
159 |
160 |
161 | END
162 |
163 | ln -s /etc/nginx/sites-available/${nome_instancia}-frontend /etc/nginx/sites-enabled
164 | EOF
165 |
166 | sleep 2
167 | }
168 |
--------------------------------------------------------------------------------
/lib/_inquiry.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | software_update() {
4 |
5 | whatsappweb_update
6 | }
7 |
8 | 2instancia_instalar() {
9 | system_unzip_izing
10 | criar_banco_dados
11 | backend_set_env
12 | backend_node_dependencies
13 | backend_node_build
14 | backend_db_migrate
15 | backend_db_seed
16 | backend_start_pm2
17 | backend_nginx_setup
18 | frontend_set_env
19 | frontend_node_dependencies
20 | frontend_node_build
21 | frontend_serverjs
22 | frontend_start_pm2
23 | frontend_nginx_setup
24 | system_nginx_restart
25 | system_certbot_setup
26 | system_success
27 | }
28 |
29 | izing_atualizar() {
30 | git_update
31 | backend_node_dependencies
32 | backend_node_build
33 | backend_db_migrate
34 | restart_pm2
35 | frontend_node_dependencies
36 | frontend_node_build
37 | }
38 |
39 | ativar_firewall () {
40 | iniciar_firewall
41 | }
42 |
43 | desativar_firewall () {
44 | parar_firewall
45 | }
46 |
47 | Erro_global () {
48 | erro_banco
49 | }
50 |
51 | inquiry_options() {
52 |
53 | print_banner
54 | printf "${WHITE} 💻 O que você precisa fazer?${GRAY_LIGHT}"
55 | printf "\n\n"
56 | printf " [1] Instalar\n"
57 | printf " [2] Atualizar Conector WWebJS whatsapp.js\n"
58 | printf " [3] Instalar 2 instancia\n"
59 | printf " [4] Atualizar Izing\n"
60 | printf " [5] Ativar Firewall\n"
61 | printf " [6] Desativar Firewall\n"
62 | printf " [7] Erro global/pg_filenode.map\n"
63 | printf "\n"
64 | read -p "> " option
65 |
66 | case "${option}" in
67 | 1) get_urls ;;
68 |
69 | 2)
70 | software_update
71 | exit
72 | ;;
73 |
74 | 3) 2instancia_instalar
75 | exit
76 | ;;
77 |
78 | 4) izing_atualizar
79 | exit
80 | ;;
81 |
82 | 5)
83 | ativar_firewall
84 | exit
85 | ;;
86 |
87 | 6)
88 | desativar_firewall
89 | exit
90 | ;;
91 |
92 | 7)
93 | Erro_global
94 | exit
95 | ;;
96 |
97 | *) exit ;;
98 | esac
99 | }
100 |
101 |
--------------------------------------------------------------------------------
/lib/_system.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # system management
4 |
5 | #######################################
6 | # creates user
7 | # Arguments:
8 | # None
9 | #######################################
10 | system_create_user() {
11 | print_banner
12 | printf "${WHITE} 💻 Agora, vamos criar o usuário para deploy...${GRAY_LIGHT}"
13 | printf "\n\n"
14 |
15 | sleep 2
16 |
17 | sudo su - root < /etc/docker/daemon.json
43 | systemctl restart docker
44 | sed -i -e 's/DEFAULT_FORWARD_POLICY="DROP"/DEFAULT_FORWARD_POLICY="ACCEPT"/g' /etc/default/ufw
45 | ufw reload
46 | wget -q -O /usr/local/bin/ufw-docker https://github.com/chaifeng/ufw-docker/raw/master/ufw-docker
47 | chmod +x /usr/local/bin/ufw-docker
48 | ufw-docker install
49 | systemctl restart ufw
50 | EOF
51 |
52 | sleep 2
53 | }
54 |
55 | iniciar_firewall() {
56 | print_banner
57 | printf "${WHITE} 💻 Iniciando Firewall...${GRAY_LIGHT}"
58 | printf "\n\n"
59 |
60 | sleep 2
61 |
62 | sudo su - root < /dev/null
221 | sudo apt-get update
222 | apt install -y docker-ce
223 | EOF
224 |
225 | sleep 2
226 | }
227 |
228 | #######################################
229 | # Ask for file location containing
230 | # multiple URL for streaming.
231 | # Globals:
232 | # WHITE
233 | # GRAY_LIGHT
234 | # BATCH_DIR
235 | # PROJECT_ROOT
236 | # Arguments:
237 | # None
238 | #######################################
239 | system_puppeteer_dependencies() {
240 | print_banner
241 | printf "${WHITE} 💻 Instalando puppeteer dependencies...${GRAY_LIGHT}"
242 | printf "\n\n"
243 |
244 | sleep 2
245 |
246 | sudo su - root < /etc/nginx/conf.d/izingio.conf << 'END'
389 | client_max_body_size 100M;
390 | large_client_header_buffers 16 5120k;
391 | END
392 |
393 | EOF
394 |
395 | sleep 2
396 | }
397 |
398 | #######################################
399 | # installs nginx
400 | # Arguments:
401 | # None
402 | #######################################
403 | system_certbot_setup() {
404 | print_banner
405 | printf "${WHITE} 💻 Configurando certbot...${GRAY_LIGHT}"
406 | printf "\n\n"
407 |
408 | sleep 2
409 |
410 | backend_domain=$(echo "${backend_url/https:\/\/}")
411 | frontend_domain=$(echo "${frontend_url/https:\/\/}")
412 | admin_domain=$(echo "${admin_url/https:\/\/}")
413 |
414 | sudo su - root <