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

Merge branch 'master' into minetest-doc

This commit is contained in:
A Holt 2019-02-10 13:49:47 -05:00 committed by GitHub
commit b78f56512d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 237 additions and 177 deletions

View file

@ -19,15 +19,36 @@ The admin user is the usual: ``Admin``
No password is required.
Configurable Parameters
-----------------------
- minetest_install: set minetest up to install; default is False
- minetest_enabled: set minetest up to be enabled; default is False
- minetest_port: port on which client should connect; default is 30000
- minetest_server_admin: user with all permissions on minetest server; default is Admin
- minetest_default_game: only carbone-ng and minetest engines are supported; default is `carbone-ng <https://github.com/Calinou/carbone-ng>`_
- minetest_flat_world: use a flat mapgen engine to lower computation on client; default is False
File Locations
--------------
- The config file is: ``/etc/minetest/minetest.conf``
- The world files are at ``/library/games/minetest/worlds/world``
File Locations on Raspberry Pi
------------------------------
- The server binary is ``/library/games/minetest/bin/minetestserver``
- The working directory is ``//library/games/minetest``
- mods are in ``/library/games/minetest/games/<game>/mods``
- The config file is: ``/etc/minetest/minetest.conf``
- The rest of the files are a normal layout based in: ``/library/games/minetest``
Possible Future Additions
-------------------------
File Locations on Other Platforms
---------------------------------
- The server binary is ``/usr/lib/minetest/minetestserver``
- The working directory is ``/usr/share/games/minetest``
- mods are in ``/usr/share/games/minetest/games/<game>/mods
To Do
-----
- Add more mods - currently only the default mods are there in carbone-ng
- Add more games
- Minetest client software for Windows and Android, included in IIAB for offline communities (`#1465 <https://github.com/iiab/iiab/issues/1465>`_)
- `Carbone NG <https://github.com/Calinou/carbone-ng>`_ engine
- flat world

View file

@ -1,12 +1,16 @@
# These are set in github.com/iiab/iiab/blob/master/vars/default_vars.yml
# They may be overridden in local_vars
# minetest_install: False
# minetest_enabled: False
# minetest_port: 30000
# minetest_server_admin: Admin
# 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!
# minetest_default_game: only carbone-ng and minetest are supported
# minetest_default_game: carbone-ng
# minetest_flat_world: False
minetest_runas_user: minetest
minetest_runas_group: minetest
# These should not be touched unless minetest packages change
minetest_config_file: /etc/minetest/minetest.conf
minetest_server_admin: Admin
minetest_world_dir: /library/games/minetest/worlds/world

View file

@ -3,11 +3,21 @@
- name: Set some facts for RPi
set_fact:
minetest_server_bin: /library/games/minetest/bin/minetestserver
minetest_world_dir: /library/games/minetest/worlds/world
minetest_game_dir: /library/games/minetest/games/minetest_game
minetest_working_dir: /library/games/minetest
# only works if server run as root
minetest_runas_user: root
minetest_runas_group: root
when: is_rpi
# For other installs TBD
# For other installs
- name: Set some facts for other platforms
set_fact:
minetest_server_bin: /usr/lib/minetest/minetestserver
minetest_working_dir: /usr/share/games/minetest
minetest_runas_user: Debian-minetest
minetest_runas_group: games
when: not is_rpi
- name: Set some facts for all
set_fact:
minetest_game_dir: "{{ minetest_working_dir }}/games/{{ minetest_default_game }}"

View file

