Skip to content

Commit 0c27958

Browse files
authored
test: add staging environment and reproducing procedure
Add: - Prosody staging environment - reproducing operating procedure - stale workflow
1 parent 55e4900 commit 0c27958

File tree

11 files changed

+450
-0
lines changed

11 files changed

+450
-0
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
node_modules
55
dist
66
docs/ansible
7+
docs/staging-environments
78
docs/*.png
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow warns and then closes issues that have not met the reproducibility requirements for a specified amount of time.
2+
#
3+
# For more information, see:
4+
# https://github.com/actions/stale
5+
name: Close unreproduced issues
6+
7+
on:
8+
schedule:
9+
- cron: '43 */12 * * *'
10+
workflow_dispatch:
11+
12+
jobs:
13+
stale:
14+
15+
runs-on: ubuntu-latest
16+
permissions:
17+
issues: write
18+
pull-requests: write
19+
20+
steps:
21+
- uses: actions/stale@v5
22+
with:
23+
repo-token: ${{ secrets.GITHUB_TOKEN }}
24+
# stale delay:
25+
days-before-stale: 2
26+
days-before-pr-stale: -1
27+
# close delay:
28+
days-before-close: 13
29+
days-before-pr-close: -1
30+
# extra conditions
31+
only-labels: 'need repro'
32+
exempt-all-milestones: true
33+
# stale changes:
34+
stale-issue-label: 'stale'
35+
stale-issue-message: 'This issue will be closed within two weeks if the requested reproduction data is not provided. Please refer to this [guide](https://github.com/nioc/xmpp-web/tree/master/docs/staging-environments/REPRODUCING.MD ).'
36+
# close changes
37+
close-issue-reason: not_planned
38+
close-issue-label: 'wontfix'
39+
close-issue-message: 'This issue has been closed since it cannot be reproduced without the data you were asked for.'

CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,7 @@ If you are using Docker, you can use the [Dockerfile-dev](/docs/docker/Dockerfil
8181
6. Commit your changes (with a detailled message, using [conventional commits](https://www.conventionalcommits.org/)): `git commit -am 'feat(guest): Add an awesome feature for guest' -m 'Close #123'`
8282
7. Push to the branch: `git push origin feat#123-my_awesome_feature`
8383
8. Submit a pull request
84+
85+
### XMPP server backend
86+
87+
You can find some docker XMPP server setups in this [folder](/docs/staging-environments).

docs/staging-environments/README.MD

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# XMPP Web staging environments
2+
3+
Each folder contains a `docker-compose.yml` file and server configurations in order to help for bug reproducing.
4+
5+
| `service` | XMPP Server | Configuration |
6+
|-----------|--------------|-------------------------------------------------------|
7+
| prosody | Prosody 0.11 | [standard](prosody-std) with http upload, muc and mam |
8+
9+
You can submit a pull request to add different servers or configurations.
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Reproducing bug or feature request
2+
3+
You may have been asked to "*reproduce your problem*" with the [`need repro` issue label](https://github.com/nioc/xmpp-web/labels/need%20repro), so here is the operating procedure (you need to have Docker [Desktop](https://docs.docker.com/get-docker/) or [Engine](https://docs.docker.com/engine/install/) installed[^1]):
4+
5+
- clone this repo:
6+
7+
``` bash
8+
git clone https://github.com/nioc/xmpp-web.git
9+
```
10+
and go to the `docs/staging-environments/prosody-std/` folder,
11+
- change the server [configuration `prosody.cfg.lua`](prosody-std/prosody.cfg.lua) to reflect your own[^2],
12+
- add necessary modules (if any) in the `docs/staging-environments/prosody-std/modules` folder,
13+
- change XMPP Web `local.js` environment variables in [docker-compose.yml](prosody-std/docker-compose.yml) file to reflect your own[^2],
14+
- start containers (press `Ctrl` + `C` when you are done):
15+
16+
``` bash
17+
docker-compose -f "docker-compose.yml" up \
18+
&& docker-compose -f 'docker-compose.yml' --project-name 'prosody-std' down
19+
```
20+
- create any necessary data (room, chat, user configuration, ...)[^2],
21+
- reproduce your issue,
22+
- archive the whole `docs/staging-environments/prosody-std/` folder:
23+
24+
``` bash
25+
tar zcvf ../my-reproducing-setup.tar.gz ../prosody-std
26+
```
27+
- add the created archive to your issue.
28+
29+
:warning: Without this input, your issue will be dismissed (closed as *not planned*) by the stale bot after two weeks.
30+
31+
[^1]: If you do not like Docker, you can always reproduce without it by using the same type of installation to produce the expected archive.
32+
[^2]: This may seem obvious, but: **do not use your real dns or any user credentials**.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Prosody standard
2+
3+
This setup a standard Prosody 0.11.9 with:
4+
- websocket listening on `http://*:5280/xmpp-websocket` (cross domain authorized for `http://localhost`, `https://localhost` and `http://localhost:300`),
5+
- standard virtual host `localhost`,
6+
- MUC service `conference.localhost` (with vCard support),
7+
- anonymous virtual host `anon.localhost`,
8+
- XEP-0065 proxy65 (file transfers) service `proxy.localhost`,
9+
- XEP-0313 mam (message archiving),
10+
- XEP-0363 [`http_upload`](https://modules.prosody.im/mod_http_upload) additional plugin,
11+
12+
## Before first use
13+
14+
As [Prosody docker image](https://hub.docker.com/r/prosody/prosody) version is older than 0.12, we can not use plugin installer.
15+
16+
In order to download extra plugins in the `modules` folder, you need to paste the following command in a shell (in `docs/staging-environments/prosody-std/` folder):
17+
18+
``` bash
19+
wget \
20+
https://hg.prosody.im/prosody-modules/raw-file/f1f796e551f1/mod_http_upload/mod_http_upload.lua \
21+
https://hg.prosody.im/prosody-modules/raw-file/tip/mod_vcard_muc/mod_vcard_muc.lua \
22+
--directory-prefix modules
23+
```
24+
25+
## Docker compose
26+
27+
To start both Prosody and XMPP web:
28+
29+
``` bash
30+
docker-compose -f "docker-compose.yml" up
31+
```
32+
33+
To remove containers:
34+
``` bash
35+
docker-compose -f 'docker-compose.yml' --project-name 'prosody-std' down
36+
```
37+
38+
## Users
39+
40+
| Jid | Password |
41+
|-----------------|----------|
42+
| admin@localhost | admin |
43+
| user1@localhost | user1 |
44+
| user2@localhost | user2 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
version: "3.4"
2+
3+
services:
4+
5+
prosody:
6+
image: prosody/prosody:0.11.9
7+
ports:
8+
- "5222:5222" # client to server connections
9+
- "5280:5280" # HTTP (including websocket)
10+
- "5000:5000" # file transfer proxy
11+
volumes:
12+
- ./prosody.cfg.lua:/etc/prosody/prosody.cfg.lua:ro # Prosody configuration
13+
- ./data:/var/lib/prosody # store Prosody data (ignored by git repo)
14+
- ./modules:/usr/lib/prosody/custom-modules
15+
- ./entrypoint.sh:/entrypoint.sh:ro # added to register user1 and user2
16+
environment:
17+
# the 3 following variables register admin@localhost, user1@localhost and user2@localhost users (password = JID local part)
18+
- LOCAL=admin
19+
- PASSWORD=admin
20+
- DOMAIN=localhost
21+
extra_hosts:
22+
- "conference.localhost:127.0.0.1" # muc service
23+
- "upload.localhost:127.0.0.1" # file upload service
24+
- "anon.localhost:127.0.0.1" # anon host
25+
- "proxy.localhost:127.0.0.1" # file proxy service
26+
27+
xmpp-web:
28+
image: nioc/xmpp-web:latest
29+
ports:
30+
- "80:80"
31+
# - "443:443"
32+
environment:
33+
- APP_NAME=XMPP Web Docker latest
34+
# - APP_WS=ws://localhost/xmpp-websocket #default
35+
- APP_REGISTERED_ACCESS=1 #1/0
36+
- APP_GUEST_ACCESS=1 #1/0
37+
- XMPP_ANON_HOST=anon.localhost
38+
- APP_IS_TRANSPORTS_USER_ALLOWED=1 #1/0
39+
- APP_HTTP_AUTODISCOVERY=0 #1/0
40+
- APP_RESOURCE=Web XMPP Docker latest
41+
- APP_DEFAULT_DOMAIN=localhost #mandatory
42+
- APP_DEFAULT_MUC=conference.localhost
43+
- APP_IS_STYLING_DISABLED=0 #1/0
44+
- APP_HAS_SENDING_ENTER_KEY=0 #1/0
45+
- XMPP_CONNECT_TIMEOUT=10000
46+
- APP_PINNED_MUCS=['welcome@conference.localhost']
47+
- XMPP_WS=http://prosody:5280/xmpp-websocket #mandatory, use XMPP service name as hostname
48+
# volumes:
49+
# - ./certs:/etc/nginx/certs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -e
2+
set -e
3+
4+
data_dir_owner="$(stat -c %u "/var/lib/prosody/")"
5+
if [[ "$(id -u prosody)" != "$data_dir_owner" ]]; then
6+
usermod -u "$data_dir_owner" prosody
7+
fi
8+
if [[ "$(stat -c %u /var/run/prosody/)" != "$data_dir_owner" ]]; then
9+
chown "$data_dir_owner" /var/run/prosody/
10+
fi
11+
12+
if [[ "$1" != "prosody" ]]; then
13+
exec prosodyctl "$@"
14+
exit 0;
15+
fi
16+
17+
if [[ "$LOCAL" && "$PASSWORD" && "$DOMAIN" ]]; then
18+
prosodyctl register "$LOCAL" "$DOMAIN" "$PASSWORD"
19+
# update to register 2 users
20+
prosodyctl register "user1" "$DOMAIN" "user1"
21+
prosodyctl register "user2" "$DOMAIN" "user2"
22+
fi
23+
24+
exec setpriv --reuid=prosody --regid=prosody --init-groups "$@"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)