Skip to content

Commit 7613ee6

Browse files
committed
PR: Update documentation, make script file argument ordering more flexible
1 parent 4cf4ef4 commit 7613ee6

4 files changed

Lines changed: 25 additions & 14 deletions

File tree

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Large static images and other assets are stored in S3 buckets rather than in the
181181
### Prerequisites
182182

183183
- `awscli` must be installed.
184-
- Configure a set of credentials in your `~/.aws/credentials` file with the profile name `upload-images`:
184+
- Configure a set of credentials in your `~/.aws/credentials` file with the profile name `sync-boost-images`:
185185

186186
```ini
187187
[sync-boost-images]
@@ -207,8 +207,6 @@ To upload to all S3 buckets:
207207
$ just up_sync_images_all_buckets
208208
```
209209

210-
*Note: The script will prompt you for the S3 destination path, defaulting to `/static/img/v3`.*
211-
212210
#### Downloading
213211

214212
To download missing or outdated static items from the staging bucket to your local directory:
@@ -221,11 +219,11 @@ $ just down_sync_images
221219

222220
## Deploying
223221

224-
TDB
222+
TBD
225223

226224
## Production Environment Considerations
227225

228-
TDB
226+
TBD
229227

230228
---
231229

core/templatetags/custom_static.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def large_static(file_path: str):
99
"""
1010
Automatically handles serving large static content based on development vs. production.
1111
12-
Serves specified content from the local large static file is LOCAL_DEVELOPMENT is True, else serves
12+
Serves specified content from the local large static file if LOCAL_DEVELOPMENT is True, else serves
1313
from the static content in S3.
1414
"""
1515
# Strip any leading slashes to avoid footguns

justfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ set dotenv-load := false
22
COMPOSE_FILE := "docker-compose.yml"
33
ENV_FILE := ".env"
44
DJANGO_VERSION := "5.2"
5-
VALID_BUCKETS := "boost.org.v2 stage.boost.org.v2 boost.org-cppal-dev-v2"
65

76

87
@_default:

scripts/sync-large-static-images.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ set -euo pipefail
66
DEFAULT_BUCKET="stage.boost.org.v2"
77
S3_BUCKETS="boost.org.v2 boost.org-cppal-dev-v2 ${DEFAULT_BUCKET}"
88
AWS_PROFILE='sync-boost-images'
9-
DEFAULT_DEST="/static/"
10-
DEST_PATH=${DEFAULT_DEST}
9+
DEST_PATH="/static/"
1110

1211
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1312
SOURCE_DIR="$(dirname "$SCRIPT_DIR")/static/static-large/"
@@ -28,7 +27,7 @@ Options:
2827
--help Display this help and exit.
2928
3029
Configuration:
31-
The default destination for upload is ${DEFAULT_DEST}.
30+
The default destination for upload is ${DEST_PATH}.
3231
In your .aws/credentials file, add a set of credentials:
3332
3433
[${AWS_PROFILE}]
@@ -123,6 +122,8 @@ download_images() {
123122

124123

125124
ALL_BUCKETS=false
125+
UPLOAD_COMMAND=false
126+
DOWNLOAD_COMMAND=false
126127
while [[ $# -gt 0 ]]; do
127128
case "$1" in
128129
--help)
@@ -133,12 +134,10 @@ while [[ $# -gt 0 ]]; do
133134
ALL_BUCKETS=true
134135
;;
135136
--up-sync)
136-
upload_images "$ALL_BUCKETS"
137-
exit $?
137+
UPLOAD_COMMAND=true
138138
;;
139139
--down-sync)
140-
download_images
141-
exit $?
140+
DOWNLOAD_COMMAND=true
142141
;;
143142
*)
144143
echo "Unknown option: $1"
@@ -148,3 +147,18 @@ while [[ $# -gt 0 ]]; do
148147
esac
149148
shift
150149
done
150+
151+
if [ "${UPLOAD_COMMAND}" == true ] && [ "${DOWNLOAD_COMMAND}" == true ]; then
152+
echo "Uploading and downloading must be done seperately. Exiting.";
153+
exit 0;
154+
elif [ "${UPLOAD_COMMAND}" == true ]; then
155+
upload_images "$ALL_BUCKETS";
156+
exit $?;
157+
elif [ "${DOWNLOAD_COMMAND}" == true ]; then
158+
download_images;
159+
exit $?;
160+
else
161+
echo "Unknown command";
162+
usage;
163+
exit 1;
164+
fi

0 commit comments

Comments
 (0)