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

add overpass-api role #3

Merged
merged 3 commits into from Aug 18, 2017
Merged

add overpass-api role #3

merged 3 commits into from Aug 18, 2017

Conversation

RoPP
Copy link
Contributor

@RoPP RoPP commented Jun 10, 2017

Ne pas merger !

Il manque encore quelques morceaux…

validate_certs: false
remote_src: true
become: yes
become_user: "{{ user }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with downloading a tar.gz, but would it be a better idea to clone the git repository ?

Copy link

@mmd-osm mmd-osm Jun 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use the released versions at dev.overpass-api.de/releases. Releases on github are sometimes not updated with the latest changes!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I plan to use released version of overpass, at least at beginning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmd-osm is there any difference between github and dev.o.d versions ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, at this time, the github release lacks a few fixes which have been published on dev.o.d. I guess Roland just forgot to update github as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok. I'll use dev.o.d then.

args:
chdir: "{{ project_dir }}/Overpass-API-osm3s-{{ overpass_release }}/src"
become: yes
become_user: "{{ user }}"
Copy link
Member

@jocelynj jocelynj Jun 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful that this shell command means that ansible will execute these programs each time the ansible script is executed. Maybe a check like creates: 'bin file' could be added ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea :)

- zlib1g-dev
- bzip2
- wget
- liblz4-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really like to remove packages - it could cause issue if they are needed for something else. For exemple, bzip2, wget, git and make are useful independently of this ansible script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed packages by force of habit. I'm more used to create docker container which should be as small as possible.

- name: import planet
shell: osmconvert {{ database_dir }}/planet-latest.osm.pbf --out-osm | update_database --db-dir={{ database_dir }} --meta
become: true
become_user: "{{ user }}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to import the planet, but it shouldn't be re-imported if it was already imported.
It might also a bit too long for an ansible script - I'm not sure if ansible/ssh is robust enough to execute commands that can last several hours.

Copy link

@mmd-osm mmd-osm Jun 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want use the cloning feature and download the current database from dev.overpass-API.de/clone instead. Please note that this would imply gzip compression at this time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was a quick and dirty test. import is now execute at first boot only.

@RoPP RoPP force-pushed the wip_overpass_api branch 3 times, most recently from 3341df7 to a10a70e Compare June 30, 2017 20:04
@RoPP RoPP force-pushed the wip_overpass_api branch 3 times, most recently from 7de12fe to 360f78c Compare July 21, 2017 12:24
@jocelynj
Copy link
Member

What is the current status of this branch ?

Is is mergeable ? Should I review it one more time ?

@RoPP RoPP changed the title WIP: add overpass-api role add overpass-api role Aug 14, 2017
@RoPP
Copy link
Contributor Author

RoPP commented Aug 14, 2017

Every review is alway welcome! Anyway this PR can be merged, it works well. There probably some remaining small bugs but we'll see…

hosts Outdated
@@ -193,6 +193,10 @@ osm26.openstreetmap.fr
osm27.openstreetmap.fr
osm28.openstreetmap.fr

[overpass-api]
osm999.openstreetmap.fr overpass_version=skip
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is osm999 a custom machine ?
I suppose that I shouldn't merge it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was a local vm for testing

@@ -0,0 +1,7 @@
---
user: overpass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be overpass_user instead of user ?
I'm not sure if it is possible to set a parameter for a host and a single role with ansible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, overpass_user is more consistent with other parameters.

chdir: "{{ project_dir }}/osm-3s_{{ overpass_version }}"

- name: install overpass-api cgi-bin
command: cp -r {{ project_dir }}/osm-3s_{{ overpass_version }}/cgi-bin/ {{ overpass_webroot_dir }}/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be done with ansible copy module with remote_src=yes, but it is fine as it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunatly, "Currently remote_src does not support recursive copying."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, let's keep the current code as it is :)

@@ -0,0 +1,67 @@
- include: ../../../shared/project-account.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be clearer with user=overpass or user="{{ overpass_user}}" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunatly, we cannot do variables substitution with include directive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we can use set_fact

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, I'm using this in roles/taginfo/tasks/main.yml:

- include: ../../../shared/project-account.yml user=taginfo

Copy link
Contributor Author

@RoPP RoPP Aug 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right. I probably read doc too quickly :) Thx for the tip.

