1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Merge pull request #271 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2019-07-15 14:19:36 -04:00 committed by GitHub
commit 60f63fc826
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 58 additions and 28 deletions

View file

@ -3,16 +3,18 @@
# calibreweb_install: False
# calibreweb_enabled: False
# calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
# calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
# calibreweb_url: /books # FOR SHORT URL http://box/books -- add {box/libros, box/livres, box/livros, box/liv} etc?
# calibreweb_url1: /books # For SHORT URL http://box/books (English)
# calibreweb_url2: /libros # For SHORT URL http://box/libros (Spanish)
# calibreweb_url3: /livres # For SHORT URL http://box/livres (French)
# calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web for books, metadata.db & config/app.db
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
calibreweb_version: 0.6.3 # WAS: master
calibreweb_version: V0.6.4 # WAS: master
calibreweb_venv_path: /usr/local/calibre-web
calibreweb_exec_path: "{{ calibreweb_venv_path }}/cps.py"

View file

@ -59,7 +59,7 @@
dest: "{{ calibreweb_venv_path }}/vendor"
state: link
- name: Install unit file /etc/systemd/system/calibre-web.service & /etc/apache2/sites-available/calibre-web.conf for http://box{{ calibreweb_url }}, from templates
- name: Install unit file /etc/systemd/system/calibre-web.service & /etc/apache2/sites-available/calibre-web.conf for http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} from templates
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
@ -110,7 +110,7 @@
# Default: http://box/books
# SEE ALSO: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy
- name: Enable http://box{{ calibreweb_url }} with Apache
- name: Enable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} with Apache
command: a2ensite calibre-web.conf
when: calibreweb_enabled | bool
@ -126,7 +126,7 @@
state: stopped
when: not calibreweb_enabled
- name: Disable http://box{{ calibreweb_url }} with Apache
- name: Disable http://box{{ calibreweb_url1 }}, http://box{{ calibreweb_url2 }}, http://box{{ calibreweb_url3 }} with Apache
command: a2dissite calibre-web.conf
when: not calibreweb_enabled
@ -150,8 +150,12 @@
value: calibre-web
- option: description
value: '"calibre-web is a web app providing a clean interface for browsing, reading and downloading e-books."'
- option: calibreweb_url
value: "{{ calibreweb_url }}"
- option: calibreweb_url1
value: "{{ calibreweb_url1 }}"
- option: calibreweb_url2
value: "{{ calibreweb_url2 }}"
- option: calibreweb_url3
value: "{{ calibreweb_url3 }}"
- option: calibreweb_path
value: "{{ calibreweb_venv_path }}"
- option: calibreweb_home

View file

@ -6,17 +6,22 @@
# Unnec when "{{ calibreweb_url }}" is added to Proxy* directive(s) further below
# <Location "{{ calibreweb_url }}" >
RequestHeader set X-SCRIPT-NAME {{ calibreweb_url }}
# 2019-07-14: this line remains necessary (page barely renders without it!)
RequestHeader set X-SCRIPT-NAME {{ calibreweb_url1 }}
# Appears unnec:
RequestHeader set X-SCHEME http
#RequestHeader set X-SCHEME http
ProxyPass {{ calibreweb_url }} http://localhost:{{ calibreweb_port }}/
ProxyPass {{ calibreweb_url1 }} http://localhost:{{ calibreweb_port }}/
ProxyPass {{ calibreweb_url2 }} http://localhost:{{ calibreweb_port }}/
ProxyPass {{ calibreweb_url3 }} http://localhost:{{ calibreweb_port }}/
# Possibly unnec? (ProxyPassReverse rewrites internal links, that come back
# from Apache proxy. Whereas e.g. kiwix.conf doesn't need this, as kiwix itself
# prefixes URLs, thanks to --urlRootLocation=/kiwix/ in its systemd file.)
ProxyPassReverse {{ calibreweb_url }} http://localhost:{{ calibreweb_port }}/
ProxyPassReverse {{ calibreweb_url1 }} http://localhost:{{ calibreweb_port }}/
ProxyPassReverse {{ calibreweb_url2 }} http://localhost:{{ calibreweb_port }}/
ProxyPassReverse {{ calibreweb_url3 }} http://localhost:{{ calibreweb_port }}/
# </Location>

View file

@ -18,7 +18,7 @@
# http://box:8080 & http://box:8080/mobile WORK FOR NOW, but short/mnemonic
# URL's like http://box/calibre DON'T YET WORK -- BOOKS RARELY DISPLAY:
# calibre_web_path: calibre # NEEDS WORK: https://github.com/iiab/iiab/issues/529
# Avoid URL collisions with calibreweb_url !
# Avoid URL collisions w/ calibreweb_url1, calibreweb_url2, calibreweb_url3 below!
# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!

View file

@ -215,7 +215,7 @@ def write_zim_versions_idx():
get_substitution_data(perma_ref, zims_installed, path_to_id_map)
zim_versions[perma_ref]['article_count'] = articlecount
zim_versions[perma_ref]['media_count'] = mediacount
size = human_readable(size)
size = human_readable(float(size) * 1024) # kiwix reports in K
zim_versions[perma_ref]['size'] = size
zim_versions[perma_ref]['tags'] = tags
zim_versions[perma_ref]['language'] = lang
@ -228,7 +228,7 @@ def write_zim_versions_idx():
fp.close()
else:
print zim_version_idx_dir + " not found."
def get_substitution_data(perma_ref,zims_installed, path_to_id_map):
#reconstruct the path in the id map
path = 'content/' + zim_versions[perma_ref]['file_name'] + '.zim'
@ -290,6 +290,7 @@ def get_kiwix_catalog_item(perma_ref):
def human_readable(num):
# return 3 significant digits and unit specifier
# TFM 7/15/2019 change to factor of 1024, not 1000 to match similar calcs elsewhere
num = float(num)
units = [ '','K','M','G']
for i in range(4):
@ -299,7 +300,7 @@ def human_readable(num):
return "%.1f%s"%(num,units[i])
if num < 1000.0:
return "%.0f%s"%(num,units[i])
num /= 1000.0
num /= 1024.0
# Now start the application
if __name__ == "__main__":

View file

@ -68,6 +68,15 @@ To reset the database, run the following command::
This command will remove all users and all emails from the system.
Nightly Internet Email Sync (Not Easy!)
---------------------------------------
The Lokole software can be configured to access the Internet via USB modem, SIM card, or Ethernet, by setting the environment variable ``OPWEN_SIM_TYPE`` in the configuration file ``/etc/apache2/sites-enabled/lokole.conf``. By default, this installation of Lokole is set to local-only (offline) mode, in which users can only send emails to other users on the same installation and cannot send emails over the Internet. This has been done by setting ``OPWEN_SIM_TYPE`` to ``LocalOnly``.
If configured to work with a USB modem or other form of Internet connection, Lokole will sync with the cloud server (operated by `Ascoderu <https://ascoderu.ca/>`_) on a nightly basis to deliver and receive emails globally. However, arranging this is extremely complicated. You would need a compatible form of connection and an Internet expert familiar with modem protocols, MX records, etc. Ask that person to read the `Lokole software README <https://github.com/ascoderu/opwen-webapp/blob/master/README.rst>`_ in its entirety, to help you understand whether this is realistic for your organization.
Lokole and Internet-in-a-Box would welcome a business plan (whether volunteer-based, grant-based or for-profit) from someone willing to operationalize this — making it relatively hassle-free for schools, clinics, libraries and orphanages around the world — that generally do not have access to technical experts. Please `contact us <http://wiki.laptop.org/go/IIAB/FAQ#What_are_the_best_places_for_community_support.3F>`_ if you have the capacity to help make such a social enterprise happen.
Troubleshooting
---------------

View file

@ -1,3 +1,4 @@
export OPWEN_SIM_TYPE='LocalOnly'
export OPWEN_STATE_DIRECTORY='{{lokole_run_directory}}'
export OPWEN_SESSION_KEY='{{ lookup('password', '/dev/null chars=ascii_letters,digits,_ length=32') }}'
export OPWEN_PASSWORD_SALT='{{ lookup('password', '/dev/null chars=ascii_letters,digits,_ length=16') }}'

View file

@ -486,7 +486,7 @@ calibre_port: 8080
# http://box:8080 & http://box:8080/mobile WORK FOR NOW, but short/mnemonic
# URL's like http://box/calibre DON'T YET WORK -- BOOKS RARELY DISPLAY:
calibre_web_path: calibre # NEEDS WORK: https://github.com/iiab/iiab/issues/529
# Avoid URL collisions with calibreweb_url: below!
# Avoid URL collisions w/ calibreweb_url1, calibreweb_url2, calibreweb_url3 below!
# WARNING: Calibre-Web (below) depends on Calibre's own /usr/bin/ebook-convert
# program, so we recommend you also install Calibre (above!)
@ -494,9 +494,11 @@ calibre_web_path: calibre # NEEDS WORK: https://github.com/iiab/iiab/issues/5
# Calibre-Web alternative to Calibre, offers a clean/modern UX
calibreweb_install: False
calibreweb_enabled: False
calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
# http://box/books works. Add {box/libros, box/livres, box/livros, box/liv} etc?
calibreweb_url: /books
calibreweb_url1: /books # For SHORT URL http://box/books (English)
calibreweb_url2: /libros # For SHORT URL http://box/libros (Spanish)
calibreweb_url3: /livres # For SHORT URL http://box/livres (French)
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
# Internet Archive Decentralized Web - create your own offline version box:4244

View file

@ -306,7 +306,7 @@ calibre_enabled: False
calibre_port: 8080
# Change calibre to XYZ to add your own mnemonic URL like: http://box/XYZ
calibre_web_path: calibre #NEEDS WORK: https://github.com/iiab/iiab/issues/529
# Avoid collisions with calibreweb_url: below!
# Avoid URL collisions w/ calibreweb_url1, calibreweb_url2, calibreweb_url3 below!
# WARNING: Calibre-Web (below) depends on Calibre's own /usr/bin/ebook-convert
# program, so we recommend you also install Calibre (above!)
@ -314,9 +314,11 @@ calibre_web_path: calibre #NEEDS WORK: https://github.com/iiab/iiab/issues/529
# Calibre-Web alternative to Calibre, offers a clean/modern UX
calibreweb_install: True
calibreweb_enabled: True
calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
# http://box/books works. Add {box/libros, box/livres, box/livros, box/liv} etc?
calibreweb_url: /books
calibreweb_url1: /books # For SHORT URL http://box/books (English)
calibreweb_url2: /libros # For SHORT URL http://box/libros (Spanish)
calibreweb_url3: /livres # For SHORT URL http://box/livres (French)
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
# Internet Archive Decentralized Web - create your own offline version box:4244

View file

@ -306,7 +306,7 @@ calibre_enabled: False
calibre_port: 8080
# Change calibre to XYZ to add your own mnemonic URL like: http://box/XYZ
calibre_web_path: calibre #NEEDS WORK: https://github.com/iiab/iiab/issues/529
# Avoid collisions with calibreweb_url: below!
# Avoid URL collisions w/ calibreweb_url1, calibreweb_url2, calibreweb_url3 below!
# WARNING: Calibre-Web (below) depends on Calibre's own /usr/bin/ebook-convert
# program, so we recommend you also install Calibre (above!)
@ -314,9 +314,11 @@ calibre_web_path: calibre #NEEDS WORK: https://github.com/iiab/iiab/issues/529
# Calibre-Web alternative to Calibre, offers a clean/modern UX
calibreweb_install: True
calibreweb_enabled: True
calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
# http://box/books works. Add {box/libros, box/livres, box/livros, box/liv} etc?
calibreweb_url: /books
calibreweb_url1: /books # For SHORT URL http://box/books (English)
calibreweb_url2: /libros # For SHORT URL http://box/libros (Spanish)
calibreweb_url3: /livres # For SHORT URL http://box/livres (French)
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
# Internet Archive Decentralized Web - create your own offline version box:4244

View file

@ -306,7 +306,7 @@ calibre_enabled: False
calibre_port: 8080
# Change calibre to XYZ to add your own mnemonic URL like: http://box/XYZ
calibre_web_path: calibre #NEEDS WORK: https://github.com/iiab/iiab/issues/529
# Avoid collisions with calibreweb_url: below!
# Avoid URL collisions w/ calibreweb_url1, calibreweb_url2, calibreweb_url3 below!
# WARNING: Calibre-Web (below) depends on Calibre's own /usr/bin/ebook-convert
# program, so we recommend you also install Calibre (above!)
@ -314,9 +314,11 @@ calibre_web_path: calibre #NEEDS WORK: https://github.com/iiab/iiab/issues/529
# Calibre-Web alternative to Calibre, offers a clean/modern UX
calibreweb_install: False
calibreweb_enabled: False
calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019)
# http://box/books works. Add {box/libros, box/livres, box/livros, box/liv} etc?
calibreweb_url: /books
calibreweb_url1: /books # For SHORT URL http://box/books (English)
calibreweb_url2: /libros # For SHORT URL http://box/libros (Spanish)
calibreweb_url3: /livres # For SHORT URL http://box/livres (French)
calibreweb_home: "{{ content_base }}/calibre-web" # /library/calibre-web
# Internet Archive Decentralized Web - create your own offline version box:4244