[asterisk-dev] Asterisk Docker Containers: Phase 1

Leif Madsen leif.madsen at avoxi.com
Wed Nov 25 09:03:56 CST 2015


Absolutely! You would do that with an ENV (environment variable) setting in
the Dockerfile. Once that was setup, you can override that at build time
(basically you set a "default" value, and then you can override it from the
docker build command when you're building the container image).

So phase 1 is actually already dead. I've been busy working on a
provisioning platform the last two weeks (on top of being sick), but I'm
through enough of it that I should be able to get to my phase 2 blog post
this week (ideally this afternoon).

The preferred approach (as mentioned in my phase 1 blog post) is to
actually base on an RPM package. One of the issues was just trying to deal
with fedpkg (which is an awesome system btw) and getting custom changes,
and whatever version of Asterisk you wanted.

I've solved this with FPM and a companion container. More in the blog post,
but basically the essence is that you run a docker build command in your
local Asterisk source directory, it compiles it and packages it into an RPM
that is stored back on your local host. Then you run one more docker build
command to install that RPM into your Asterisk container image, and the
result is your own custom Asterisk container image with your local mods (or
custom menuselect flags, etc).

It's pretty slick actually, and solves a lot of the problems I was having
with my original approach. Thanks to Alan Graham who pointed out an
excellent Git repo that builds the RPMs using FPM with minimal effort.

Thanks!
Leif.


On Tue, Nov 24, 2015 at 5:26 PM, Corey Farrell <git at cfware.com> wrote:

> Leif,
>
> Thanks for explaining I should have read your blog post before replying to
> Jared's email about the RPM's.  I didn't realize EPEL was that strict with
> version freezes to stay with a no longer supported version.
>
> I do not know too much about Docker yet but I took a look anyways.  Can
> variables be used in Dockerfile.asterisk?  The idea is to be able to use a
> new version of Asterisk without having to update the version on 40 lines.
> Also when someone forks your GIT repo to add/remove packages from the
> install list, they won't face 'git rebase' conflicts after you update the
> version.
>
> Thanks,
> Corey
>
> On Thursday, November 19, 2015, Leif Madsen <leif.madsen at avoxi.com> wrote:
>
>> Hey Corey!
>>
>> The way it works is that major versions of Asterisk (and same with other
>> packages) are associated with specific releases of Fedora and RHEL, which
>> means the major versions are "stuck" to those releases.
>>
>> However, you can still build the newer version of Asterisk by pulling the
>> spec file and sources from later Fedora versions (Fedora 23 for instance).
>>
>> You can rebuild the RPMs supplied using fedpkg, as I've done in phase 1
>> of my blog post. There are other ways you can do it was well, like with
>> mock etc.
>>
>> (You'll need some dependencies in order to build everything).
>>
>> If you look at my buildit.sh script, it provides the primitives for
>> building the dependencies. I'm doing this via a local build with rpmbuild
>> (because the script is run in the Docker container), but you could also
>> replace this with a fedpkg mock build which would build the RPMs in the
>> chroot for you. There might be some things that are slightly more
>> complicated in that method, because you'd have to get the resulting
>> dependency RPMs into the chroot (possible, it's just not super straight
>> forward if you haven't done it before).
>>
>> I'd probably still suggest doing it in the Docker container, simply
>> because it's super simple to get things spun up. You can even use the
>> local.repo file I'm providing as well. Basically everything you need to
>> build Asterisk for your platform (Red Hat based) is in the repo linked
>> above.
>>
>> Note: this won't work on CentOS 6. There are some oddities with CentOS 6
>> in Docker that resulted in me not being able to build Asterisk in the
>> CentOS 6 container (gcc complained about not being able to result in a
>> binary or something).
>>
>> Long story short, use fedpkg to build the RPMs from the Fedora
>> repositories. Just clone the Fedora 23 version (which gets you Asterisk
>> 13.3.2 as of now), and then build it on top of the system you want (CentOS
>> 6 or 7 for example).
>>
>> Thanks!
>> Leif.
>>
>> On Thu, Nov 19, 2015 at 2:23 PM, Corey Farrell <git at cfware.com> wrote:
>> >
>> > Jared,
>> >
>> > I just looked through the EPEL website at EPEL6 and EPEL7, only found
>> > Asterisk 1.8.  Can you point me to the spec file you are using or  an
>> > SRPM?
>> >
>> > Thanks,
>> > Corey
>> >
>> > On Thu, Nov 19, 2015 at 2:02 PM, Jared Smith <jaredsmith at jaredsmith.net>
>> wrote:
>> > >
>> > > On Thu, Nov 19, 2015 at 10:14 AM, Matthew Jordan <mjordan at digium.com>
>> wrote:
>> > >>
>> > >> Would it be appropriate to summarize the current state of things as
>> "we
>> > >> need a spec file for Asterisk"?
>> > >
>> > >
>> > >
>> > > At one point, there was an awful .spec file in the Asterisk sources...
>> > > hopefully it's not around any more.
>> > >
>> > > That being said, I just took over as the main maintainer/contact for
>> the
>> > > Asterisk packages in Fedora/EPEL -- It's one of the most complicated
>> spec
>> > > files in Fedora, but that obviously hasn't scared me off.
>> > >
>> > > I'd love feedback on things we can do to make those packages better,
>> and get
>> > > a tighter feedback loop between the Asterisk development community
>> and the
>> > > packagers in Fedora/RHEL/CentOS/etc.
>> >
>>
>> --
>> Leif Madsen
>> Director of Engineering, Product Development
>> http://avoxi.com
>>
>>
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>



-- 
*Leif Madsen*
Director of Engineering, Product Development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20151125/1fa923f7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 10257 bytes
Desc: not available
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20151125/1fa923f7/attachment-0001.png>


More information about the asterisk-dev mailing list