@ -1,45 +1,50 @@
# Give message and end play for unsupported platforms
# For now only support rpi
- name: No install except Raspberry Pi for now
debug:
msg: "No install except Raspberry Pi for now."
when: not is_rpi
# CAUTION: this stanza causes iiab-install to exit on Ubuntu/Debian/etc -- without completing roles/network
- name: Terminate play if not Raspberry Pi
meta: end_play
when: not is_rpi
# Calculate local variables
- include_tasks: calc_vars.yml
- name: Ensure Linux group '{{ minetest_runas_group }}' exists
group:
name: "{{ minetest_runas_group }}"
state: present
when: minetest_runas_user != 'root'
- name: Ensure Linux user '{{ minetest_runas_user }}' exists
user:
name: "{{ minetest_runas_user }}"
groups: "{{ minetest_runas_group }}"
state: present
createhome: no
shell: /bin/false
when: minetest_runas_user != 'root'
- name: Check for minetest world file ({{ minetest_world_dir }}/world.mt)
stat:
path: "{{ minetest_world_dir }}/world.mt"
register: minetest_world
- name: Create /library/games
file:
state: directory
path: "{{ item }}"
owner: root
group: root
mode: 0755
with_items:
- /library/games
# rpi only
- include_tasks: rpi_minetest_install.yml
when: minetest_install and not minetest_world.stat.exists and is_rpi
when: not minetest_world.stat.exists and is_rpi
# not rpi
- include_tasks: minetest_install.yml
when: minetest_install and not minetest_world.stat.exists and not is_rpi
when: not minetest_world.stat.exists and not is_rpi
- git:
repo: https://github.com/Calinou/carbone-ng.git
dest: "{{ minetest_game_dir }}"
depth: 1
when: not minetest_world.stat.exists and minetest_default_game == "carbone-ng"
- name: Give minetest user ownership of carbone-ng
file:
state: directory
path: "{{ minetest_game_dir }}"
recurse: yes
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
mode: 0755
when: minetest_default_game == "carbone-ng"
# Install games
#- include: minetest_install_games.yml
# with_items:
# - name: carbone-ng
# url: https://github.com/Calinou/carbone-ng
# Install mods
- include: minetest_install_mods.yml
@ -58,24 +63,30 @@
url: https://github.com/minetest-mods/pipeworks/archive/master.zip
- name: Minetest-WorldEdit
url: https://github.com/Uberi/Minetest-WorldEdit/archive/master.zip
when: minetest_install
when: minetest_default_game == "minetest"
- name: Remove mod from carbone-ng that prevents our Admin name
file:
state: absent
path: "{{ minetest_game_dir }}/mods/name_restrictions"
when: minetest_default_game == "carbone-ng"
# enable or disable
- name: Enable & Restart 'minetest-serve' service
- name: Enable & Restart 'minetest-server' service
systemd:
daemon_reload: yes
name: minetest-serve
name: minetest-server
enabled: yes
state: restarted
when: minetest_install and minetest_enabled
when: minetest_enabled
- name: Disable 'minetest-serve' service
- name: Disable 'minetest-server' service
systemd:
daemon_reload: yes
name: minetest-serve
name: minetest-server
enabled: no
state: stopped
when: minetest_install and not minetest_enabled
when: not minetest_enabled
- name: Add 'minetest' variable values to {{ iiab_ini_file }}
ini_file:

View file

@ -1,82 +1,45 @@
# For non-rpi installs
# Still a work in progress
# COMPARE tasks/calc_vars.yml
- name: Set some facts
set_fact:
minetest_server_bin: /usr/lib/minetest/minetestserver
# minetest_world_dir: /var/games/minetest-server/.minetest/worlds/world/ should be in library
minetest_mods_dir: /usr/share/games/minetest_game/mods/
- name: Install Minetest package
package:
name: minetest-server
state: present
# Taken care of near top of tasks/main.yml
#
#- name: Ensure Linux group '{{ minetest_runas_group }}' exists
# group:
# name: "{{ minetest_runas_group }}"
# state: present
# when: minetest_runas_user != 'root'
#
#- name: Ensure Linux user '{{ minetest_runas_user }}' exists
# user:
# name: "{{ minetest_runas_user }}"
# groups: "{{ minetest_runas_group }}"
# state: present
# createhome: no
# shell: /bin/false
# when: minetest_runas_user != 'root'
- name: Add some parameters to /etc/minetest/minetest.conf that was automatically created
lineinfile:
path: /etc/minetest/minetest.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^server_name = ', line: 'server_name = Internet in a Box Minetest Server' }
- { regexp: '^name = ', line: 'name = Admin' }
- { regexp: '^creative_mode = ', line: 'creative_mode = true' }
- { regexp: '^port = ', line: 'port = {{ minetest_port }}' }
- { regexp: '^default_game = ', line: 'default_game = {{ minetest_default_game }}' }
# SEE "Check for minetest world file" in tasks/main.yml
#
#- name: Create dir minetest_world_dir ({{ minetest_world_dir }})
# file:
# state: directory
# path: "{{ minetest_world_dir }}"
# owner: "{{ minetest_runas_user }}"
# group: "{{ minetest_runas_group }}"
# mode: 0755
- name: Set mapgen engine to flat if enabled
lineinfile:
path: /etc/minetest/minetest.conf
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^mg_name = ', line: 'mg_name = flat' }
when: minetest_flat_world
#- name: Warn if not Raspberry Pi
# debug:
# msg: "No install except Raspberry Pi for now."
# when: not is_rpi
- name: Download Minetest if not package
get_url:
url: "{{ rpi_src_url }}"
dest: "{{ downloads_dir }}/{{ rpi_src }}"
timeout: "{{ download_timeout }}"
#when: is_rpi
- name: Install Minetest if not package
debug:
msg: "placeholder."
#when: is_rpi
- name: Create /etc/minetest
- name: Create /library/games/minetest/worlds/world
file:
state: directory
path: /etc/minetest
owner: root
group: root
path: "{{ item }}"
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
mode: 0755
# - name: move files to world dir
- name: 'Change minetest_server_bin: /usr/bin/minetest-server if not RPi'
set_fact:
minetest_server_bin: /usr/bin/minetest-server
#when: not is_rpi
- name: Create minetest-server service and minetest.conf file
template:
backup: no
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0644
with_items:
- { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' }
- { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service' }
- "{{ minetest_world_dir }}"
# - name: Start minetest
- name: Change exec line in generated unit file
lineinfile:
path: /lib/systemd/system/minetest-server.service
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^ExecStart=/usr/lib/minetest/minetestserver', line: 'ExecStart=/usr/lib/minetest/minetestserver --config /etc/minetest/minetest.conf --logfile /var/log/minetest/minetest.log --world "{{ minetest_world_dir }}"' }

View file

@ -14,8 +14,6 @@
unarchive:
src: "{{ downloads_dir }}/{{ item.name }}.zip"
dest: "{{ minetest_game_dir }}/mods"
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
when: not minetest_mod.stat.exists
- name: Check if mod name has 'master' in it

View file

@ -1,25 +1,17 @@
# For rpi installs
- name: Set some facts
set_fact:
rpi_src_url: http://www.nathansalapat.com/downloads/0.4.17.1.tar.gz
rpi_src: minetest-0.4.17.1.tar.gz
- name: Install 'libhiredis-dev' package for Minetest
package:
name: libhiredis-dev
state: present
#- name: Minetest already installed - terminate play
# meta: end_play
# when: minetest_world.stat.exists
- name: Download Minetest {{ rpi_src_url }} for RPi
- name: Download Minetest {{ minetest_rpi_src_url }} for RPi
get_url:
url: "{{ rpi_src_url }}"
dest: "{{ downloads_dir }}/{{ rpi_src }}"
url: "{{ minetest_rpi_src_url }}"
dest: "{{ downloads_dir }}/{{ minetest_rpi_src }}"
timeout: "{{ download_timeout }}"
# we need to create these for rpi, but package creates them for other OSes
- name: Create dirs /etc/minetest and /library/games
file:
state: directory
@ -29,32 +21,24 @@
mode: 0755
with_items:
- /etc/minetest
- /library/games
- name: Create dir /var/log/minetest
file:
state: directory
path: /var/log/minetest
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
mode: 0755
- /var/log/minetest
- name: Extract {{ downloads_dir }}/{{ rpi_src }} into /library/games
unarchive:
src: "{{ downloads_dir }}/{{ rpi_src }}"
src: "{{ downloads_dir }}/{{ minetest_rpi_src }}"
dest: /library/games
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
owner: root
group: root
- name: Create symbolic link /library/games/minetest
file:
state: link
src: /library/games/0.4.17.1
dest: /library/games/minetest
owner: "{{ minetest_runas_user }}"
group: "{{ minetest_runas_group }}"
owner: root
group: root
- name: Create /etc/minetest/minetest.conf and minetest-serve.service
- name: Create /etc/minetest/minetest.conf and minetest-server.service
template:
backup: no
src: "{{ item.src }}"
@ -64,4 +48,5 @@
mode: 0644
with_items:
- { src: 'minetest.conf.j2', dest: '/etc/minetest/minetest.conf' }
- { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-serve.service' }
- { src: 'minetest-serve.service.j2', dest: '/etc/systemd/system/minetest-server.service' }
when: minetest_install

View file

@ -4,11 +4,11 @@ After=network.target
[Service]
Type=simple
User={{ minetest_runas_user }}
Group={{ minetest_runas_group }}
WorkingDirectory=/library/games/minetest
ExecStart={{ minetest_server_bin }} --port {{ minetest_port }} --config {{ minetest_config_file }} --logfile /var/log/minetest/minetest.log --world {{ minetest_world_dir }}
Restart=on-abort
RestartSec=5s
TimeoutStartSec=900
[Install]
WantedBy=multi-user.target

View file

@ -9,7 +9,7 @@ server_name = Internet in a Box Minetest Server
server_announce = false
# Default game (default when creating a new world)
default_game = minetest
default_game = {{ minetest_default_game }}
# Maximum number of players connected simultaneously
max_users = 15
@ -30,3 +30,7 @@ default_privs = interact, shout, teleport, settime, privs
# For mods
spawn_friendly_mobs = true
spawn_hostile_mobs = false
{% if minetest_flat_world %}
mg_name = flat
{% endif %}

View file

@ -14,7 +14,7 @@ Prior to installing IIAB, make sure your `/etc/iiab/local_vars.yml <http://wiki.
nodered_install: True
nodered_enabled: True
After installing Node-RED as part IIAB, please log in to http://box:1880 with:
After installing Node-RED as part IIAB, please log in to http://box/nodered or http://box.lan:1880 with:
Username: ``Admin``

View file

@ -1,5 +1,11 @@
nodered_install: False
nodered_enabled: False
# nodered_install: False
# nodered_enabled: False
# nodered_port: 1880
# 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!
nodered_web_path: nodered # http://box/nodered redirect to http://box:1880
nodered_user: Admin
nodered_password: changeme

View file

@ -46,14 +46,60 @@
mode: 0666
when: nodered_install
- name: Enable & Start node-red service
- name: Install Apache's sites-available/nodered.conf from template
template:
backup: yes
src: nodered.conf.j2
dest: /etc/apache2/sites-available/nodered.conf
owner: root
group: root
mode: 0666
when: nodered_install
- name: Create symlink nodered.conf from sites-enabled to sites-available, for short URL http://box/nodered (if nodered_enabled)
file:
src: /etc/apache2/sites-available/nodered.conf
dest: /etc/apache2/sites-enabled/nodered.conf
owner: root
group: root
state: link
when: nodered_enabled
- name: Remove symlink /etc/apache2/sites-enabled/nodered.conf (if not nodered_enabled)
file:
path: /etc/apache2/sites-enabled/nodered.conf
state: absent
when: not nodered_enabled
- name: Enable proxy_wstunnel apache2 module
apache2_module:
state: present
name: proxy_wstunnel
when: nodered_install
- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/nodered (not just http://box:{{ nodered_port }})
systemd:
#daemon_reload: yes
name: "{{ apache_service }}" # httpd or apache2
state: restarted
when: nodered_install
- name: Enable & (Re)start 'node-red' systemd service (if nodered_enabled)
systemd:
daemon_reload: yes
name: node-red
enabled: yes
state: started
state: restarted
when: nodered_enabled
- name: Disable & Stop 'node-red' systemd service (if not nodered_enabled)
systemd:
daemon_reload: yes
name: node-red
enabled: no
state: stopped
when: not nodered_enabled
- name: Add 'nodered' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"

View file

@ -0,0 +1,6 @@
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /{{ nodered_web_path }}/debug/ws ws://localhost:{{ nodered_port }}/{{ nodered_web_path }}/debug/ws
ProxyPass /{{ nodered_web_path }}/comms ws://localhost:{{ nodered_port }}/{{ nodered_web_path }}/comms
ProxyPass /{{ nodered_web_path }} http://localhost:{{ nodered_port }}/{{ nodered_web_path }}
ProxyPassReverse /{{ nodered_web_path }} http://localhost:{{ nodered_port }}/{{ nodered_web_path }}

View file

@ -96,7 +96,7 @@ module.exports = {
// The following property can be used in place of 'httpAdminRoot' and 'httpNodeRoot',
// to apply the same root to both parts.
//httpRoot: '/red',
httpRoot: '/{{ nodered_web_path }}',
// When httpAdminRoot is used to move the UI to a different root path, the
// following property can be used to identify a directory of static content

View file

@ -2,7 +2,12 @@
PBX README
==========
This 'pbx' playbook adds `Asterisk <https://asterisk.org/>`_ and `FreePBX <https://freepbx.org/>`_ to Internet-in-a-Box (IIAB) for VoIP and SIP functionality.
This 'pbx' playbook adds `Asterisk <https://asterisk.org/>`_ and `FreePBX <https://freepbx.org/>`_ to Internet-in-a-Box (IIAB) for VoIP and SIP functionality e.g. for rural telephony.
This initial release (for IIAB 6.7 in February 2019) supports Ubuntu 18.04 and Debian 9 "Stretch" — in future Raspberry Pi (Raspbian) might also be possible! (`#1467 <https://github.com/iiab/iiab/issues/1467>`_)
Explanation
-----------
Asterisk is a software implementation of a private branch exchange (PBX). In conjunction with suitable telephony hardware interfaces and network applications, Asterisk is used to establish and control telephone calls between telecommunication endpoints, such as customary telephone sets, destinations on the public switched telephone network (PSTN), and devices or services on Voice over Internet Protocol (VoIP) networks. Its name comes from the asterisk (*) symbol for a signal used in dual-tone multi-frequency (DTMF) dialing.
@ -20,7 +25,7 @@ Optionally, you may want to enable `chan_dongle <https://github.com/wdoekes/aste
asterisk_chan_dongle: True
After installing PBX as part of IIAB, please visit http://pbx.lan/freepbx and proceed with initial configuration — which asks you to create a login/password.
After installing PBX as part of IIAB, please visit http://pbx.lan/freepbx and proceed with initial configuration (no login/password is required initially — you will be asked to set this up). **CAUTION: as of 2019-02-10 it is sometimes necessary to put "[ACTUAL IP ADDRESS] pbx.lan" into the 'hosts' file on the client machine (where the browser is being used) to get http://pbx.lan/freepbx name resolution to work.**
You can monitor the PBX service with command::
@ -29,4 +34,4 @@ You can monitor the PBX service with command::
Attribution
-----------
This 'pbx' playbook was heavily inspired by Yannik Sembritzki's `Asterisk <https://github.com/Yannik/ansible-role-asterisk>`_ and `FreePBX <https://github.com/Yannik/ansible-role-freepbx>`_ Ansible work.
This 'pbx' playbook was heavily inspired by Yannik Sembritzki's `Asterisk <https://github.com/Yannik/ansible-role-asterisk>`_ and `FreePBX <https://github.com/Yannik/ansible-role-freepbx>`_ Ansible work, Thank You!

View file

@ -229,14 +229,14 @@
# # Use this instead, if tabs are truly nec:
# # block: "\tvar pathPrefix = '/sugarizer';\n\tapp.use(pathPrefix, require('path-prefix-proxy')(pathPrefix));"
- name: Create symlink sugarizer.conf from sites-enabled to sites-available, for short URL http://box/sugarizer (debuntu)
- name: Create symlink sugarizer.conf from sites-enabled to sites-available, for short URLs http://box/sugar & http://box/sugarizer (if sugarizer_enabled)
file:
src: /etc/apache2/sites-available/sugarizer.conf
path: /etc/apache2/sites-enabled/sugarizer.conf
state: link
when: sugarizer_enabled and is_debuntu
- name: "Remove symlink /etc/apache2/sites-enabled/sugarizer.conf, if sugarizer_enabled: False (debuntu)"
- name: Remove symlink /etc/apache2/sites-enabled/sugarizer.conf (if not sugarizer_enabled)
file:
path: /etc/apache2/sites-enabled/sugarizer.conf
state: absent
@ -245,7 +245,8 @@
# 6. RESTART/STOP SYSTEMD SERVICE
- name: Enable & Restart systemd service if sugarizer_enabled, with "systemctl daemon-reload" (in case mongodb.service changed?)
# with "systemctl daemon-reload" in case mongodb.service changed, etc
- name: Enable & Restart 'sugarizer' systemd service (if sugarizer_enabled)
systemd:
name: sugarizer
daemon_reload: yes
@ -253,9 +254,10 @@
state: restarted
when: sugarizer_enabled
- name: "Disable systemd service, if sugarizer_enabled: False"
- name: Disable & Stop 'sugarizer' systemd service (if not sugarizer_enabled)
systemd:
name: sugarizer
daemon_reload: yes
enabled: no
state: stopped
when: not sugarizer_enabled

View file

@ -1,5 +1,7 @@
# sugarizer_port is set to 8089 in /opt/iiab/iiab/vars/default_vars.yml
# If you need to change this, edit /etc/iiab/local_vars.yml prior to installing
RedirectMatch ^/sugar$ /sugarizer
ProxyPass /sugarizer http://localhost:{{ sugarizer_port }}/sugarizer
ProxyPassReverse /sugarizer http://localhost:{{ sugarizer_port }}/sugarizer

View file

@ -447,13 +447,10 @@ minetest_install: False
minetest_enabled: False
minetest_port: 30000
minetest_server_admin: Admin
# Should only rarely change these
minetest_server_bin: /usr/games/minetest --server
minetest_world_dir: /library/games/minetest/worlds/world
minetest_working_dir: /usr/share/games/minetest
minetest_game_dir: /usr/share/games/minetest/games/minetest_game
minetest_config_file: /etc/minetest/minetest.conf
# minetest_default_game: only carbone-ng and minetest are supported
minetest_default_game: carbone-ng
minetest_flat_world: False
# CONSIDER THESE 2 NEW OPENSTREETMAP (OSM) APPROACHES INSTEAD, AS OF 2018:
# - http://download.iiab.io/content/OSM/vector-tiles/