Closed barart closed 2 years ago
https://blog.logrocket.com/how-to-set-up-node-typescript-express/
Proposed usage:
npx @open-wa/wa-automate -p 8080 ---privkey "the content of privatekey.pem as appears in text editor" --cert "the content of certificate.pem as appears in text editor"
--allow-ips
--cert
& --privkey
--helmet
@github-actions run
@barart please try the new changes thanks
@github-actions run
Wow! let me check
i tried the ssl implementation and got error below
npx @open-wa/wa-automate -p 8080 --privkey "./private.pem" --cert "./pub.pem"
Same here using env on docker:
WA_HELMET = true WA_CERT = /ssl/mycert.pem WA_PRIVKEY = /ssl/mykey.pem
https dont open, http does, my .pem files are accesible and valid
@github-actions run
Should be working as expected now with the latest release
Should be working as expected now with the latest release
Thanks @smashah, unfortunately the fix does not work, i can only access on http and not https
@barart please share all of your logs
Here you are @smashah:
Starting the application
Using version: latest
./node_modules/@open-wa/wa-automate/bin/server.js --in-docker --qr-timeout 0 --popup --debug --force-port
up to date, audited 1068 packages in 11s
83 packages are looking for funding
run `npm fund` for details
16 vulnerabilities (6 moderate, 7 high, 3 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 8.15.0 -> 8.18.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.18.0>
npm notice Run `npm install -g npm@8.18.0` to update!
npm notice
- session_STARTUP
- DEBUG - PORT: 8080
- DEBUG - flags: {"sessionId":"session","executablePath":"/usr/bin/google-chrome","popup":true,"key":"XxXXxXXxXXxXXxXXxXXxXXxX","disableSpins":true,"useChrome":true,"privkey":"/ssl/key.pem","cert":"/ssl/cert.pem","helmet":true,"port":8080,"inDocker":true,"qrTimeout":0,"debug":true,"forcePort":true,"noApi":false,"host":"localhost","verbose":false,"ef":["qr","STARTUP","MD_DETECT"],"allowSessionDataWh":false,"generateApiDocs":true,"sessionDataOnly":false,"skipSavePostmanCollection":false,"headful":false,"preAuthDocs":false,"stats":false,"noKillOnLogout":false,"cors":false,"socket":false,"emitUnread":false,"allowIps":[]}
- DEBUG - env vars: {"WA_EXECUTABLE_PATH":"/usr/bin/google-chrome","WA_POPUP":"true","WA_KEY":"XxXXxXXxXXxXXxXXxXXxXXxX","WA_DISABLE_SPINS":"true","WA_USE_CHROME":"true","WA_PRIVKEY":"/ssl/key.pem","WA_CERT":"/ssl/cert.pem","WA_HELMET":"true","WA_PORT":"8080"}
- Launching EASY API
- Selected port is free
- Generating Swagger Spec
- Postman collection generated: open-wa-session.postman_collection.json
- API collections (swagger + postman) generated successfully
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃┃┃ @open-wa/wa-automate
┃┃ 💬 🤖 The most reliable NodeJS whatsapp library for chatbots with
┃┃ advanced features.
┃┃ Version: 4.44.2
┃┃ Check out the latest changes:
┃┃ https://github.com/open-wa/wa-automate-nodejs#latest-changes
┃┃
┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
You can also authenticate the session at: http://localhost:8080
- Starting
- Version: 4.44.2
- Initializing WA
- Using custom chromium args with multi device will cause issues! Please remove them:
- Launching Browser
- MD Enabled, turning off incognito mode.
- Data dir: /sessions/_IGNORE_session
- Data dir doesnt exist, creating...: /sessions/_IGNORE_session
- Browser launched: 2052ms
- Setting Up Page
- Loading session data
- No session data file found for session : session
- No session data detected. Opting in for MD.
- Make sure to keep the session alive for at least 5 minutes after scanning the QR code before trying to restart a session!!
- Pre page launch setup complete: 26ms
- Navigating to WA
- Page loaded in 2193ms: 200
- Page loaded
- Debug info: {
"WA_VERSION": "2.2230.13",
"PAGE_UA": "WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
"WA_AUTOMATE_VERSION": "4.44.2",
"BROWSER_VERSION": "HeadlessChrome/104.0.5112.101",
"OS": "Linux 5.10",
"START_TS": 1660776246578,
"RAM_INFO": "Total: 1.02 GB | Free: 0.34 GB",
"PPTR_VERSION": "15.0.0"
}
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2230.13%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.44.2%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/104.0.5112.101%22,%0A%20%20%22START_TS%22:%201660776246578,%0A%20%20%22RAM_INFO%22:%20%22Total:%201.02%20GB%20%7C%20Free:%200.34%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2215.0.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20true%0A%7D&enviro=-%20OS:%20Linux%205.10%0A-%20Node:%2018.7.0%0A-%20npm:%208.15.0&labels=CLI,MD
- Time to injection: 6108ms
- Injecting api
- Injecting scripts
- Base inject: 248ms
- WAPI inject: 709ms
- Checking session integrity
- Session integrity check passed
- Launch inject: 1904ms
- WAPI injected
- Authenticating
- Authenticate to continue
- First QR: 12835 ms
@barart I need all of the logs.
If successful, it should show something like this at the end
You've cut off your logs right before the first qr code. HTTPS is only enabled at the end of the launch process of an authenticated session.
If you want to scan QR codes using https then please use --ezqr
@barart
Thats all the logs @smashah, after the last line the qr code start to appearing in order to scan it, unfortunately on docker when recreate/update the container the session is deleted so i need to create a new session each time i update open-wa, im not scanning the code when it ask to scan the code in console logs because my phone does not recognize it, instead i go to the url with https in order to scan it on the browser and there is when i found that the https does not work only http,
I dont want to scan the code on http because if i scan it and then recreate the container again to test if https works when a fix comes 2-3 or more times in few minutes or in a short period i dont want to give WA a reason to ban my number
I also want to test the allow-ips feature and i dont want to scan the code more times for test this feature too
Im trying to make https works first, then check the allow-ips feature and then when everything is working fine scan the code to create a unique session
You've cut off your logs right before the first qr code. HTTPS is only enabled at the end of the launch process of an authenticated session.
If you want to scan QR codes using https then please use
--ezqr
@barart
Ohhh i see... i did not know that, let me try
Thats all the logs @smashah, after the last line the qr code start to appearing in order to scan it, unfortunately on docker when recreate/update the container the session is deleted so i need to create a new session each time i update open-wa, im not scanning the code when it ask to scan the code in console logs because my phone does not recognize it, instead i go to the url with https in order to scan it on the browser and there is when i found that the https does not work only http,
I dont want to scan the code on http because if i scan it and then recreate the container again to test if https works when a fix comes 2-3 or more times in few minutes or in a short period i dont want to give WA a reason to ban my number
I also want to test the allow-ips feature and i dont want to scan the code more times for test this feature too
Im trying to make https works first, then check the allow-ips feature and then when everything is working fine scan the code to create a unique session
In order to not have to scan every time you want to make a configuration change use the npx
based CLI instead. It can be run from within a local folder so you don't destroy the session every time you want to make a change:
> npx @open-wa/wa-automate
In the same folder you can have a cli.config.json file also where you can set all the config options
You've cut off your logs right before the first qr code. HTTPS is only enabled at the end of the launch process of an authenticated session.
If you want to scan QR codes using https then please use
--ezqr
@barart
So i enabled the --ezqr and then i go to my https-url:port and still giving me the same error, and if i go to my http-url:port i can see the qrcode to scan, so the --ezqr option is not enabling the https on the QR codes part neither, i dont think the QRcode scan is a issue on http, but i thought configuring the cert and privkey will enable https on all the open-wa system and i was testing the https feature when starting the container after update it (no session because is a recreated container)...
In order to not have to scan every time you want to make a configuration change use the
npx
based CLI instead. It can be run from within a local folder so you don't destroy the session every time you want to make a change:> npx @open-wa/wa-automate
In the same folder you can have a cli.config.json file also where you can set all the config options
I barely understand this... im using the docker image to create a container, i dont think this will be possible on docker, or am I not understanding correctly? although I understand, in order to run npx @open-wa/wa-atomate i need to run it outside the container and in order to run it outside the container i need to install node/npx, needed packages, and all open-wa dependecies on the node right? This will break all the beauty and purpose of docker... and in the end i will be running wa-automate directly on the node, that it will break in some point when a break changes updates arrive on the node, os, dependencies or with conflicting packages...
Maybe if there would be a way to keep the session on a container recreation/upgrade as other docker containers would be very useful for updates/upgrades or at least to specify a custom route of cli-config.json file so i can map it to a file on the node and it will help to change the configuration and reboot the container (reboot do not destroy the session) so it can pick the new configuration, is there a way to do that?
@barart
--ezqr
results in the qr code being uploaded to openwa qr service. The logs should show something like this:
Scan the qr code at https://qr.openwa.cloud/7ad63
You can then open that link and scan that URL.
if you want to receive that URL via webhook, you can add --ef qrUrl --ev https://somewebhook.com/12345
to the end of of your CLI command.
You only need to install node/npm in order to run an npx
command.
npx
commands automatically install all necessary dependencies.
When you scan a qr code there is a folder (called something like IGNORE_session
which will be created. This folder is what houses your session. If you delete this session folder you will have to scan again. If you move this folder to another computer, you will have to scan again. This folder is very temperamental.
Docker is great, which is why I bothered to make a docker package but the main limitation is the fact that it destroys the container if you want to edit the runtime configuration. Each new docker container is essentially a whole new machine and thus has a new machine ID. This change in machine ID means that you can't maintain the session folder between containers.
The reason I am asking you to use npx when trying new configurations is so you dont have this issue of scanning the qr code every single time. With npx, the session authentication is maintained between chrome versions, node versions, npm versions, open-wa versions, OS versions etc. Why? because the folder stays in the same place and the machine ID doesn't change. This way you can do rapid development or learn how to use open-wa in an easier way.
When you have a configuration that is working then you can go back to using docker.
Download/install node (which will install npm and npx automatically) then make a new folder in your machine to use the npx command in.
> mkdir owa
> npm init -y #initialize a node project
> npm i @open-wa/wa-automate #This caches the library and it's dependencies locally so you dont download it every time
# move your cert and privkey here
# Run the EASY API
> npx @open-wa/wa-automate --cert mycert.pem --privkey mykey.pem --helmet --ezqr --ef qrUrl --ev https://somewebhook.com/12345
@smashah I understand it better, thanks for your time to explain it 👌🏻 i definitively will do that
I have a question.. i see that there is a config variable:
{ name: 'config', alias: 'c', type: String, typeLabel: '{yellowBright {underline ./config.json}}', description: "The relative json file that contains the config. By default the system will look for config.json which will override any config variables set. Default: './config.json'." }
If i create a config.json file and move all my ENV Variables to this file and only put this config file on the ENV.. does this will work? Im wondering a way to change the settings on the container without recreate it... 🤔 if this work we can change some settings in this way without need to destroy the session only with a simple reboot on the container, and only destroy the session on a container recreation or upgrade
@barart the default is actually cli.config.json
. The docs needs to be fixed.
And yes you can actually do that by creating a cli.config.js
file with a default export that returns an object or async function. (#2844)
https://github.com/open-wa/wa-automate-nodejs/commit/f0253933c4b03579503f956b279912b259149edb
In the async function you can possibly request the whole config from an API
Actually I don't think it can take the default export as a function yet. Try it out see if it works
with version 4.44.2 i can confirm Easy-Api working with https
i have tested npx @open-wa/wa-automate -p 8080 --helmet true --privkey "./ssl/private.pem" --cert "./ssl/Pub.pem"
but using as below didn't work
npx @open-wa/wa-automate -p 8080 --helmet true --privkey "key as text" --cert "key as text"
@barart the default is actually
cli.config.json
. The docs needs to be fixed.* [ ] Fix CLI config.json error
And yes you can actually do that by creating a
cli.config.js
file with a default export that returns an object or async function.In the async function you can possibly request the whole config from an API
@smashah
So... i created a cli.config.json file and i specify it on the ENV:
WA_CONFIG = /config/cli.config.json
My cli.config.json has this:
{
"WA_CERT": "/ssl/cert.pem",
"WA_HELMET": true,
"WA_KEY": "XxXxXxXxXxXxXxXxXxXxXxXxX",
"WA_PRIVKEY": "/ssl/key.pem",
"WA_EZQR": true,
"WA_PORT": 9090,
"PORT": 9090
}
But and when i run the container i dont see that it picks the config file as you can see on the debug log:
- DEBUG - flags: {"sessionId":"session","executablePath":"/usr/bin/google-chrome","popup":true,"disableSpins":true,"useChrome":true,"config":"/config/cli.config.json","port":8080,"inDocker":true,"qrTimeout":0,"debug":true,"forcePort":true,"noApi":false,"host":"localhost","verbose":false,"ef":["qr","STARTUP","MD_DETECT"],"allowSessionDataWh":false,"generateApiDocs":true,"sessionDataOnly":false,"skipSavePostmanCollection":false,"headful":false,"preAuthDocs":false,"stats":false,"noKillOnLogout":false,"cors":false,"socket":false,"emitUnread":false,"allowIps":[]}
- DEBUG - env vars: {"WA_EXECUTABLE_PATH":"/usr/bin/google-chrome","WA_POPUP":"true","WA_DISABLE_SPINS":"true","WA_USE_CHROME":"true","WA_CONFIG":"/config/cli.config.json","WA_PORT":"8080"}
It use port 8080 (that is not the port i put on my cli.config.json) and all the other settings are missing, also after run the container i see that it adds the ports 8080 on the ENV
Im using it correctly?
@barart you js configs have a different format (pascal case) without the preceding WA_
See:
https://openwa.dev/docs/api/interfaces/api_model_config.ConfigObject
So for example the config privkey
is WA_PRIVKEY
as env var or --privkey
as a CLI option/flag.
Another example:
config: useChrome
flag: --use-chrome
env var: WA_USE_CHROME
So your config should be:
{
"cert": "/ssl/cert.pem",
"helmet": true,
"key": "XxXxXxXxXxXxXxXxXxXxXxXxX",
"privkey": "/ssl/key.pem",
"ezqr": true
}
I removed the port because it's not advisable to mess with the port assignments in the docker image.
@smashah
I changed my config file but when i run the container it dont pass the options:
My config file:
{
"cert": "/ssl/cert.pem",
"helmet": true,
"key": "XxXxXxXxXxXxXxXxXxXxXxXxX",
"privkey": "/ssl/key.pem",
"ezqr": true
}
My debug log:
- DEBUG - flags: {"sessionId":"session","executablePath":"/usr/bin/google-chrome","popup":true,"disableSpins":true,"useChrome":true,"config":"/config/cli.config.json","port":8080,"inDocker":true,"qrTimeout":0,"debug":true,"forcePort":true,"noApi":false,"host":"localhost","verbose":false,"ef":["qr","STARTUP","MD_DETECT"],"allowSessionDataWh":false,"generateApiDocs":true,"sessionDataOnly":false,"skipSavePostmanCollection":false,"headful":false,"preAuthDocs":false,"stats":false,"noKillOnLogout":false,"cors":false,"socket":false,"emitUnread":false,"allowIps":[]}
- DEBUG - env vars: {"WA_EXECUTABLE_PATH":"/usr/bin/google-chrome","WA_POPUP":"true","WA_DISABLE_SPINS":"true","WA_USE_CHROME":"true","WA_CONFIG":"/config/cli.config.json","WA_PORT":"8080"}
What im missing here? 🤔
@barart I can't help you out with slivers of logs and missing CLI command.
Please share everything, including the whole docker run command
@smashah Here is my docker run command:
docker run --name=open-wa --env=WA_CONFIG=/config/cli.config.json --volume=/containers/open-wa/config:/config --volume=/containers/open-wa/ssl:/ssl -p 8080:8080 --restart=always --init openwa/wa-automate:latest
My cli.config.json:
{
"cert": "/ssl/cert.pem",
"helmet": true,
"key": "xXxxXXxxXXxxxxxXXX",
"privkey": "/ssl/key.pem",
"ezqr": true
}
And my full log:
Starting the application
Using version: latest
./node_modules/@open-wa/wa-automate/bin/server.js --in-docker --qr-timeout 0 --popup --debug --force-port
up to date, audited 1068 packages in 8s
83 packages are looking for funding
run `npm fund` for details
16 vulnerabilities (6 moderate, 7 high, 3 critical)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
npm notice
npm notice New minor version of npm available! 8.15.0 -> 8.18.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.18.0>
npm notice Run `npm install -g npm@8.18.0` to update!
npm notice
- session_STARTUP
- DEBUG - PORT: 8080
- DEBUG - flags: {"sessionId":"session","executablePath":"/usr/bin/google-chrome","popup":true,"disableSpins":true,"useChrome":true,"config":"/config/cli.config.json","port":8080,"inDocker":true,"qrTimeout":0,"debug":true,"forcePort":true,"noApi":false,"host":"localhost","verbose":false,"ef":["qr","STARTUP","MD_DETECT"],"allowSessionDataWh":false,"generateApiDocs":true,"sessionDataOnly":false,"skipSavePostmanCollection":false,"headful":false,"preAuthDocs":false,"stats":false,"noKillOnLogout":false,"cors":false,"socket":false,"emitUnread":false,"allowIps":[]}
- DEBUG - env vars: {"WA_EXECUTABLE_PATH":"/usr/bin/google-chrome","WA_POPUP":"true","WA_DISABLE_SPINS":"true","WA_USE_CHROME":"true","WA_CONFIG":"/config/cli.config.json","WA_PORT":"8080"}
- Launching EASY API
- Selected port is free
- Generating Swagger Spec
- Postman collection generated: open-wa-session.postman_collection.json
- API collections (swagger + postman) generated successfully
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃ ┃┃ @open-wa/wa-automate ┃┃ 💬 🤖 The most reliable NodeJS whatsapp library for chatbots with ┃┃ advanced features. ┃┃ Version: 4.44.2 ┃┃ Check out the latest changes: ┃┃ https://github.com/open-wa/wa-automate-nodejs#latest-changes ┃┃ ┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
You can also authenticate the session at: http://localhost:8080
- Starting
- Version: 4.44.2
- Initializing WA
- Using custom chromium args with multi device will cause issues! Please remove them:
- Launching Browser
- MD Enabled, turning off incognito mode.
- Data dir: /sessions/_IGNORE_session
- Data dir doesnt exist, creating...: /sessions/_IGNORE_session
- Browser launched: 1590ms
- Setting Up Page
- Loading session data
- No session data file found for session : session
- No session data detected. Opting in for MD.
- Make sure to keep the session alive for at least 5 minutes after scanning the QR code before trying to restart a session!!
- Pre page launch setup complete: 23ms
- Navigating to WA
- Page loaded in 2275ms: 200
- Page loaded
- Debug info: {
"WA_VERSION": "2.2230.13",
"PAGE_UA": "WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36",
"WA_AUTOMATE_VERSION": "4.44.2",
"BROWSER_VERSION": "HeadlessChrome/104.0.5112.101",
"OS": "Linux 5.10",
"START_TS": 1660844493423,
"RAM_INFO": "Total: 1.02 GB | Free: 0.36 GB",
"PPTR_VERSION": "15.0.0"
}
- Use this easy pre-filled link to report an issue: https://github.com/open-wa/wa-automate-nodejs/issues/new?template=bug_report.yaml&d_info=%7B%0A%20%20%22WA_VERSION%22:%20%222.2230.13%22,%0A%20%20%22WA_AUTOMATE_VERSION%22:%20%224.44.2%22,%0A%20%20%22BROWSER_VERSION%22:%20%22HeadlessChrome/104.0.5112.101%22,%0A%20%20%22START_TS%22:%201660844493423,%0A%20%20%22RAM_INFO%22:%20%22Total:%201.02%20GB%20%7C%20Free:%200.36%20GB%22,%0A%20%20%22PPTR_VERSION%22:%20%2215.0.0%22,%0A%20%20%22LATEST_VERSION%22:%20true,%0A%20%20%22CLI%22:%20true%0A%7D&enviro=-%20OS:%20Linux%205.10%0A-%20Node:%2018.7.0%0A-%20npm:%208.15.0&labels=CLI,MD
- Time to injection: 12038ms
- Injecting api
- Injecting scripts
- Base inject: 437ms
- WAPI inject: 1023ms
- Checking session integrity
- Session integrity check passed
- Launch inject: 1291ms
- WAPI injected
- Authenticating
- Authenticate to continue
- First QR: 19150 ms
┌────────────────────────── session ──────────────────────────┐
│ │
│ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ │
│ █ ▄▄▄▄▄ █▀███▀▄█▄█▄█▀▀█▄█▄▀▄█▄▄ ▀██▀█▄▄█▄█▄ ▀██ ▄▄▄▄▄ █ │
│ █ █ █ █▀▀▀ █▀▄ ▀ ▄▀█▄▀▄ ▀█▄▀ ▄▄▄ ▄▄▄█▀▀▄▀█ █ █ █ │
│ █ █▄▄▄█ █▀ ▄▄█▀▀███ ▀▀▀█ ▄▄▄ ▄ █ ▄▀▄ ▄█▀█ ███ █▄▄▄█ █ │
│ █▄▄▄▄▄▄▄█▄▀ ▀▄█ ▀▄▀ ▀▄▀▄█ █▄█ ▀ █ █▄▀▄▀▄█▄█ █ █▄▄▄▄▄▄▄█ │
│ █ ▄ █▄▄▄▄ ▀ ▄▄▄▀▄▄▄▄▄▀▀▄▄ ▄▄▀▀ █ █▀ ▀██▀▀▀ ▄ █▄▀ ▀ ▀█ │
│ █▄██▄ ▄█ ███ ▀▄ ▀▀ █▀█ █▀█▄▀█▄█▄▀▄▄▄▄█▄ █▀▄ ▄▄▄▀██ │
│ █ ▄ ▀██▄ ▀▄▀█▄▀▀▀▄▄▄ ▄ ▀▄▀ ██▀ ▀ ▀██▀▄▄██▀▀ ▄█▄▀ ██ │
│ █████▄█▄▄▀▄▄ ▀█▀▄▀▀▄█▄▀█▀▀▄██▀▀█▀▄▄▄ ▄▄ ▀█ ▄▄ ▄▀ ██▀█ │
│ █ █▀▄█ ▄ ▄▀█▀█▀█▀█▄▄▀▄▄▀ ▄█▀▀▄▀ ▄▀▄█ ▄▄██▀▀ ▄▄▄ ▄ ██▄█ │
│ █▀ █ ▀▀▄█▀▀ █▀▀█▀█ ██ ▀▀▀▄██▄▀▄▄ ▄▄▄▄█ ▀ ▀▄ █ ▄ ▄▀██ │
│ █ ▀▀▄▀▀▄▄▄▀ █▄ █▄▄█▄▀███▀ █▀ █▀ ▀ ▄ ▀▄ ▀▄ ▄███ ▀█▀██ │
│ █▄▄▀█▄▀▄▄▄█▀ █▄ ▄▄ ▀█▄██▄▀ █▀▀▄▀▄ ▀▄▀██▄ ▀ ▀▄ ▄▄ ▀ █▀▀█ │
│ █▀▀ ▄ ▄▄▄ █▀▄█▄▄▄▀▄ ▄▀█▄ ▄▄▄ ▀▀ ▀▀█ ▄ ███ █ ▄▄▄ ▀█▀█ │
│ █████ █▄█ ██▄█ █▄ ▀█▀█ ▀ █▄█ █▀▀▄▀█▀█▄ ▄ ▄ █▄█ █▄ ██ │
│ ██▄▄ ▄ ▄▄ ▄▄▄ ▀▀▀▄▄▄ █▄▀ ▄████▄▄▄ ▀▀▀█▄ ▄▄▄██ │
│ █▄▀█▀▀▄▄█ ▄ ▄▀▀███ ▀█▀ ▀█ █ ▄██▄▀▄▀▄▄▄▄▄▀ █▀▄▀▀█ ▄▄▀██ │
│ ██▄▄▄ █▄▀ ▄▄▀ ▀█▀█▀▄▀▄▀█ ▀▀▀ ▀▀▀ ▀██▄▄ █▀█ ███▄█▀▄▄ ▄█ │
│ ███▄▄█▄▄▀█▄▄█▄██▀█▀ █▄▄▄█▀█▀████ ▄▄▀██ ▀ ▀▀▄▀█ ▄▀▄▀▀█ │
│ █ █▀▀▀ ▄ ▄▄██▄█▀▄ ▄ ▄▀█▀▀▄▀▄▄█ ▄█▄▄▀▄▀█▀▀▀ ██▀█ ▀█▀▄▀█ │
│ ██▀▄ ▀█▄▀▀▀▄▄▄▄ ▀ ▀ ▄ ▀▀▄▀▄█▀█▄▄▄▀█▀█▀█ █▀▀▄▀█ █▀█▄▀█ │
│ █▄▀ ▀▀▄█▀▄▀██▄▄▄▀█ ▀▄██▄█▄███▀ ▀▄█▄ ▄ █ ▀▄ ▀▄▀▀▀█▀█ │
│ █▄ ▀▄▄▄▄█▄██▄▀▄ ▄ ▀▀▀▄▀█▀ █▄▄█▄▀ ▄▄ ▀ ▀▀ ▀▄▄▀ ▄ █▄██ │
│ ████▄██▄█▀▀▀ ▀▀▄█▄ ▄▀▄██▄ ▄▄▄ ▀▀█▄█ █▀▀ ▀ ▄▄▄ ▀▀▄▄█ │
│ █ ▄▄▄▄▄ █▄█▀▀█▀▀▄ ▄█▄▀▀█▀ █▄█ ▀ ▄ ▄ ▀ ▀███ ▄▄ █▄█ ▄█▀█ │
│ █ █ █ █ ▄▄▀ ▀▄▀█▄▀ ███▀▄ ▄ ▄█ ▀▄█▄ ▀▄▀█▀ █ ▄ ▄▄▀██▄█ │
│ █ █▄▄▄█ █ ▀▄██▀▀▀█ ▄▄▄▄▀▀▄██▄ █ ▄ ▀█▄▀ ▄█ ▀██ ▀▄▀▄█ │
│ █▄▄▄▄▄▄▄█▄██▄███▄█▄▄▄▄▄█▄▄█▄▄██████▄█▄▄████▄▄█▄██▄█████ │
│ │
│ │
└─────────────────────────────────────────────────────────────┘
Try mounting your config folder to /usr/src/app
as that's where the process runs from anyway.
So try this
docker run --name=open-wa --volume=/containers/open-wa/config:/usr/src/app --volume=/containers/open-wa/ssl:/ssl -p 8080:8080 --restart=always --init openwa/wa-automate:latest
Try mounting your config folder to
/usr/src/app
as that's where the process runs from anyway.So try this
docker run --name=open-wa --volume=/containers/open-wa/config:/usr/src/app --volume=/containers/open-wa/ssl:/ssl -p 8080:8080 --restart=always --init openwa/wa-automate:latest
@smashah
When i run the container mounting the config folder to /user/src/app as you suggested open-wa cant run, my log only show this:
[dumb-init] ./start.sh: No such file or directory
After a lot trial and fail i find a way to load the settings from file but idk what of all i do make it works:
1) Changed the name of the file to cli.config.json 2) I add all this env:
WA_CONFIG = /path/to/my/cli.config.json
config = /path/to/my/cli.config.json
CONFIG = /path/to/my/cli.config.json
3) Mount a volume as the file (instead as a folder):
--volume=/path/to/my/cli.config.json:/usr/src/app/cli.config.json
And it worked, it picks my file config and the https is now enabled, i can confirm that the https feature is working as expected :D
now i need to test a "hot" change settings on the file and test the allow-ips feature, as i need to keep the bot running this weekend i will test it the Monday and update this so anyone can do the same
@barart that makes sense. the first time you were replacing everything in the /usr/src/app
folder which also replaced the start scripts.
There is a way to mount the volume where the data is synced between the container and the host but it's relatively more complicated:
docker volume create --driver local \
--opt type=none \
--opt device=/containers/open-wa/config \
--opt o=bind \
config_vol
then
docker run --name=open-wa --mount source=config_vol,target=/usr/src/app --volume=/containers/open-wa/ssl:/ssl -p 8080:8080 --restart=always --init openwa/wa-automate:latest
Theoretically, that would work (but I haven't tested)
Please track this issue to make mounting a cli.config.json
easier:
@barart
https://github.com/open-wa/wa-automate-docker/issues/54 is now resolved.
https://github.com/open-wa/wa-automate-docker/commit/490460c44597f6f1a350c8bcfdd9a1a37128d6a6
You can safely mount a host config folder to /config
without messing up the run scripts.
So this should now work:
> docker pull openwa/wa-automate:latest
> docker run --name=open-wa --volume=/containers/open-wa/config:/config --volume=/containers/open-wa/ssl:/ssl -p 8080:8080 --restart=always --init openwa/wa-automate:latest
and you can use a .js
file instead of .json
just in case you want to get your config from a a custom API or something
e.g
/containers/open-wa/config/cli.config.js
exports.default = async function(sessionId) => {
const chatwootConfiguration = await fetch(`http://myapi.com/getChatwootConfig?sessionId=${sessionId}`);
return {
cert: "/ssl/cert.pem",
helmet: true,
key: "xXxxXXxxXXxxxxxXXX",
privkey: "/ssl/key.pem",
ezqr: true
...chatwootConfiguration
}
}
Hello, new user here
Im using the docker version of wa-automate, if is possible to restrict api access by ip instead of a key? Anyone is able to send post requests without authorization
Also im wondering if a https requests are possible instead http, this would improve privacy of the api requests