Skip to content

Commit

Permalink
Planet server files (#314)
Browse files Browse the repository at this point in the history
* Update replication job and add a log file to optimize upload to the cloud provider.

* Add planet files server

* Update container and create image using chartpress
  • Loading branch information
Rub21 authored Feb 21, 2024
1 parent 2a7e77f commit cfaec17
Show file tree
Hide file tree
Showing 17 changed files with 424 additions and 196 deletions.
4 changes: 3 additions & 1 deletion chartpress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ charts:
valuesPath: osmchaWeb.image
osmcha-db:
valuesPath: osmchaDb.image

planet-files:
valuesPath: planetFiles.image

6 changes: 1 addition & 5 deletions compose/db-backup-restore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ services:
dockerfile: Dockerfile
volumes:
- ../data/db-backup-restore-data:/mnt/data
command: >
/bin/bash -c "
echo 'Set cron job for backing up DB, every 4 minutes';
while :; do echo 'Creating DB backup...'; /start.sh; sleep 4m; done;
"
command: /start.sh
env_file:
- ../envs/.env.db
- ../envs/.env.osmcha
Expand Down
22 changes: 0 additions & 22 deletions compose/full-history.yml

This file was deleted.

30 changes: 0 additions & 30 deletions compose/planet-dump.yml

This file was deleted.

89 changes: 89 additions & 0 deletions compose/planet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
version: '3'
services:
######################################################
### OSM minute replication files section
######################################################
replication-job:
image: osmseed-replication-job:v1
build:
context: ../images/replication-job
dockerfile: Dockerfile
volumes:
- ../data/replication-job-data:/mnt/data
# - ./../images/replication-job:/app
command: /start.sh
env_file:
- ../envs/.env.db
- ../envs/.env.db-utils
- ../envs/.env.cloudprovider

######################################################
### Planet replication section
######################################################
planet-dump:
image: osmseed-planet-dump:v1
build:
context: ../images/planet-dump
dockerfile: Dockerfile
volumes:
- ../data/planet-dump-data:/mnt/data
command: /start.sh;
env_file:
- ../envs/.env.db
- ../envs/.env.db-utils
- ../envs/.env.cloudprovider

#####################################################
## OSM full planet replication
#####################################################
full-history:
image: osmseed-full-history:v1
build:
context: ../images/full-history
dockerfile: Dockerfile
volumes:
- ../data/full-history-data:/mnt/data
command: /start.sh
env_file:
- ../envs/.env.db
- ../envs/.env.db-utils
- ../envs/.env.cloudprovider

#####################################################
## Changeset replications
#####################################################
changeset-replication-job:
image: osmseed-changeset-replication-job:v1
build:
context: ../images/changeset-replication-job
dockerfile: Dockerfile
volumes:
- ../data/changeset-replication-job-data:/mnt/changesets
command: >
/bin/bash -c "./start.sh"
env_file:
- ../envs/.env.db
- ../envs/.env.db-utils
- ../envs/.env.cloudprovider

######################################################
### NGINX container for serving files
######################################################
planet-files:
image: osmseed-planet-files:v1
build:
context: ../images/planet-files
dockerfile: Dockerfile
ports:
- "8081:80"
- "3000:3000"
volumes:
# Serve minute replication files
- ../data/replication-job-data:/usr/share/nginx/html/server/static-files/replication/minute
# Serve planet dump files
- ../data/planet-dump-data:/usr/share/nginx/html/server/static-files/planet
# Serve full history planet file
- '.../data/full-history-data:/usr/share/nginx/html/server/static-files/full-planet'
- '../data/changeset-replication-job-data:/usr/share/nginx/html/server/static-files/changesets'
# Development mode
# - ./../images/planet-files/:/usr/share/nginx/html/
32 changes: 0 additions & 32 deletions compose/replication.yml

This file was deleted.

16 changes: 8 additions & 8 deletions compose/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ services:
context: ../images/db
dockerfile: Dockerfile
ports:
- '5432:5432'
volumes:
- ../data/db-data:/var/lib/postgresql/data
- '5432:5432'
# volumes:
# - ../data/db-data:/var/lib/postgresql/data
env_file:
- ../envs/.env.db
- ../envs/.env.db
web:
image: osmseed-web:v1
build:
context: ../images/web
dockerfile: Dockerfile
ports:
- '80:80'
- '80:80'
env_file:
- ../envs/.env.web
- ../envs/.env.db
- ../envs/.env.web
- ../envs/.env.db
depends_on:
- db
- db
16 changes: 3 additions & 13 deletions images/full-history/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@ In order to run this container we need environment variables, these can be found

**Note**: Rename the above files as `.env.db`, `.env.db-utils` and `.env.cloudprovider`

#### Running full-history container

### Build and bring up the container
```sh
# Docker compose
docker-compose run full-history

# Docker
docker run \
--env-file ./envs/.env.db \
--env-file ./envs/.env.full-history \
--env-file ./envs/.env.cloudprovider \
-v ${PWD}/data/full-history-data:/mnt/data \
--network osm-seed_default \
-it osmseed-full-history:v1
docker compose -f ./compose/planet.yml build
docker compose -f ./compose/planet.yml up full-history
```
16 changes: 3 additions & 13 deletions images/planet-dump/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@ In order to run this container we need environment variables, these can be found

**Note**: Rename the above files as `.env.db`, `.env.db-utils` and `.env.cloudprovider`

#### Running planet-dump container

### Build and bring up the container
```sh
# Docker compose
docker-compose run planet-dump

# Docker
docker run \
--env-file ./envs/.env.db \
--env-file ./envs/.env.planet-dump \
--env-file ./envs/.env.cloudprovider \
-v ${PWD}/data/planet-dump-data:/mnt/data \
--network osm-seed_default \
-it osmseed-planet-dump:v1
docker compose -f ./compose/planet.yml build
docker compose -f ./compose/planet.yml up planet-dump
```
10 changes: 10 additions & 0 deletions images/planet-files/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM nginx:latest
RUN apt-get update && \
apt-get install -y nodejs npm && \
rm -rf /var/lib/apt/lists/*
WORKDIR /usr/share/nginx/html/server/
COPY server/package.json ./
RUN npm install
COPY server/server.js ./
COPY index.html /usr/share/nginx/html/
CMD ["sh", "-c", "nginx -g 'daemon off;' & node server.js"]
11 changes: 11 additions & 0 deletions images/planet-files/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

# Planet server files

This container is based on Nginx and serves data related to planet, replication, and changesets for easy access and download, similar to how it is done in OpenStreetMap.


# Build and bring up the container
```sh
docker compose -f ./compose/planet.yml build
docker compose -f ./compose/planet.yml up planet-files
```
Loading

0 comments on commit cfaec17

Please sign in to comment.