Skip to content

Commit 10b38c3

Browse files
committed
Update taginfo script and readme
1 parent 6b3f282 commit 10b38c3

File tree

3 files changed

+41
-38
lines changed

3 files changed

+41
-38
lines changed

envs/.env.taginfo.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ TAGINFO_PROJECT_REPO=https://github.com/OpenHistoricalMap/taginfo-projects.git
1414
DOWNLOAD_DB='languages wiki'
1515
CREATE_DB='db projects chronology'
1616
TAGINFO_DB_BASE_URL=https://planet.openhistoricalmap.org.s3.amazonaws.com/taginfo
17+
AWS_S3_BUCKET=planet-staging.openhistoricalmap.org
18+
ENVIRONMENT=staging

images/taginfo/README.md

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
# OSM-Seed taginfo
22

3-
We build a docker container for taginfo software, the container will start the web service and also process required files to create databases.
3+
Docker container for taginfo that runs the web service and processes PBF files to create databases.
44

55
## Environment Variables
66

7-
All environment variables are located at [`.env.taginfo.example`](./../../envs/.env.taginfo.example), make a copy and name it as `.env.tagninfo` to use in osm-seed.
7+
Copy [`.env.taginfo.example`](./../../envs/.env.taginfo.example) to `.env.taginfo` and configure:
88

