Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate msperf #31

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
rework the OSM data loading process
pmauduit committed Sep 3, 2019
commit 9ebc0a9e02d4bce25f9910b5ca83a1a464d5f32c
33 changes: 16 additions & 17 deletions qgis4/ansible/roles/msperfs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -52,41 +52,40 @@
group: "{{ user }}"
when: switzerland_data.stat.exists == false

# Note: unfortunately, this won't converge,
# because we do need to launch the database container
# to check if OSM datas have been loaded
# TODO: instead, use a file to "flag" if data have already been imported or not
- name: Check if OSM datas have been already loaded
stat:
path: "/home/{{ user }}/.ms_perfs_data_loaded"
register: data_loaded

- name: Launch the docker composition from docker-osm
docker_compose:
docker_service:
project_src: "/home/{{ user }}/ms_perfs/docker-osm"
build: yes
pull: yes
when: not data_loaded.stat.exists

- name: wait for the docker db container to be up
wait_for:
port: 15432
delay: 10

- name: Verify if the OSM data have already been loaded
postgresql_query:
db: gis
login_host: localhost
login_port: 15432
login_user: docker
login_password: docker
query: "SELECT pg_database_size('gis');"
register: query_in_osmdb
when: not data_loaded.stat.exists

- name: Wait for 10 minutes to get data sourced to postgresql
pause:
minutes: 10
when: query_in_osmdb.query_result[0].pg_database_size < 13000000 # 13MB
when: not data_loaded.stat.exists

- name: Stopping the docker composition from docker-osm
docker_compose:
docker_service:
project_src: "/home/{{ user }}/ms_perfs/docker-osm"
stopped: true
when: not data_loaded.stat.exists

- name: Create the flag so that OSM data won't be overwritten again
copy:
content: ""
dest: "/home/{{ user }}/.ms_perfs_data_loaded"
when: not data_loaded.stat.exists

- name: Configure Nginx to serve the ms_perfs results
template: