Commit 1de0d964 authored by rgaudin's avatar rgaudin

Removed ideacube

- static homepage generated in installer (using ideascube template)
- shared static for all system pages
- changed default user from `ideascube` to `user`
- `default` cert replaced with actual FQDN one
- ZIM files copied directly into data/packages/
- new master to include those changes
- `default` cert replaced with actual FQDN one
parent b1e985c1
2.05
* Remove ideascube (homepage is static generated on installer)
* Image file shrunk after creation
2.0.4
* Speed up improvements for Wikifundi
* Updated kiwix-serve to 0.9.0
* Image file shrunk after creation
2.0.3
* Added --root for CLI on linux to use losetup instead of udisks (for docker)
......
# Kiwix Hotspot
This installer install [Ideascube](https://framagit.org/ideascube/ideascube) on an SD card for raspberrypi 2 or raspberrypi 3.
This installer installs an hotspot system on an SD card for raspberrypi 2 or raspberrypi 3.
Ideascube is a solution to serve offline content from the web such as Wikipedia, the Gutenberg library, TED talks.
This solution serves offline content from the web such as Wikipedia, the Gutenberg library, TED talks.
Kiwix Hotspot configure the RaspberryPi into a hotspot WiFi with Ideascube server and offline contents.
Kiwix Hotspot configure the RaspberryPi into a hotspot WiFi with offline contents.
## Issues
Please report issues [on framagit](https://framagit.org/ideascube/pibox-installer/issues).
## Principle
## History
The installer emulate the rasbperrypi architecture armhf in QEMU.
Inside the emulator it builds [ideascube](https://framagit.org/ideascube/ideascube) with [ansiblecube](https://github.com/kiwix/kiwix-hotspot/tree/master/ansiblecube).
Inside the emulator it built [ideascube](https://framagit.org/ideascube/ideascube) with [ansiblecube](https://github.com/kiwix/kiwix-hotspot/tree/master/ansiblecube).
presentation of the projet at Potsdam [Slides](http://wiki.kiwix.org/w/images/4/43/Pibox_installer_potsdam_2017_presentation.pdf)
......@@ -66,7 +66,7 @@ kiwix-hotspot uses a custom base image based off raspbian-lite with the followin
* SSH enabled
* 7GB `/` partition (ext4)
* 1GB `/data` partition (extfat)
* ansiblecube deployed: `nginx`, `ideascube`, `kiwix-serve`, etc.
* ansiblecube deployed: `nginx`, `kiwix-serve`, etc.
Should you want to build the base image:
......
......@@ -14,7 +14,7 @@ This is achieved by using a three steps scenario:
## Tags
* `master`: installs all non-content-specific softwares (system, `ideascube`, `kiwix-serve`).
* `master`: installs all non-content-specific softwares (system, `kiwix-serve`).
* `resize`: resize the `/` and `/data` partitions (image should have been already resized qemu-wise).
* `rename`: reconfigure all software according to `project_name`.
* `setup`: install and prepare all softwares without enabling them.
......@@ -32,7 +32,6 @@ This is achieved by using a three steps scenario:
* DNS Masquerade (`dnsmasq`)
* Captive Portal
* Web & Application servers (`nginx`, `uswgi`)
* Content & Box Manager (`ideascube`)
* ZIM files (all of [kiwix](https://kiwix.org)'s library) with indexes.
* Khan-Accademy Videos (`ka-lite`)
* Aflatoun
......@@ -45,10 +44,6 @@ This playbook is not meant to be run standalone on any system.
Please check [make-base-image](https://github.com/kiwix/kiwix-hotspot/tree/master/make-vexpress-boot) and more generally [kiwix-hotspot](https://github.com/kiwix/kiwix-hotspot) to see it in action.
## Tests
The repo is plugged in [Travis CI](https://travis-ci.org/ideascube/ansiblecube).
### Testing locally
__Setting-up test envirronment__
......
......@@ -6,15 +6,13 @@ lan_interface: eth0
lan_interface2: eth1
client_interface: wlan1
max_wifi_client: 15
hostname: ideasbox
hostname: kiwix
tld: "hotspot"
fqdn: "{{ hostname }}.{{ tld }}"
welcome_fqdn: "goto.kiwix.{{ tld }}"
version_fqdn: "version.{{ fqdn }}"
cert_domain: ideascube.{{ tld }}
hotspot_name: ideasbox
project_name: ideasbox
ideascube_id: pibox
hotspot_name: kiwix
project_name: kiwix
# System
installer_version: unknown
......@@ -24,7 +22,8 @@ data_partition: "{{ disk }}p3"
data_path: /data
disk_size: 7760000000
root_partition_size: 7000000000
username: ideascube
username: user
group: user
password: $6$YcJS1HjRAv/$1bUosoPalzHEvfpx71UhnG6vCeckTGbA5U1i6UpA8X21Jrv7fYRPyNrq/YWuiBp3xQWd5kRRhrKKPHcbTkkfQ/
mirror: https://download.kiwix.org
timezone: "Europe/Paris"
......@@ -36,14 +35,11 @@ qemu_kernel_version: "4.10.0"
kernel_version: "4.14.34"
kiwix_version: "0.9.0"
kalite_version: "0.17.4"
ideascube_version: "0.37.2"
edupi_version: "1.4.10"
python3_version: "3.5"
# Apps path
zim_path: /var/ideascube/kiwix
venvs_root: /home/{{ username }}/venvs
ideascube_handlers: ['kiwix', 'nginx', 'mediacenter']
aflatoun_root: "{{ data_path }}/aflatoun"
aflatoun_env: "{{ venvs_root }}/aflatoun"
edupi_root: "/home/{{ username }}/edupi"
......@@ -55,6 +51,7 @@ wikifundi_data_root: "{{ data_path }}/wikifundi"
wikifundi_root: "/var/www/wikifundi"
mediawiki_root: "{{ wikifundi_root }}/w"
parsoid_root: "{{ mediawiki_root }}/parsoid"
common_static_path: "/var/www/static"
# Domain names
kiwix_server_name: kiwix.{{ hostname }}
......@@ -62,7 +59,6 @@ kalite_server_name: khanacademy.{{ hostname }}
aflatoun_server_name: aflatoun.{{ hostname }}
edupi_server_name: edupi.{{ hostname }}
wikifundi_server_name: wikifundi.{{ hostname }}
sites_server_name: sites.{{ hostname }}
time_server_name: time.{{ hostname }}
kiwix_fqdn: kiwix.{{ fqdn }}
......@@ -70,7 +66,6 @@ kalite_fqdn: khanacademy.{{ fqdn }}
aflatoun_fqdn: aflatoun.{{ fqdn }}
edupi_fqdn: edupi.{{ fqdn }}
wikifundi_fqdn: wikifundi.{{ fqdn }}
sites_fqdn: sites.{{ fqdn }}
time_fqdn: time.{{ fqdn }}
# content & features
......@@ -88,6 +83,6 @@ aflatoun_content_path: "{{ data_path }}/aflatoun_content"
aflatoun_langpack_prefix: "{{ data_path }}/aflatoun_pack_"
kalite_langpack_prefix: "{{ data_path }}/kalite_pack_"
kalite_videos_prefix: "{{ data_path }}/kalite_videos_"
packages_cache: "{{ data_path }}/packages_cache"
zim_path: "{{ data_path }}/packages"
wikifundi_langpack_prefix: "{{ data_path }}/wikifundi_langpack_"
edupi_resources_path: "{{ data_path }}/edupi_resources"
......@@ -23,16 +23,21 @@
# master, resize
- role: resize
# master, rename
- role: nginx
tags: master
- role: home
- role: uwsgi
tags: master
# master, rename, setup, reconfigure
- role: ideascube
- role: dnsmasq
- role: hostapd
- role: iptables
- role: network-manager
# master, rename
# master, resize, rename
- role: kiwix
# master, rename (nginx hostname), reconfigure (password)
......
......@@ -2,8 +2,8 @@
Description=Aflatoun server
[Service]
User=ideascube
Group=ideascube
User={{ username }}
Group={{ group }}
Environment="KALITE_HOME={{ aflatoun_root }}"
Environment="KALITE_PYTHON={{ aflatoun_env }}/bin/python"
ExecStart={{ aflatoun_env }}/bin/kalite start --port=8009 --foreground
......
......@@ -43,7 +43,7 @@ server {
proxy_pass http://localhost:8009;
}
location /ideascube-static/ { alias /var/ideascube/static/; expires 1y; }
location /hotspot-static/ { alias {{ common_static_path }}/; expires 1y; }
location /502.html { internal; root /var/www; }
error_page 502 /502.html;
}
......@@ -22,8 +22,8 @@
- name: Create /var/www/captiveportal folder
file:
path: /var/www/captiveportal
owner: ideascube
group: ideascube
owner: "{{ username }}"
group: "{{ username }}"
mode: 0755
state: directory
tags: master
......@@ -32,29 +32,21 @@
template:
src: cap.py.j2
dest: /var/www/captiveportal/cap.py
owner: ideascube
group: ideascube
owner: "{{ username }}"
group: "{{ username }}"
mode: 0755
notify: restart uwsgi
tags: ['master', 'rename']
- name: Add nginx specific configuration file
copy:
src: nginx-captiveportal
template:
src: nginx.vhost.j2
dest: /etc/nginx/sites-available/captiveportal
owner: root
group: root
mode: 0644
tags: master
- name: Make sure ideascube is not default_server
lineinfile:
dest: /etc/nginx/sites-available/ideascube
regexp: '^(.*)listen(.*)default_server(.*)'
line: " listen 80 ;"
backrefs: yes
tags: master
- name: Enable captive portal vhost
file:
src: /etc/nginx/sites-available/captiveportal
......@@ -80,21 +72,19 @@
state: directory
tags: master
- name: Generate a Private key
command: openssl genrsa -out /etc/nginx/ssl/ideascube.key 2048
tags: master
- name: prepare CSR
template:
src: csr.conf
dest: /tmp/csr.conf
tags: ['master', 'rename']
- name: Create Certificate Signing Request
command: openssl req -new -sha256 -key /etc/nginx/ssl/ideascube.key -out /etc/nginx/ssl/ideascube.csr -subj "/C=CH/ST=Vaud/L=Lausanne/O=Kiwix/OU=Kiwix Hotspot/CN={{ fqdn }}"
command: openssl req -config /tmp/csr.conf -new -x509 -newkey rsa:2048 -nodes -keyout /etc/nginx/ssl/hotspot.key -days 3650 -out /etc/nginx/ssl/hotspot.crt -batch
tags: ['master', 'rename']
- name: Sign the certificate
command: openssl x509 -req -sha256 -days 3650 -in /etc/nginx/ssl/ideascube.csr -signkey /etc/nginx/ssl/ideascube.key -out /etc/nginx/ssl/ideascube.crt
tags: ['master', 'rename']
- name: Add UWSGI specific configuration file
copy:
src: captive.ini
template:
src: captive.ini.j2
dest: /etc/uwsgi/apps-available/captive.ini
owner: root
group: root
......
......@@ -59,16 +59,16 @@ header = u"""<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>{{ hotspot_name }}</title>
<link rel="icon" href="/ideascube-static/branding/favicon.png">
<link rel="stylesheet" href="/ideascube-static/ideascube/vendor/font-awesome/css/font-awesome.min.css" />
<link rel="icon" href="/hotspot-static/branding/favicon.png">
<link rel="stylesheet" href="/hotspot-static/font-awesome/css/font-awesome.min.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" type="text/css" href="/ideascube-static/ideascube/vendor/purecss/pure-css-grids-old-ie-min.css">
<link rel="stylesheet" type="text/css" href="/hotspot-static/purecss/pure-css-grids-old-ie-min.css">
<![endif]-->
<!--[if gt IE 8]><!-->
<link rel="stylesheet" type="text/css" href="/ideascube-static/ideascube/vendor/purecss/pure-css-grids-min.css">
<link rel="stylesheet" type="text/css" href="/hotspot-static/purecss/pure-css-grids-min.css">
<!--<![endif]-->
<link rel="stylesheet" type="text/css" href="/ideascube-static/ideascube/main.css" />
<link rel="stylesheet" type="text/css" href="/ideascube-static/branding/style.css" />
<link rel="stylesheet" type="text/css" href="/hotspot-static/main.css" />
<link rel="stylesheet" type="text/css" href="/hotspot-static/branding/style.css" />
</head>"""
parta = u"""
......@@ -77,7 +77,7 @@ parta = u"""
<section>
<a href="/">
<h1>
<img src="/ideascube-static/branding/header-logo.png"></img>
<img src="/hotspot-static/branding/logo.png"></img>
</h1>
</a>
<span class="boxid">{{ project_name }}!</span>
......@@ -104,9 +104,7 @@ footer = u"""
<footer>
<div class="row">
<div class="col third i18n_switch"></div>
<div class="col half">
<img src="/ideascube-static/ideascube/img/logoBSF.png" />
</div>
<div class="col half"></div>
</div>
</footer>
</body>
......
[uwsgi]
autoload = false
uid = ideascube
gid = ideascube
uid = {{ username }}
gid = {{ group }}
socket = :3031
wsgi-file = /var/www/captiveportal/cap.py
......
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = extensions
x509_extensions = extensions
string_mask = utf8only
[ subject ]
countryName = CH
countryName_default = CH
stateOrProvinceName = Vaud
stateOrProvinceName_default = Vaud
localityName = Lausanne
localityName_default = Lausanne
organizationName = Kiwix
organizationName_default = Kiwix
commonName = Kiwix Hotspot
commonName_default = Kiwix Hotspot
emailAddress = hotspot@kiwix.org
emailAddress_default= hotspot@kiwix.org
[ extensions ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alternate_names
nsComment = "OpenSSL Generated Certificate"
[ alternate_names ]
DNS.1 = {{ fqdn }}
DNS.2 = {{ welcome_fqdn }}
......@@ -6,8 +6,8 @@ server {
listen 443 ssl default_server;
# SSL certificate only used to allow forwarding of HTTPS requests.
ssl_certificate /etc/nginx/ssl/ideascube.crt;
ssl_certificate_key /etc/nginx/ssl/ideascube.key;
ssl_certificate /etc/nginx/ssl/hotspot.crt;
ssl_certificate_key /etc/nginx/ssl/hotspot.key;
keepalive_timeout 0;
location / {
......@@ -17,7 +17,7 @@ server {
uwsgi_pass 127.0.0.1:3031;
}
location /ideascube-static/ { alias /var/ideascube/static/; expires 1y; }
location /hotspot-static/ { alias {{ common_static_path }}/; expires 1y; }
location /502.html { internal; root /var/www; }
error_page 502 /502.html;
}
......@@ -31,7 +31,7 @@
file:
path: /var/www/clock
owner: "{{ username }}"
group: ideascube
group: "{{ group }}"
mode: 0755
state: directory
tags: master
......@@ -41,14 +41,14 @@
src: clock.py
dest: /var/www/clock/clock.py
owner: "{{ username }}"
group: ideascube
group: "{{ group }}"
mode: 0755
notify: restart uwsgi
tags: master
- name: Add UWSGI specific configuration file
copy:
src: uwsgi.ini
template:
src: clock.ini.j2
dest: /etc/uwsgi/apps-available/clock.ini
owner: root
group: root
......
[uwsgi]
autoload = false
uid = ideascube
gid = ideascube
uid = {{ username }}
gid = {{ group }}
socket = :3032
wsgi-file = /var/www/clock/clock.py
......
......@@ -2,8 +2,8 @@
Description=Edupi server
[Service]
User=ideascube
Group=ideascube
User={{ username }}
Group={{ group }}
WorkingDirectory={{ edupi_root }}
ExecStart={{ edupi_env }}/bin/gunicorn \
--bind localhost:8010 edupi.wsgi:application \
......
......@@ -20,7 +20,7 @@ server {
proxy_pass http://localhost:8010;
}
location /ideascube-static/ { alias /var/ideascube/static/; expires 1y; }
location /hotspot-static/ { alias {{ common_static_path }}/; expires 1y; }
location /502.html { internal; root /var/www; }
error_page 502 /502.html;
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.