9-
- `URL_PLANET_FILE_STATE`: Url to the state file, that contains the URL for the latest planet PBF file. e.g [`state.txt`](https://planet.openhistoricalmap.org.s3.amazonaws.com/planet/state.txt), This is no required in case you set the `URL_PLANET_FILE` env var
9+
### Planet Files
10+
- `URL_PLANET_FILE_STATE`: URL to state file with latest planet PBF URL (optional if `URL_PLANET_FILE` is set)
11+
- `URL_HISTORY_PLANET_FILE_STATE`: URL to state file with latest history PBF URL (optional if `URL_HISTORY_PLANET_FILE` is set)
12+
- `URL_PLANET_FILE`: Direct URL to planet PBF file
13+
- `URL_HISTORY_PLANET_FILE`: Direct URL to history PBF file
1014

11-
- `URL_HISTORY_PLANET_FILE_STATE`: Url to the full history state file, that contains the URL for the latest full history planet PBF file. e.g [`state.txt`](https://planet.openhistoricalmap.org.s3.amazonaws.com/planet/full-history/state.txt), This is no required in case you set the `URL_HISTORY_PLANET_FILE` env var
15+
### Database Configuration
16+
- `TAGINFO_DB_BASE_URL`: Base URL to download SQLite database files. Downloads: projects-cache.db, selection.db, taginfo-chronology.db, taginfo-db.db, taginfo-history.db, taginfo-languages.db, taginfo-master.db, taginfo-projects.db, taginfo-wiki.db, taginfo-wikidata.db
17+
- Example: `https://planet.openhistoricalmap.org.s3.amazonaws.com/taginfo`
1218

13-
- `URL_PLANET_FILE`: URL for the latest planet PBF file.
14-
- `URL_HISTORY_PLANET_FILE`: URL for the latest full history planet PBF file.
15-
- `TIME_UPDATE_INTERVAL` Interval time to update the databases, e.g: `50m` = every 50 minutes, `20h` = every 20 hours , `5d` = every 5 days
19+
- `DOWNLOAD_DB`: Which databases to download (e.g., `languages wiki` or `languages wiki projects chronology`)
1620

17-
The following env vars are required in the instance to update the values at: https://github.com/taginfo/taginfo/blob/master/taginfo-config-example.json
21+
- `CREATE_DB`: Which databases to create from PBF files (e.g., `db projects` or `db projects chronology`)
22+
- `db` requires `URL_PLANET_FILE` or `URL_PLANET_FILE_STATE`
23+
- `projects` requires `TAGINFO_PROJECT_REPO`
24+
- `chronology` requires `URL_PLANET_FILE` or `URL_HISTORY_PLANET_FILE`
1825

19-
- `OVERWRITE_CONFIG_URL`: config file with the values to update
26+
### Other
27+
- `TAGINFO_PROJECT_REPO`: Repository URL for taginfo projects (default: https://github.com/taginfo/taginfo-projects.git)
28+
- `OVERWRITE_CONFIG_URL`: URL to custom taginfo config JSON file
29+
- `INTERVAL_DOWNLOAD_DATA`: Interval to sync databases (e.g., `3600` for 1 hour, `7d` for 7 days)
2030

21-
- `DOWNLOAD_DB`: Taginfo instances need 7 Sqlite databases to start up the web service, all of them can be downloaded from https://taginfo.openstreetmap.org/download. Or if you can download only some of them you can pass herec. e.g DOWNLOAD_DB=`languages wiki`, or DOWNLOAD_DB=`languages wiki projects chronology`.
22-
23-
- `CREATE_DB`: If you want process you of data using the PBF files, you can pass the values. eg. CREATE_DB=`db projects` or CREATE_DB=`db projects chronology`.
24-
Note:
25-
- Value `db` require to pass `URL_PLANET_FILE` or `URL_PLANET_FILE_STATE`
26-
- Value `projects` require to pass `TAGINFO_PROJECT_REPO`
27-
- Value `chronology` require to pass `URL_PLANET_FILE` or `URL_HISTORY_PLANET_FILE`
28-
29-
#### Running taginfo container
31+
## Running
3032

3133
```sh
32-
# Docker compose
33-
docker-compose run taginfo
34-
35-
# Docker
36-
docker run \
37-
--env-file ./envs/.env.taginfo \
38-
-v ${PWD}/data/taginfo-data:/apps/data/ \
39-
--network osm-seed_default \
40-
-it osmseed-taginfo:v1
41-
```
34+
# Docker compose
35+
docker-compose run taginfo
36+
37+
# Docker
38+
docker run \
39+
--env-file ./envs/.env.taginfo \
40+
-v ${PWD}/data/taginfo-data:/usr/src/app/data \
41+
--network osm-seed_default \
42+
-it osmseed-taginfo:v1
43+
```

images/taginfo/start.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,15 @@ process_data() {
4646
# wikidata/update.sh $DATADIR
4747
chronology/update.sh $DATADIR
4848
./update_all.sh $DATADIR
49-
# Move database files from subdirectories to main data directory
50-
find $DATADIR -mindepth 2 -name "*.db" -type f -exec mv {} $DATADIR/ \; 2>/dev/null || true
51-
# Upload only .db files from the main directory (not subdirectories)
52-
if ! aws s3 ls "s3://$AWS_S3_BUCKET/taginfo/$ENVIRONMENT" 2>&1 | grep -q 'An error occurred'; then
53-
for db_file in $DATADIR/*.db; do
54-
if [ -f "$db_file" ]; then
55-
aws s3 cp "$db_file" "s3://$AWS_S3_BUCKET/taginfo/$ENVIRONMENT/$(basename "$db_file")"
56-
fi
57-
done
58-
fi
49+
# Create results directory and copy all .db files from subdirectories and main directory
50+
RESULTS_DIR="$DATADIR/results"
51+
mkdir -p "$RESULTS_DIR"
52+
# Copy all .db files from subdirectories to results
53+
find $DATADIR -mindepth 2 -name "*.db" -type f -exec cp {} "$RESULTS_DIR/" \; 2>/dev/null || true
54+
# Copy .db files from main directory to results
55+
find $DATADIR -maxdepth 1 -name "*.db" -type f -exec cp {} "$RESULTS_DIR/" \; 2>/dev/null || true
56+
# Sync results directory to S3 bucket
57+
aws s3 sync "$RESULTS_DIR/" "s3://$AWS_S3_BUCKET/taginfo/$ENVIRONMENT/" --exclude "*" --include "*.db"
5958
}
6059

6160
# Compress files to download

0 commit comments

Comments
 (0)