<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>api.openstreetmap.fr</title>
<style>
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Condensed);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to use font from google, but we can keep this code as it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pick this font becausi it seems to be one used on http://openstreetmap.fr/ but it's not really important.

rewrite ^/overpass(.*)$ /cgi-bin/interpreter last;

location /cgi-bin/ {
gzip off;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mobile apps would be happy with compression to reduce data volume

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, desktop apps as well :)

ExecStart=/usr/local/bin/rules_loop.sh {{ overpass_database_dir }}
Nice=19
Restart=always
RestartSec=30s
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job will run for several hours (delta mode is unavailable due to lack of attic data). Maybe have a longer wait time in case job causes too much load.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RestartSec is used when the service failled, in this case, when rules_loop.sh crash.
Actually, in this case it will never be hit as rules_loop.sh is mainly a while true loop.

Copy link

@mmd-osm mmd-osm Aug 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, you're right. Somehow got sidetracked by the name "restart". So, the same applies to the script itself then, if wait time is too low in there.

Signed-off-by: Rodolphe Pelloux-Prayer <rodolphe@damsy.net>
@jocelynj
Copy link
Member

@RoPP : Can you confirm that I can merge it now ? (I'm not sure if all remarks by @mmd-osm were resolved)

I did some simple tests to dev.api.openstreetmap.fr from http://overpass-turbo.eu/ and it seems to work correctly. Do you think that we can now install a whole planet instead of France only ?

@RoPP
Copy link
Contributor Author

RoPP commented Aug 17, 2017

@jocelynj Yes, we can merge it and setup new VM for whole planet.

@jocelynj jocelynj merged commit dd99b69 into osm-fr:master Aug 18, 2017
jocelynj added a commit that referenced this pull request Aug 18, 2017
@jocelynj
Copy link
Member

Thanks, I've merged to master.

@mmd-osm
Copy link

mmd-osm commented Aug 19, 2017

We have a few cgi-bin scripts, like convert, kill_my_queries, timestamp both as executable and shell script. Do you plan to also include them?

[Service]
Type=simple
User={{ overpass_user }}
ExecStartPre=-/bin/rm {{ overpass_database_dir }}/osm3s_{{ overpass_version }}_areas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove those rm ... ExecStartPre? See http://wiki.openstreetmap.org/w/index.php?title=Overpass_API/Installation&diff=1502925&oldid=1459308&rcid=&curid=72215:

Do not automatically remove any of the lock files, socket files or shared memory files. They work as canaries, i.e. hitting existing files is almost always an indicator for bigger trouble elsewhere. Please ask back in those cases.

(this affects all dispatcher scripts)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense. These PreExecStart statements are from wiki but I didn't check if they're usefull or needed. Thanks for clarification.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those wiki scripts were added by third party users, have never been reviewed and caused serious issues down the road (segmentation fault). Roland puts extra scrutiny on those now, making sure they're ok.

@RoPP
Copy link
Contributor Author

RoPP commented Aug 30, 2017

Btw, all scripts in cgi-bin (20!) are now available but I'm not very confortable with that. Are all these scripts useful?

@mmd-osm
Copy link

mmd-osm commented Aug 30, 2017

Good point, I reviewed those put up the following list:

Recommended

  • kill_my_queries makes sense, it aborts your own queries via kill
  • convert is useful to translate between various Overpass dialects (XML <--> QL)
  • map - useful, corresponds to map call on osm.org
  • status - important, if you use rate limiting, I would leave it there.

Optional

  • xapi / xapi_meta require /tmp/translate_xapi/ directory in version 0.7.54 for temporary results. XAPI is very much outdated these days, so could skip that
  • draw_line, sketch-* - see http://wiki.openstreetmap.org/wiki/Overpass_API#Public_transport_example. Something I would remove, but I leave it as optional.
  • ping - used to be a CPU hog on overpass-api.de, as every instance in the world would query the central instance, rather than their own instance. Keep a close eye on it. block it, it called to often

Remove

  • augmented_* doesn't make sense since you don't have an attic database
  • template - don't know what it's good for -> remove
  • trigger_clone - you don't want to offer cloning feature -> remove

Unclear

  • sitemap

@RoPP RoPP deleted the wip_overpass_api branch September 21, 2017 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants