Skip to content

Commit e40f43c

Browse files
committed
Docs update
1 parent cc59487 commit e40f43c

File tree

2 files changed

+134
-30
lines changed

2 files changed

+134
-30
lines changed

docs/cheatsheet.md

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,39 @@
33

44
Managing mailman-web.
55

6-
There are multiple ways to run mailman-web commands. One method is to continue as the `root` user, using sudo each time. For example:
7-
8-
```
9-
sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web migrate
10-
```
11-
12-
Another method is to switch to the proper mailman web user `mailman3-web`, configure enviroment variables, and then directly run a command.
13-
14-
```
15-
sudo su - mailman3-web
16-
. /opt/mailman3/bin/activate
17-
cd /var/lib/mailman3/web/project
18-
export PYTHONPATH=$PYTHONPATH:$PWD
19-
export DJANGO_SETTINGS_MODULE=settings
20-
```
21-
22-
```
23-
mailman-web update_index_one_list [email protected]
24-
```
25-
26-
The command `mailman-web` is mostly equivalent to `python3 manage.py`.
6+
There are multiple ways to run the `mailman-web` command. The latest and recommended method is now to call the wrapper convenience script `mailman-web-wrapper` (as root) located in /usr/local/bin/mailman-web-wrapper which will set necessary parameters including user account, executable path, and environment variables. That makes it easy to call the command and not be concerned about those details. If you'd like to more information about previous methods, see [earlier-notes-to-keep.md](earlier-notes-to-keep.md) .
277

288
Run migrations:
299

3010
```
31-
sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web migrate
11+
# sudo mailman-web-wrapper migrate
3212
```
3313

3414
Refresh threads cache:
3515

3616
```
37-
sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjob -v 3 hyperkitty recent_threads_cache
17+
# sudo mailman-web-wrapper runjob -v 3 hyperkitty recent_threads_cache
3818
```
3919

4020
## Lists of cron jobs
4121

4222
```
4323
44-
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs minutely --list
24+
# sudo mailman-web-wrapper runjobs minutely --list
4525
Job List: 0 jobs
4626
47-
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs quarter_hourly --list
27+
# sudo mailman-web-wrapper runjobs quarter_hourly --list
4828
Job List: 0 jobs
4929
50-
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs hourly --list
30+
# sudo mailman-web-wrapper runjobs hourly --list
5131
Job List: 3 jobs
5232
appname - jobname - when - help
5333
--------------------------------------------------------------------------------
5434
hyperkitty - new_lists_from_mailman - hourly - Import new lists from Mailman
5535
hyperkitty - thread_starting_email - hourly - Find the starting email when it is missing
5636
hyperkitty - update_index - hourly - Update the full-text index
5737
58-
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs daily --list
38+
# sudo mailman-web-wrapper runjobs daily --list
5939
Job List: 5 jobs
6040
appname - jobname - when - help
6141
--------------------------------------------------------------------------------
@@ -65,20 +45,33 @@ Job List: 5 jobs
6545
hyperkitty - recent_threads_cache - daily - Refresh the recent threads cache
6646
hyperkitty - sync_mailman - daily - Sync user and list properties with Mailman
6747
68-
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs weekly --list
48+
# sudo mailman-web-wrapper runjobs weekly --list
6949
Job List: 0 jobs
7050
71-
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs monthly --list
51+
# sudo mailman-web-wrapper runjobs monthly --list
7252
Job List: 2 jobs
7353
appname - jobname - when - help
7454
--------------------------------------------------------------------------------
7555
hyperkitty - empty_threads - monthly - Remove empty threads
7656
hyperkitty - update_and_clean_index - monthly - Update the full-text index and clean old entries
7757
78-
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs yearly --list
58+
# sudo mailman-web-wrapper runjobs yearly --list
7959
Job List: 1 jobs
8060
appname - jobname - when - help
8161
--------------------------------------------------------------------------------
8262
hyperkitty - thread_order_depth - yearly - Compute thread order and depth for all threads
8363
8464
```
65+
66+
## Managing mailman core
67+
68+
The latest and recommended method to call the `mailman` cli command is now to run the wrapper convenience script `mailman-wrapper` (as root) located in /usr/local/bin/mailman-wrapper which will set necessary parameters including user account, executable path, and environment variables. That makes it easy to call the command and not be concerned about those details. If you'd like to more information about previous methods, see [earlier-notes-to-keep.md](earlier-notes-to-keep.md) .
69+
70+
Example:
71+
72+
```
73+
# sudo mailman-version help
74+
75+
# sudo mailman-wrapper version
76+
```
77+

docs/earlier-notes-to-keep.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
2+
## (Wrapper Scripts)
3+
4+
Before proceeding to show how mailman-web was run before, and the various options available, here is some information about new wrapper scripts. Generally they should be preferred.
5+
6+
/usr/local/bin/mailman-wrapper :
7+
```
8+
#!/bin/sh
9+
10+
MAILMAN_CORE_USER="list"
11+
MAILMAN_CORE_EXECUTABLE="/opt/mailman3/bin/mailman"
12+
13+
su -s /bin/sh -c "${MAILMAN_CORE_EXECUTABLE} $*" ${MAILMAN_CORE_USER}
14+
```
15+
16+
/usr/local/bin/mailman-web-wrapper :
17+
```
18+
#!/bin/sh
19+
20+
MAILMAN_WEB_USER="mailman3-web"
21+
MAILMAN_WEB_EXECUTABLE="/opt/mailman3/bin/mailman-web"
22+
MAILMAN_WEB_CONFIG="/var/lib/mailman3/web/project/settings.py"
23+
24+
su -s /bin/sh -c "MAILMAN_WEB_CONFIG=${MAILMAN_WEB_CONFIG} ${MAILMAN_WEB_EXECUTABLE} $*" ${MAILMAN_WEB_USER}
25+
```
26+
27+
## Previous
28+
29+
## Common commands
30+
31+
Managing mailman-web.
32+
33+
There are multiple ways to run mailman-web commands. One method is to continue as the `root` user, using sudo each time. For example:
34+
35+
```
36+
sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web migrate
37+
```
38+
39+
Another method is to switch to the proper mailman web user `mailman3-web`, configure enviroment variables, and then directly run a command.
40+
41+
```
42+
sudo su - mailman3-web
43+
. /opt/mailman3/bin/activate
44+
cd /var/lib/mailman3/web/project
45+
export PYTHONPATH=$PYTHONPATH:$PWD
46+
export DJANGO_SETTINGS_MODULE=settings
47+
```
48+
49+
```
50+
mailman-web update_index_one_list [email protected]
51+
```
52+
53+
The command `mailman-web` is mostly equivalent to `python3 manage.py`.
54+
55+
Run migrations:
56+
57+
```
58+
sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web migrate
59+
```
60+
61+
Refresh threads cache:
62+
63+
```
64+
sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjob -v 3 hyperkitty recent_threads_cache
65+
```
66+
67+
## Lists of cron jobs
68+
69+
```
70+
71+
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs minutely --list
72+
Job List: 0 jobs
73+
74+
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs quarter_hourly --list
75+
Job List: 0 jobs
76+
77+
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs hourly --list
78+
Job List: 3 jobs
79+
appname - jobname - when - help
80+
--------------------------------------------------------------------------------
81+
hyperkitty - new_lists_from_mailman - hourly - Import new lists from Mailman
82+
hyperkitty - thread_starting_email - hourly - Find the starting email when it is missing
83+
hyperkitty - update_index - hourly - Update the full-text index
84+
85+
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs daily --list
86+
Job List: 5 jobs
87+
appname - jobname - when - help
88+
--------------------------------------------------------------------------------
89+
django_extensions - cache_cleanup - daily - Cache (db) cleanup Job
90+
django_extensions - daily_cleanup - daily - Django Daily Cleanup Job
91+
hyperkitty - orphan_emails - daily - Reattach orphan emails
92+
hyperkitty - recent_threads_cache - daily - Refresh the recent threads cache
93+
hyperkitty - sync_mailman - daily - Sync user and list properties with Mailman
94+
95+
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs weekly --list
96+
Job List: 0 jobs
97+
98+
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs monthly --list
99+
Job List: 2 jobs
100+
appname - jobname - when - help
101+
--------------------------------------------------------------------------------
102+
hyperkitty - empty_threads - monthly - Remove empty threads
103+
hyperkitty - update_and_clean_index - monthly - Update the full-text index and clean old entries
104+
105+
root@lists:/opt/mailman3/bin# sudo -u mailman3-web MAILMAN_WEB_CONFIG=/var/lib/mailman3/web/project/settings.py /opt/mailman3/bin/mailman-web runjobs yearly --list
106+
Job List: 1 jobs
107+
appname - jobname - when - help
108+
--------------------------------------------------------------------------------
109+
hyperkitty - thread_order_depth - yearly - Compute thread order and depth for all threads
110+
111+
```

0 commit comments

Comments
 (0)