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
Conversation
roles/overpass-api/tasks/compile.yml
Outdated
validate_certs: false | ||
remote_src: true | ||
become: yes | ||
become_user: "{{ user }}" |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
roles/overpass-api/tasks/compile.yml
Outdated
args: | ||
chdir: "{{ project_dir }}/Overpass-API-osm3s-{{ overpass_release }}/src" | ||
become: yes | ||
become_user: "{{ user }}" |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea :)
roles/overpass-api/tasks/compile.yml
Outdated
- zlib1g-dev | ||
- bzip2 | ||
- wget | ||
- liblz4-dev |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 }}" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
3341df7
to
a10a70e
Compare
7de12fe
to
360f78c
Compare
What is the current status of this branch ? Is is mergeable ? Should I review it one more time ? |
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 |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
roles/overpass-api/defaults/main.yml
Outdated
@@ -0,0 +1,7 @@ | |||
--- | |||
user: overpass |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 }}/ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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."
There was a problem hiding this comment.
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 :)
roles/overpass-api/tasks/main.yml
Outdated
@@ -0,0 +1,67 @@ | |||
- include: ../../../shared/project-account.yml |
There was a problem hiding this comment.
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}}" ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>
@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 ? |
@jocelynj Yes, we can merge it and setup new VM for whole planet. |
Thanks, I've merged to master. |
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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Btw, all scripts in cgi-bin (20!) are now available but I'm not very confortable with that. Are all these scripts useful? |
Good point, I reviewed those put up the following list: Recommended
Optional
Remove
Unclear
|
Ne pas merger !
Il manque encore quelques morceaux…