Skip to content

Commit e7f0b6e

Browse files
committed
Merge branch 'release/2.9.0'
2 parents 016fef5 + 8229367 commit e7f0b6e

144 files changed

Lines changed: 685935 additions & 116198 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.git
2+
.DS_Store
3+
.Dockerfile.swp
4+
.playwright-cli
5+
6+
data
7+
data_storage
8+
events.json
9+
10+
*.log
11+
*.tmp
12+
*.swp

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Release Notes
22

3+
### Release 2.9.0 (2026-05-14)
4+
- Add historical ShakeMap data storage fallback through Nginx while keeping public `/data/...` URLs unchanged
5+
- Add `--data-realtime-dir` and `--data-storage-dir` options to `process_events.sh`
6+
- Update Docker startup and cron processing to include storage data only during full rebuilds
7+
- Add deployment support for an optional historical data storage volume
8+
- Update documentation for realtime and storage data directories
9+
310
### Release 2.8.0 (2026-05-08)
411
- style: update INGV profile bounding box coordinates
512

Dockerfile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ FROM nginx:1.29.3
22

33
# Install cron and dependencies for process_events.sh
44
RUN apt-get update && \
5-
apt-get install -y \
5+
apt-get install -y --no-install-recommends \
66
jq \
77
vim \
88
cron \
99
procps \
1010
libxml2-utils \
11-
&& rm -rf /var/lib/apt/lists/*
11+
&& apt-get clean && \
12+
rm -rf /var/lib/apt/lists/*
1213

1314
# Add alias ll=ls -la to root's .bashrc
1415
RUN echo "alias ll='ls -la'" >> /root/.bashrc
@@ -27,19 +28,15 @@ COPY css/ /usr/share/nginx/html/css/
2728
COPY js/ /usr/share/nginx/html/js/
2829
COPY images/ /usr/share/nginx/html/images/
2930

31+
# Copy Nginx configuration
32+
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
33+
3034
# Copy the processing script
3135
COPY process_events.sh /usr/share/nginx/html/process_events.sh
3236
RUN chmod +x /usr/share/nginx/html/process_events.sh
3337

34-
# Create data directory (can be mounted as volume)
35-
RUN mkdir -p /usr/share/nginx/html/data
36-
37-
# Create crontab file
38-
RUN echo "*/2 * * * * /usr/share/nginx/html/process_events.sh -d /usr/share/nginx/html/data -l 5 -x _ri >> /tmp/process_events_incremental.log 2>&1" > /etc/cron.d/shakemap-cron && \
39-
echo "00 12 * * * /usr/share/nginx/html/process_events.sh -d /usr/share/nginx/html/data -x _ri >> /tmp/process_events_full.log 2>&1" >> /etc/cron.d/shakemap-cron && \
40-
echo "01 00 * * * mv /tmp/process_events_incremental.log /tmp/process_events_incremental.yesterday.log" && \
41-
echo "01 00 * * * mv /tmp/process_events_full.log /tmp/process_events_full.yesterday.log" && \
42-
chmod 0644 /etc/cron.d/shakemap-cron
38+
# Create data directories (can be mounted as volumes)
39+
RUN mkdir -p /usr/share/nginx/html/data /usr/share/nginx/html/data_storage
4340

4441
# Copy entrypoint script
4542
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

README.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,44 @@ Docker provides a self-contained environment with all dependencies included.
3838
docker run -d -p 8080:80 -v $(pwd)/data:/usr/share/nginx/html/data:ro --name shakemap4-web__container ingv/shakemap4-web
3939
```
4040

41+
**Run with realtime data and historical storage directories:**
42+
```bash
43+
docker run -d -p 8080:80 \
44+
-v $(pwd)/data:/usr/share/nginx/html/data:ro \
45+
-v $(pwd)/data_storage:/usr/share/nginx/html/data_storage:ro \
46+
--name shakemap4-web__container \
47+
ingv/shakemap4-web
48+
```
49+
50+
With this setup, public URLs remain under `/data/...`. Nginx first looks in `/usr/share/nginx/html/data` and then falls back internally to `/usr/share/nginx/html/data_storage`.
51+
4152
**Run with automated processing enabled:**
4253
```bash
4354
docker run -d -p 8080:80 \
4455
-v $(pwd)/data:/usr/share/nginx/html/data:ro \
56+
-v $(pwd)/data_storage:/usr/share/nginx/html/data_storage:ro \
4557
--name shakemap4-web__container \
4658
-e ENABLE_CRONTAB=true \
4759
ingv/shakemap4-web
4860
```
4961

5062
When `ENABLE_CRONTAB=true` is set, the container will automatically:
5163
- Process the last 5 events every 2 minutes (logs: `/tmp/process_events_incremental.log`)
52-
- Reprocess all events daily at 00:10 UTC (logs: `/tmp/process_events_full.log`)
64+
- Reprocess all events daily at 12:00 UTC (logs: `/tmp/process_events_full.log`)
65+
66+
Incremental processing reads only the realtime data directory. Full rebuilds also include the historical storage directory when it is mounted.
5367

5468
**Run with initial data processing:**
5569
```bash
5670
docker run -d -p 8080:80 \
5771
-v $(pwd)/data:/usr/share/nginx/html/data:ro \
72+
-v $(pwd)/data_storage:/usr/share/nginx/html/data_storage:ro \
5873
--name shakemap4-web__container \
5974
-e PROCESS_ALL_DATA_FIRST_TIME=true \
6075
ingv/shakemap4-web
6176
```
6277

63-
When `PROCESS_ALL_DATA_FIRST_TIME=true` is set, the container will process all events in the data directory at startup before starting the Nginx server. This is useful for initializing the `events.json` file on first deployment.
78+
When `PROCESS_ALL_DATA_FIRST_TIME=true` is set, the container will process events at startup before starting the Nginx server. It processes recent events from the realtime data directory first, then starts a full rebuild in the background; the full rebuild also includes `data_storage` when mounted.
6479

6580
**Run with a specific environment profile (e.g. EU):**
6681
```bash
@@ -98,6 +113,7 @@ docker run -d -p 8080:80 -v $(pwd)/data:/usr/share/nginx/html/data:ro --name sha
98113
```bash
99114
docker run -d -p 8080:80 \
100115
-v $(pwd)/data:/usr/share/nginx/html/data:ro \
116+
-v $(pwd)/data_storage:/usr/share/nginx/html/data_storage:ro \
101117
--name shakemap4-web__container \
102118
-e ENABLE_CRONTAB=true \
103119
ingv/shakemap4-web
@@ -118,18 +134,30 @@ If you prefer to run without Docker, you'll need to manually set up the environm
118134
- Web Server (Nginx, Apache, or Python HTTP server)
119135

120136
#### 2. Data Processing
121-
The `process_events.sh` script scans the `data/` directory and generates `events.json`.
137+
The `process_events.sh` script scans the realtime `data/` directory and generates `events.json`.
122138

123-
**Process all events:**
139+
**Process all realtime events:**
124140
```bash
125-
./process_events.sh
141+
./process_events.sh --data-realtime-dir data/
126142
```
127143

144+
**Process realtime and historical storage events:**
145+
```bash
146+
./process_events.sh --data-realtime-dir data/ --data-storage-dir data_storage/ --exclude-dir-end _ri
147+
```
148+
149+
The `--data-storage-dir` option is valid only for full rebuilds. If the same event exists in both directories, the realtime directory has priority and the storage copy is skipped.
150+
128151
**Process a single event:**
129152
```bash
130-
./process_events.sh -e <eventid>
153+
./process_events.sh --data-realtime-dir data/ -e <eventid>
154+
```
155+
Example: `./process_events.sh --data-realtime-dir data/ -e 44683062`
156+
157+
**Process the last 5 realtime events:**
158+
```bash
159+
./process_events.sh --data-realtime-dir data/ -l 5 --exclude-dir-end _ri
131160
```
132-
Example: `./process_events.sh -e 44683062`
133161

134162
#### 3. Serve the Portal
135163
**Example with Python HTTP server:**
@@ -138,8 +166,11 @@ python3 -m http.server 8000
138166
```
139167
Then open `http://localhost:8000` in your browser.
140168

169+
Python's simple HTTP server cannot provide the `/data/...` to `data_storage/` fallback. Use the provided Nginx configuration when historical storage must be exposed without changing public URLs.
170+
141171
## Directory Structure
142172
- `data/`: Contains ShakeMap event data.
173+
- `data_storage/`: Optional historical ShakeMap event data served as an internal fallback for `/data/...` URLs.
143174
- `css/`: Stylesheets.
144175
- `js/`: JavaScript logic.
145176
- `index.html`: Main entry point.

data/39481424/current/attenuation_curves.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

data/39481424/current/products/cont_mi.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)