From 07d5c406f4e5bbaad27851f4b146b36e9bd60a5f Mon Sep 17 00:00:00 2001 From: Aeris Date: Fri, 3 Sep 2021 03:00:36 +0200 Subject: [PATCH] docs updated --- README.md | 88 +++++++++++++------------------------------------------ 1 file changed, 20 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index e3709f3..65203d7 100644 --- a/README.md +++ b/README.md @@ -72,80 +72,32 @@ access to the external component to only people on your server. (On prosody, add ### Step 2: set up the database and storage for the bridge -I'm going to assume you want to store bridge data at the path `/wx`. Replace this path -with wherever you actually want to put the data in the commands below. - -Set up the database schema: +Prepare your `docker-compose.yml` like this: -``` -$ sqlite3 /wx/data.sqlite3 < ./schema.sql ``` -Then, configure the bridge -- replacing the values below with the actual values: + whatsxmpp: + build: ./whatsxmpp + depends_on: + - ejabberd + links: + - "ejabberd:ejabberd" + volumes: + - ./data/whatsxmpp:/data + environment: + - SERVER=ejabberd # Server-Address (Name,IP,etc) + - COMPONENT_NAME=wx.eris.cc + - SECRET=whatsappsucks + - UPLOAD_NAME=upload.eris.cc # Name of the upload-component + - PORT=5234 # Port on the Jabber server to connect to + - MAM=yes # Any value will be accepted as true; disable by commenting out + - HISTORY=yes # Any value will be accepted as true; disable by commenting out + - DATABASE_PATH=/data ``` -$ sqlite3 /wx/data.sqlite3 -SQLite version 3.31.1 2020-01-27 19:55:54 -Enter ".help" for usage hints. -sqlite> INSERT INTO configuration (rev, server, port, component_name, shared_secret, upload_component_name) VALUES (1, "capulet.lit", 5347, "whatsapp.capulet.lit", "juliet", "upload.capulet.lit"); -sqlite> .quit -``` +On failure while setting up ( e.g. wrong ip, secret, etc. ) you have to delete the created database in your volume. Check the logs for this -A few things to note here: - -- The `port` is whatever port your XMPP server accepts incoming component connections on (*not* client-to-server or server-to-server connections!). For prosody, the default is 5347. -- The `component_name` is whatever you specified in the prosody config for this component. -- The `shared_secret` is the same as the `component_secret`. -- The `upload_component_name` is the name of the XEP-0363 HTTP Upload component. - -#### Enabling archiving and full history fetches - -If you want to be able to use the MAM and full history fetch features, you'll need to run some additional commands in the above `sqlite3` window. - -To let users use MAM: - -``` -sqlite> UPDATE configuration SET allow_archiving = true; -``` - -To let users fetch their WhatsApp history: - -``` -sqlite> UPDATE configuration SET allow_history_fetches = true; -``` - -**WARNING:** These options are NOT recommended for people wishing to run a public instance of the bridge. (In fact, if you're doing that, come talk to us in the support MUC first, as there are various things you probably want to be made aware of.) - -Note that users must still enable archiving manually via talking to the admin user and executing the `enable-archiving` command (and similarly for history fetches, which use the `full-history-fetch` command). - - -### Step 3: run the bridge - -You can build the Docker image yourself from the `Dockerfile` in the repo, or you can just -use my hosted copy. (Don't download it a ton you guys, I pay for this stuff.) - -You'll want to pass through the directory (`/wx`, or whatever it is) where you created -the database as a Docker volume, so the container can access it. Then, supply the path -to the database as the first argument to the container. - -The hosted image is called `eu.gcr.io/etainfra/whatsxmpp`. Using the `docker` CLI, -you might run the bridge like so: - -``` -docker run \ - --name whatsxmpp \ - --restart always \ - -v /wx:/data \ - eu.gcr.io/etainfra/whatsxmpp \ - /data/data.sqlite3 -``` - -Consult the [Docker reference](https://docs.docker.com/engine/reference/run/) for more details -on this step, including how to run the image in the background and more! - -If you see `Connection complete! \o/` in the logs, it's working! - -### Step 4: set up the WhatsApp Web part +### Step 3: set up the WhatsApp Web part You'll interact with the bridge by talking to `admin@whatsapp.capulet.lit` (well, the last part of that JID will be different depending on your setup). Send this user