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
Magrit playbook: Cartography Teaching+Learning #1579
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d639ad2
check in ready to try on rpi
georgejhunt f27cf60
first efforts to run on rpi
georgejhunt 1a85a85
capture progress so far
georgejhunt 3ab3f59
still problems with regexp and quotes
georgejhunt b11906c
some debugging of service file, and some missing dependencies
georgejhunt 2c38caf
systemd disabled always
georgejhunt 266f28f
finally got it running
georgejhunt 91c3388
Merge branch 'magrit' of https://github.com/georgejhunt/iiab into magrit
georgejhunt File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
magrit_port: 9999 | ||
magrit_dir: /opt/iiab/magrit | ||
magrit_venv: /opt/iiab/magrit/venv | ||
magrit_install: False | ||
magrit_enabled: False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
- name: Install packages reqpured for magrit thematic mapping https://github.com/riatelab/magrit | ||
package: | ||
name: | ||
- libpython3.5-dev | ||
- python3.5 | ||
- python3.5-dev | ||
- python3-pip | ||
- libopenblas-dev | ||
- libopenblas-base | ||
- libfreetype6-dev | ||
- libfreetype6 | ||
- libproj-dev | ||
- libspatialindex-dev | ||
- libv8-3.14-dev | ||
- libffi-dev | ||
- node-gyp | ||
- libuv1-dev | ||
- libxslt1-dev | ||
- libxml2 | ||
- libxml2-dev | ||
- libkml-dev | ||
- libgeos-dev | ||
- redis-server | ||
- libatlas-base-dev | ||
state: present | ||
when: internet_available and is_rpi | ||
tags: | ||
- download | ||
|
||
- name: Check if our package is already downloaded | ||
stat: | ||
path: '{{ downloads_dir }}/gdal_2.2.3-1_armhf.deb' | ||
register: p | ||
|
||
- name: Download our compiled version of Geospatial Data Abstraction lIbrary (GDAL) | ||
get_url: | ||
url: '{{ iiab_download_url }}/gdal_2.2.3-1_armhf.deb' | ||
dest: '{{ downloads_dir }}' | ||
when: p.stat.isdir is defined and p.stat.isdir and internet_available and is_rpi | ||
|
||
- name: Install GDAL | ||
shell: "apt-get install {{ downloads_dir }}/gdal_2.2.3-1_armhf.deb" | ||
args: | ||
warn: false | ||
when: internet_available and is_rpi | ||
|
||
- name: Tell the loader where to find the libgdal library | ||
shell: ldconfig /usr/local/lib | ||
when: internet_available and is_rpi | ||
|
||
- name: Clone magrit repo | ||
git: | ||
repo: https://github.com/riatelab/magrit | ||
dest: "{{ magrit_venv }}" | ||
version: master | ||
update: yes | ||
force: yes | ||
when: internet_available and is_rpi and magrit_install | ||
|
||
- name: Install magrit with dependencies using pip, into virtualenv (debuntu) | ||
pip: | ||
name: | ||
- numpy | ||
- ujson | ||
- docopt | ||
- pandas | ||
virtualenv: "{{ magrit_venv }}" | ||
virtualenv_python: python3.5 | ||
when: internet_available and is_rpi | ||
|
||
- name: Install the magrit requirements | ||
pip: | ||
requirements: '{{ magrit_venv }}/requirements/dev.txt' | ||
virtualenv: "{{ magrit_venv }}" | ||
|
||
- name: Edit the python environment spec | ||
lineinfile: | ||
path: '{{ magrit_venv }}/magrit_app/app.py' | ||
regexp: '^#!/usr/bin/env.*' | ||
line: '#!/usr/bin/env python3.5' | ||
|
||
- name: Compile the python helper stubs | ||
shell: "{{ magrit_venv }}/bin/cythonize -i -b {{ magrit_venv }}/magrit_app/*.pyx" | ||
|
||
- name: Put systemd service file | ||
template: | ||
src: magrit.service.j2 | ||
dest: /etc/systemd/system/magrit.service | ||
|
||
- name: Enable systemd for magrit | ||
systemd: | ||
enabled: True | ||
started: True | ||
when: | ||
magrit_enabled: True | ||
|
||
- name: Disable systemd for magrit | ||
systemd: | ||
enabled: False | ||
started: False | ||
when: | ||
magrit_enabled == False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Magrit | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart={{ magrit_venv }}/bin/python3.5 -m /{{ magrit_venv }}/magrit_app/app,py --port {{ magrit_port }} --address {{ lan_ip }} | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Lines 83-95 look incomplete.
Use https://github.com/iiab/iiab/blob/master/roles/nodered/tasks/main.yml#L202-L216 as a model if poss?