Skip to content

Commit 5f1dfdd

Browse files
authored
Update web container and TM config (#315)
* Update config for TM to use a db * Update web container * Update config to set up web and tm * Update env vars for web and tm * Restart containers * Update port for planet api * Update tiler containers * Update config * Update compose config * Delete tasking manager web * Update website version * Update config * Generate doorkeeper_signing_key and set in config * Remove upload to s3 the logs from restore db * Add env var to change org name * Disable cgimap * Update the private key creation * Comment cgimap cli * Update private key creation * Update website version * Update api file service * Update api db
1 parent cfaec17 commit 5f1dfdd

21 files changed

+277
-233
lines changed

compose/nominatim.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ services:
1010
dockerfile: Dockerfile
1111
ports:
1212
- '8080:8080'
13-
- '5432:5432'
13+
# - '5432:5432'
1414
volumes:
1515
- ../data/nominatim-data:/var/lib/postgresql/14/main
1616
# - ../../Nominatim/nominatim/tokenizer/sanitizers:/usr/local/lib/nominatim/lib-python/nominatim/tokenizer/sanitizers
1717
env_file:
1818
- ../envs/.env.nominatim
19+
restart: always

compose/planet.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ services:
1616
- ../envs/.env.db
1717
- ../envs/.env.db-utils
1818
- ../envs/.env.cloudprovider
19+
restart: always
1920

2021
######################################################
2122
### Planet replication section
@@ -32,6 +33,7 @@ services:
3233
- ../envs/.env.db
3334
- ../envs/.env.db-utils
3435
- ../envs/.env.cloudprovider
36+
restart: always
3537

3638
#####################################################
3739
## OSM full planet replication
@@ -48,6 +50,7 @@ services:
4850
- ../envs/.env.db
4951
- ../envs/.env.db-utils
5052
- ../envs/.env.cloudprovider
53+
restart: always
5154

5255
#####################################################
5356
## Changeset replications
@@ -65,6 +68,7 @@ services:
6568
- ../envs/.env.db
6669
- ../envs/.env.db-utils
6770
- ../envs/.env.cloudprovider
71+
restart: always
6872

6973
######################################################
7074
### NGINX container for serving files
@@ -76,7 +80,7 @@ services:
7680
dockerfile: Dockerfile
7781
ports:
7882
- "8081:80"
79-
- "3000:3000"
83+
- "8082:3000"
8084
volumes:
8185
# Serve minute replication files
8286
- ../data/replication-job-data:/usr/share/nginx/html/server/static-files/replication/minute
@@ -87,3 +91,7 @@ services:
8791
- '../data/changeset-replication-job-data:/usr/share/nginx/html/server/static-files/changesets'
8892
# Development mode
8993
# - ./../images/planet-files/:/usr/share/nginx/html/
94+
restart: always
95+
networks:
96+
osm-seed:
97+
driver: bridge

compose/tasking-manager.yml

+25-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
11
version: '3'
22
services:
3-
######################################################
4-
### Tasking Manager section
5-
######################################################
6-
tasking-manager-api:
3+
tmdb:
4+
image: mdillon/postgis:11
5+
# ports:
6+
# - '5432:5432'
7+
volumes:
8+
- ../data/tasking-manager-db:/db
9+
env_file:
10+
- ../envs/.env.tasking-manager-db
11+
restart: always
12+
migration:
713
image: osmseed-tasking-manager-api:v1
814
build:
915
context: ../images/tasking-manager-api
1016
dockerfile: Dockerfile
17+
restart: on-failure
18+
command: >
19+
sh -c "sleep 10s && python3 manage.py db upgrade"
20+
env_file:
21+
- ../envs/.env.tasking-manager
22+
- ../envs/.env.tasking-manager-db
23+
tmapi:
24+
build:
25+
context: ../images/tasking-manager-api
26+
dockerfile: Dockerfile
27+
image: osmseed-tasking-manager-api:v1
1128
ports:
12-
- '5000:5000'
13-
volumes:
14-
- ../data/tasking-manager-api-db:/db
29+
- '5000:5000'
1530
env_file:
16-
- ../envs/.env.tasking-manager
31+
- ../envs/.env.tasking-manager
32+
- ../envs/.env.tasking-manager-db
33+
restart: always

compose/tiler.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ services:
88
build:
99
context: ../images/tiler-db
1010
dockerfile: Dockerfile
11-
ports:
12-
- "5433:5432"
11+
# ports:
12+
# - "5433:5432"
1313
volumes:
1414
- ../data/tiler-db-data:/var/lib/postgresql/data
1515
env_file:
@@ -42,7 +42,7 @@ services:
4242
retries: 3
4343
restart: always
4444
# ######################################################
45-
# ### Tiler imposm for importing data
45+
# ### Tiler server
4646
# ######################################################
4747
tiler-server:
4848
image: osmseed-tiler-server:v1
@@ -51,6 +51,7 @@ services:
5151
dockerfile: Dockerfile
5252
volumes:
5353
- ../data/tiler-server-data:/mnt/data
54+
- ../data/tiler-imposm-data:/mnt/data/imposm
5455
depends_on:
5556
- tiler-db
5657
- tiler-imposm
@@ -59,8 +60,9 @@ services:
5960
command:
6061
- sh
6162
- -c
62-
- "sleep 60 && ./start.sh"
63+
- "./start.sh & ./expire-watcher.sh"
6364
env_file:
6465
- ../envs/.env.tiler-db
6566
- ../envs/.env.tiler-server
6667
restart: always
68+

compose/web.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ services:
99
build:
1010
context: ../images/db
1111
dockerfile: Dockerfile
12-
ports:
13-
- '5432:5432'
14-
# volumes:
15-
# - ../data/db-data:/var/lib/postgresql/data
12+
# ports:
13+
# - '5432:5432'
14+
volumes:
15+
- ../data/db-data-pg14:/var/lib/postgresql/data
1616
env_file:
1717
- ../envs/.env.db
18+
restart: always
1819
web:
1920
image: osmseed-web:v1
2021
build:
@@ -27,3 +28,9 @@ services:
2728
- ../envs/.env.db
2829
depends_on:
2930
- db
31+
restart: always
32+
memcache:
33+
image: memcached:latest
34+
ports:
35+
- '11211:11211'
36+
restart: always

envs/.env.tasking-manager-db.example

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
POSTGRES_DB=tm
2+
POSTGRES_USER=postgres
3+
POSTGRES_PASSWORD=1234
4+
POSTGRES_PORT=5432

envs/.env.tasking-manager.example

+3-8
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,15 @@ POTLATCH2_EDITOR_URL=https://www.openstreetmap.org/edit?editor=potlatch2
3737
#
3838
TM_SECRET=xyz
3939

40-
# OpenStreetMap OAuth consumer key and secret (required)
41-
#
40+
# OpenStreetMap OAuth 1 consumer key and secret (required)
41+
4242
TM_CONSUMER_KEY=foo
4343
TM_CONSUMER_SECRET=xyz
4444

4545
TM_DEFAULT_CHANGESET_COMMENT="#{osmseed}-project"
4646

4747
# The connection to the postgres database (required)
48-
#
49-
POSTGRES_DB=tm
50-
POSTGRES_USER=postgres
51-
POSTGRES_PASSWORD=tm
52-
POSTGRES_ENDPOINT=localhost
53-
POSTGRES_PORT=5432
48+
POSTGRES_HOST=tmdb
5449

5550
# The address to use as the sender on auto generated emails (optional)
5651
#

envs/.env.web.example

+14-3
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,27 @@ [email protected]
2020
MAILER_PASSWORD=abc...
2121
2222
MAILER_PORT=25
23+
OSM_memcache_servers=""
2324

2425
# Nominatim settings
2526
NOMINATIM_URL=nominatim-api
2627

2728
# Make sure that the first time this (OPENSTREETMAP_id_key) value is empty.
28-
# Once you start you server and create your OAuth 1, fill the value with the Consumer Key.
29-
OPENSTREETMAP_id_key=""
30-
OSM_memcache_servers=""
29+
# Once you start you server and create your OAuth 2.
30+
### Create OAuth 2 applications
31+
### Client ID=OPENSTREETMAP_id_key
32+
OPENSTREETMAP_id_key="xyz..."
33+
34+
### OpenStreetMap Web Site
35+
# Client ID=OAUTH_CLIENT_ID
36+
# Client Secret=OAUTH_KEY
37+
OAUTH_CLIENT_ID="abc..."
38+
OAUTH_KEY="efg..."
3139

3240
# NEW_RELIC settings
3341
# TODO: Needs to be implemented the New Relic functions in order to make running in the web container
3442
NEW_RELIC_LICENSE_KEY="..."
3543
NEW_RELIC_APP_NAME="..."
44+
45+
### Set organization name, by default : OpenStreetMap
46+
ORGANIZATION_NAME=OSMSeed

images/backup-restore/start.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ restoreDB() {
6363
wget -O ${RESTORE_FILE} ${RESTORE_URL_FILE}
6464
echo "Restoring ${RESTORE_URL_FILE} in ${POSTGRES_DB}"
6565
gunzip -c <${RESTORE_FILE} | psql -h ${POSTGRES_HOST} -U ${POSTGRES_USER} -d ${POSTGRES_DB} | tee ${LOG_RESULT_FILE}
66-
aws s3 cp ${LOG_RESULT_FILE} s3://${AWS_S3_BUCKET}/${LOG_RESULT_FILE}
66+
# aws s3 cp ${LOG_RESULT_FILE} s3://${AWS_S3_BUCKET}/${LOG_RESULT_FILE}
6767
echo "Import data to ${POSTGRES_DB} has finished ..."
6868
done
6969
}

images/db/Dockerfile

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
FROM postgres:11
2-
RUN rm /etc/apt/sources.list.d/pgdg.list
3-
RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
4-
RUN sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list
5-
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
6-
RUN apt-get update && apt-get -y install apt-transport-https
7-
RUN echo "deb [ signed-by=/usr/local/share/keyrings/postgres.gpg.asc ] https://apt-archive.postgresql.org/pub/repos/apt/ stretch-pgdg main 11" >/etc/apt/sources.list.d/pgdg.list
1+
FROM postgres:14
82
RUN apt-get update \
93
&& apt-get install -y \
10-
postgresql-server-dev-11 \
4+
postgresql-server-dev-14 \
115
make \
126
build-essential \
13-
postgresql-11-postgis-2.5 \
7+
postgresql-14-postgis-3 \
148
&& apt-get clean && rm -rf /var/lib/apt/lists/*
15-
9+
1610
ADD functions/functions.sql /usr/local/share/osm-db-functions.sql
1711
ADD docker_postgres.sh /docker-entrypoint-initdb.d/
1812
RUN mkdir -p db
1913
RUN mkdir -p lib
2014
ADD functions/ db/functions/
2115
ADD lib/quad_tile/ lib/quad_tile/
22-
2316
RUN make -C db/functions/
2417
RUN chown -R postgres lib/
25-
RUN chown -R postgres db/
18+
RUN chown -R postgres db/

images/planet-files/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<script>
2323
// const API_FILES = "http://localhost:3000";
2424
const HOST_NAME= window.location.hostname
25-
const API_FILES = `http://${HOST_NAME}:3000`;
25+
const API_FILES = "API_FILES_SERVICES";
2626
document.title = HOST_NAME;
2727
async function fetchFiles(directory) {
2828
const response = await fetch(`${API_FILES}/${directory}`);

images/tiler-server/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN apk add musl-dev=1.1.24-r3 \
1010

1111
RUN mkdir -p /go/src/github.com/go-spatial/tegola
1212
RUN git clone https://github.com/go-spatial/tegola.git /go/src/github.com/go-spatial/tegola
13-
RUN cd /go/src/github.com/go-spatial/tegola && git checkout v0.8.1
13+
RUN cd /go/src/github.com/go-spatial/tegola && git checkout v0.13.0
1414
RUN cd /go/src/github.com/go-spatial/tegola/cmd/tegola \
1515
&& go build -gcflags "-N -l" -o /opt/tegola \
1616
&& chmod a+x /opt/tegola
@@ -36,7 +36,7 @@ RUN pip3 install awscli
3636
RUN curl -sSL https://sdk.cloud.google.com | bash
3737
RUN ln -f -s /root/google-cloud-sdk/bin/gsutil /usr/bin/gsutil
3838

39-
RUN pip install mercantile \
39+
RUN pip3 install mercantile \
4040
&& apk del build-deps \
4141
&& rm -rf /var/cache/apk/* \
4242
&& apk --purge -v del py-pip

images/tiler-server/expire-watcher.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ while true ; do
1010
if [ "$sum" != "$new_sum" ]; then
1111
./seed-by-diffs.sh
1212
else
13-
sleep 1
13+
sleep 30s
1414
fi
1515
done

images/tiler-server/seed-by-diffs.sh

+14-31
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,32 @@ completed_jobs=$workDir/imposm/completed.list
1616
completed_dir=$workDir/imposm/imposm3_expire_purged
1717
mkdir -p $completed_dir
1818

19-
2019
# List files in expire_dir
21-
imp_list=`find $expire_dir -name '*.tiles' -type f`
20+
imp_list=$(find $expire_dir -name '*.tiles' -type f)
2221

2322
for f in $imp_list; do
24-
echo "$f" >> $queued_jobs
23+
echo "$f" >>$queued_jobs
2524
done
2625

2726
# Sort the files and set unique rows
28-
if [ -f $queued_jobs ] ; then
29-
sort -u $queued_jobs > $workDir/imposm/tmp.list && mv $workDir/imposm/tmp.list $queued_jobs
27+
if [ -f $queued_jobs ]; then
28+
sort -u $queued_jobs >$workDir/imposm/tmp.list && mv $workDir/imposm/tmp.list $queued_jobs
3029
fi
3130

3231
for f in $imp_list; do
33-
echo "seeding from $f"
34-
# Read each line on the tiles file
35-
while IFS= read -r tile
36-
do
37-
bounds="$(python tile2bounds.py $tile)"
38-
echo tegola cache purge \
39-
--config=/opt/tegola_config/config.toml \
40-
--min-zoom=0 --max-zoom=20 \
41-
--bounds=$bounds \
42-
tile-name=$tile
43-
44-
tegola cache purge \
32+
# echo "Purge tiles from...$f"
33+
tegola cache purge tile-list $f \
4534
--config=/opt/tegola_config/config.toml \
46-
--min-zoom=0 --max-zoom=20 \
47-
--bounds=$bounds \
48-
tile-name=$tile
49-
err=$?
50-
if [[ $err != "0" ]]; then
51-
#error
52-
echo "tegola exited with error code $err"
53-
# rm $queued_jobs
54-
exit
55-
fi
56-
done < "$f"
57-
echo "$f" >> $completed_jobs
35+
--format="/zxy" \
36+
--min-zoom=0 \
37+
--max-zoom=20 \
38+
--overwrite=true &
39+
sleep 10s
40+
echo "$f" >>$completed_jobs
5841
mv $f $completed_dir
5942
done
6043

61-
if [ -f $queued_jobs ] ; then
62-
echo "finished seeding"
44+
if [ -f $queued_jobs ]; then
45+
# Completed queued jobs
6346
rm $queued_jobs
6447
fi

0 commit comments

Comments
 (0)