Skip to content
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

Asterisk (with chan_dongle) and FreePBX #1405

Merged
merged 81 commits into from Feb 9, 2019
Merged

Asterisk (with chan_dongle) and FreePBX #1405

merged 81 commits into from Feb 9, 2019

Conversation

m-anish
Copy link
Contributor

@m-anish m-anish commented Jan 17, 2019

This PR introduces the Asterisk and FreePBX applications for IIAB installs on top of Ubuntu 18.x based setups.

Note: This is for testing only at this point. Do not merge!

You will have to atleast set pbx_install to True to have both apps install. And optionally set the enabled flag to enable them as well.

Eagerly looking forwards to test results and polishing this further. We could potentially experiment with running this on debian 9.6 as well.

@holta holta added this to the 7.0 milestone Jan 17, 2019
Copy link
Member

@holta holta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ansible's general recommendation is 2-space indentation.

roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
roles/pbx/tasks/asterisk.yml Outdated Show resolved Hide resolved
@m-anish
Copy link
Contributor Author

m-anish commented Jan 18, 2019

Okay, some thoughts here...

  1. FreePBX wants node 10.x, so I am going to test it with that. This introduces a problem for us, as it makes it incompatible with sugarizer.
  2. The playbook has two parts. One to install Asterisk, and the other to install FreePBX.
  3. The Asterisk part is robust, and seems to install cleanly without creating issues. It will probably work on Debian Stretch, and perhaps even Buster, but I dont want to test that yet.
  4. The FreePBX part is more tricky. Typically, FreePBX wants to be the only thing it runs on the server. This either means we should do this out of a docker container, which I dont prefer for obvious performance reasons, or it means to tweak its standard config. Read on...
  5. Pending: Create a custom freepbx.conf apache conf file, that serves freepbx through a virtualhost, in which the user is asterisk instead of www-data.

@m-anish
Copy link
Contributor Author

m-anish commented Jan 18, 2019

Okay, freepbx 15 seems to install properly with nodejs 10.x. This has a few implications.

  1. Let us drop this for 6.7 - (if even we were remotely considering it) and target for 7.0
  2. I am going to put a dependency on this. DO NOT install if sugarizer is going to be installed.
  3. Going to test this alongside nodered and mqtt for node 10.x as that should work in theory
  4. So, this needs lots of testing because of the nodejs changes
  5. I will make a separate PR that moves us to a nodesource based install generally. That seems to be the preferred way to install nodejs, whether 8.x or 10.x.

@m-anish
Copy link
Contributor Author

m-anish commented Jan 18, 2019

Checklist:

  • Do NOT install if sugarizer is enabled
  • Do NOT install if nodejs version is not set to 10.x
  • Install Apache module to run as multiple users, since freepbx needs apache to run as user asterisk
  • Install Apache freepbx config file
  • Fix indentation issues
  • Create a bind9/dnsmasq host pbx.lan to serve freepbx. @jvonau @holta pls clarify how to go about this.
  • Only install freepbx once! Create and honour a flag for the same.
  • Passes the testing checklist here
  • Speed up the playbook by running ansible install steps once (use 'creates' flags)
  • Add a README
  • Optionally, install chan_dongle with asterisk.
  • Merge Simplify node-js installation from nodesource and a variable for version #1411 (or similar) prior to this.
  • Disable installation and enabling by default on all: min, med, big installs

@m-anish
Copy link
Contributor Author

m-anish commented Jan 18, 2019

Note: Test only after pulling in #1411 and setting nodejs_version to 10.x

@m-anish
Copy link
Contributor Author

m-anish commented Jan 18, 2019

Brought up to date with master with a forced push.

@m-anish
Copy link
Contributor Author

m-anish commented Jan 18, 2019

Okay. This is now good to test after locally merging #1411

@m-anish
Copy link
Contributor Author

m-anish commented Jan 18, 2019

Comprehensive test checklist:

  • Ensure that install does NOT run on any platform except ubuntu 18.x and 9.7
  • Smoke test in gateway mode configuration, with pbx.lan properly set
  • Smoke test FreePBX on ubuntu 18.04 after successful install
  • Playbook should only install freepbx once and not fail if re-run
  • Install=False when Sugarizer=True or Nodejs=8.x
  • Install=True only when PBX=True and Nodejs=10.x
  • Test in a minimal install with local_vars_min + PBX
  • Test in a full install with local_vars_big + PBX - Sugarizer

@holta
Copy link
Member

holta commented Jan 18, 2019

If this is well-tested & not disruptive to Sugarizer over the coming ~48h, we can consider this for inclusion in IIAB 6.7

@m-anish
Copy link
Contributor Author

m-anish commented Jan 18, 2019

You can see from the checklist that I made good progress on the testing front, but since the scripts in asterisk and especially freepbx do many things, i would like atleast someone else other than me to also install and test, preferably from scratch, on bare metal. I would be much more confident then. Unfortunately, I dont have access to a NUC over the coming few days.

