Skip to content

Commit 4830c06

Browse files
committed
Updated load_production_data script to default download hyperkitty data, related docs and minor tweaks.
1 parent ff27282 commit 4830c06

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ There are two options for development setups, nix and native. The native setup d
3333

3434

3535
1. Development System setup
36+
1. Give your ssh key to Sam so he can add it to the boost.cpp.al server.
3637
1. Basic Setup Options:
3738
1. [Nix-based](docs/development_setup_notes_nix.md)
3839
1. [Native](docs/development_setup_notes_native.md)
@@ -137,6 +138,9 @@ currently generated by `docker compose build` and is included in the Docker imag
137138
---
138139

139140
## Setting up Mailman/Hyperkitty locally
141+
142+
Note: This is optional - not required for the website to function, here for reference in case a need arises.
143+
140144
``shell
141145
sudo apt-get install sassc
142146
git clone [email protected]:mailman/hyperkitty.git
@@ -147,18 +151,10 @@ pip install psycopg2-binary
147151
``
148152
change settings.py to use postgres database:
149153
'ENGINE': 'django.db.backends.postgresql_psycopg2',
150-
Update database values in settings to use the same host, user, password, and the database name as in the .env file value for `HYPERKITTY_DATABASE_NAME`.
154+
Update database values in settings to use the same host, user, password, and the database name as in the .env file value for `HYPERKITTY_DATABASE_NAME` (`lists_production_web` by default).
151155

152156
run `django-admin migrate --pythonpath example_project --settings settings`
153157

154-
Give your ssh key to Sam so he can add it to the boost.cpp.al server, and then download the mailman db archive and cp the sql to the docker container
155-
```shell
156-
scp {user}@staging-db1.boost.cpp.al:/tmp/lists_stage_web.staging-db1-2.2025-02-06-08-00-01.sql.gz .
157-
docker cp lists_stage_web.staging-db1-2.2025-02-06-08-00-01.sql website-v2-web-1:/lists_stage_web.staging-db1-2.2025-02-06-08-00-01.sql
158-
docker exec -it website-v2-web-1 /bin/bash
159-
psql -U postgres -W hyperkitty_db < /lists_stage_web.staging-db1-2.2025-02-06-08-00-01.sql
160-
```
161-
162158
## Syncing EmailData Locally
163159

164160
To work with mailinglist data locally, the django application expects to be

docs/development_setup_notes_nix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ For a basic rundown on Nix, this video could be useful https://www.youtube.com/w
3636
* STATIC_CONTENT_AWS_ACCESS_KEY_ID - ask for this
3737
* STATIC_CONTENT_AWS_SECRET_ACCESS_KEY - ask for this
3838
5. Run `just setup` to build services, and build the JS and CSS assets. If docker fails with permissions errors, reboot your machine.
39-
6. Run `just load_production_data` to download live data from the backup server.
39+
6. Run `just load_production_data` to download live data from the backup server for the website and mailman/hyperkitty. That script can be run regularly to update data from the live servers. You will lose all local data.
4040
7. Run `docker compose up` to start the server.
4141

4242

docs/first_time_data_import.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ This document contains information about importing Boost Versions (also called R
88

99
## Development Environments
1010

11+
Download the production data for the website and mailman/hyperkitty.
1112
```bash
1213
just load_production_data
1314
````
1415

16+
That script can be run regularly to update data from the live servers. You will lose all local data.
17+
1518
## Deployed Environments
1619

1720
There are several steps to populating the database with historical Boost data, because we retrieve Boost data from multiple sources.

env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ PROD_MEDIA_CONTENT_REGION=$STATIC_CONTENT_REGION
3333
PROD_MEDIA_CONTENT_AWS_S3_ENDPOINT_URL=$STATIC_CONTENT_AWS_S3_ENDPOINT_URL
3434

3535
# Mailman database settings
36-
HYPERKITTY_DATABASE_NAME="hyperkitty_db"
36+
HYPERKITTY_DATABASE_NAME="lists_production_web"
3737
DATABASE_URL="postgresql://postgres@db:5432/postgres"
3838
DATABASE_TYPE="postgres"
3939
DATABASE_CLASS="mailman.database.postgresql.PostgreSQLDatabase"

scripts/load_production_data.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,33 @@ set -eu
1111
#
1212

1313
# READ IN COMMAND-LINE OPTIONS
14-
TEMP=$(getopt -o h:: --long help::,lists::,only-lists:: -- "$@")
14+
TEMP=$(getopt -o h:: --long help::,no-web::,no-lists:: -- "$@")
1515
eval set -- "$TEMP"
1616

1717
# extract options and their arguments into variables.
1818
while true ; do
1919
case "$1" in
2020
-h|--help)
2121
helpmessage="""
22-
usage: load_production_data.sh [-h] [--lists] [--only-lists]
22+
usage: load_production_data.sh [-h] [--no-web] [--no-lists]
2323
24-
Load production data. By default this will import the main website database.
24+
Load production data. By default this will import both the main website database and mailing list databases.
2525
2626
optional arguments:
2727
-h, --help Show this help message and exit
28-
--lists Import mailing list dbs also.
29-
--only-lists Import mailing list database and not the main web database.
28+
--no-web Skip importing the main website database.
29+
--no-lists Skip importing mailing list databases.
3030
"""
3131

3232
echo ""
3333
echo "$helpmessage" ;
3434
echo ""
3535
exit 0
3636
;;
37-
--lists)
38-
lists_option="yes" ; shift 2 ;;
39-
--only-lists)
40-
lists_option="yes" ; skip_web_option="yes" ; shift 2 ;;
37+
--no-web)
38+
skip_web_option="yes" ; shift 2 ;;
39+
--no-lists)
40+
skip_lists_option="yes" ; shift 2 ;;
4141
--) shift ; break ;;
4242
*) echo "Internal error!" ; exit 1 ;;
4343
esac
@@ -201,7 +201,7 @@ if [ "${skip_web_option:-}" != "yes" ]; then
201201
}
202202
fi
203203

204-
if [ "${lists_option:-}" = "yes" ]; then
204+
if [ "${skip_lists_option:-}" != "yes" ]; then
205205
download_latest_db_dump lists_web_db || {
206206
echo "Failed to download and restore latest lists_web_db dump";
207207
exit 1;

0 commit comments

Comments
 (0)