jvonau added a commit to jvonau/iiab that referenced this pull request Jan 18, 2019
@m-anish m-anish changed the title TESTING | Asterisk and FreePBX Asterisk (with chan_dongle) and FreePBX Jan 19, 2019
@m-anish
Copy link
Contributor Author

m-anish commented Jan 19, 2019

Okay, this is now serious enough that I removed the TESTING tag, which reflects the progress that's been made on this.

@m-anish
Copy link
Contributor Author

m-anish commented Jan 20, 2019

Brought up to date with current master.

@holta
Copy link
Member

holta commented Jan 24, 2019

@m-anish asks for testing on actual hardware (not just VM's).

CLARIF: Ubuntu Server 18.04 is required for now.

@jvonau suggesting 2 ways to deal to make pbx.lan work with dnsmasq:

  1. /etc/hosts (use Ansible's lineinfile command? IIAB's network role likely not nec here?)
  2. separate file sourced from dnsmasq.d

@m-anish
Copy link
Contributor Author

m-anish commented Jan 25, 2019

Sure, I will add to my todo to edit this PR to edit /etc/hosts

@holta
Copy link
Member

holta commented Feb 3, 2019

fyi Node.js 10.x is now part of IIAB (master branch iiab/iiab) if that helps Asterisk/FreePBX move forward:
https://github.com/iiab/iiab/blob/master/vars/default_vars.yml#L287-L289

@m-anish
Copy link
Contributor Author

m-anish commented Feb 4, 2019

Very nice. I think I need to appropriately make changes to this playbook then.

@@ -7,8 +7,8 @@

- name: Install asterisk
include_tasks: asterisk.yml
when: internet_available and is_ubuntu_18 and pbx_install and (not pbx_installed) and (not sugarizer_install) and (nodejs_version == "10.x")
when: internet_available and ((is_debian and ansible_distribution_major_version == "9") or is_ubuntu_18) and pbx_install and (not pbx_installed) and (nodejs_version == "10.x")
Copy link
Member

@holta holta Feb 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m-anish can you make this and Line 14 condition a bit more flexible, so Debian 10 and other Ubuntus (like 19.04 coming in April) and Raspbian-on-RPi might actually work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will once I have tested those platforms. But want to stick to this for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure you understood my point:

  • Can you please consider is_ubuntu rather than is_ubuntu_18 ? So we avoid sabotaging diverse Ubuntu volunteers who want to expand on your work over the coming year!

  • Likewise can you please consider is_debian and (not is_rpi) instead of is_debian and ansible_distribution_major_version == "9" — so that the growing number of Debian 10 people can consider your work? (Without "artificial obstacles" being thrown in their path!)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • consider is_debian and (not is_rpi)

Another option might be is_debian (just like is_ubuntu ideally) simplifying in the future anyway!?

@holta
Copy link
Member

holta commented Feb 9, 2019

@m-anish I'm going to go ahead and merge but I need your help testing/refining:

  • ./runrole pbx completes on an Ubuntu Server 18.04.1 VM (single network interface) but how do we test?
  • Specifically how do I access http://pbx.lan/freepbx which does not work so far?
    • Running ./iiab-network did not help (pbx.lan still doesn't resolve)
    • Side Question: is "pbx pbx.lan" not required on Line 21 of roles/network/tasks/hosts.yml ? (Certainly it's on Line 13.)

@holta holta merged commit 07081cd into iiab:master Feb 9, 2019
@m-anish
Copy link
Contributor Author

m-anish commented Feb 10, 2019

  • ./runrole pbx completes on an Ubuntu Server 18.04.1 VM (single network interface) but how do we test?

On your host machine, you will need to add an entry to /etc/hosts like this one
<VM's IP address> pbx.lan

And then open http://pbx.lan/freepbx to test.

@m-anish
Copy link
Contributor Author

m-anish commented Feb 10, 2019

Specifically how do I access http://pbx.lan/freepbx which does not work so far?

* Running ./iiab-network did not help (pbx.lan still doesn't resolve)

* Side Question: is "pbx pbx.lan" not required on Line 21 of [roles/network/tasks/hosts.yml](https://github.com/iiab/iiab/blob/master/roles/network/tasks/hosts.yml) ?  (Certainly it's on Line 13.)

Is this in gateway or appliance?

@holta
Copy link
Member

holta commented Feb 10, 2019

Is this in gateway or appliance?

Whatever's normal for a VM with a single network interface!

Log into it (192.168.0.161) if that's not clear enough?

@m-anish
Copy link
Contributor Author

m-anish commented Feb 10, 2019

Is this in gateway or appliance?

Whatever's normal for a VM with a single network interface!

Log into it (192.168.0.161) if that's not clear enough?

VM would be appliance. Please follow the instructions here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants