Installation instructions for a working development environment on linux

Hi everyone,

I’m posting this here because I was asked today to make a simple how-to about running a development environment on linux. This is surprisingly hard, considering the fact that mulet binaries are quite hidden, and the whole procedure is not really documented.

I’m sure there are mistakes in this, so feel free to correct me. I did not feel confident enough to post this straight on the related wiki page on MDN. @kskarthik, I think you’ll be interested by this.

I’ve also published a basic docker image (see the relevant git repository). This image allows you to run mulet in a docker container, this should speed up the bootrstrapping of development environment, since you only need a working profile.

So, here are the steps I followed to get things done.

EDIT: as I’m new, I cannot post more than 5 links in a post. I’ve moved the whole post on Github, feel free to repost it here if you can: https://github.com/EliotBerriot/mulet/wiki/How-to-setup-a-working-Mulet-Gaia-environment-on-Linux

2 Likes

Done :slight_smile:


How to setup a working Mulet Gaia environment on Linux

This post is focused on linux systems, but you should be able
to make instructions work on Mac OS too with little or no modification
at all.

Note: a prepackaged version submitted by kskarthik is available, you can use it to get a fully working environment in seconds.

Create your project structure

For the sake of simplicity, we’ll adopt the following layout for our project:

B2GOS
├── gaia (optional)
├── mulet
└── profile

Create your gaia profile

This profile will be used to make the whole OS run. To generate one, you’ll need a copy of the gaia repository.

You can either:

  1. Clone the git repository (it’s really huge, so it will take some time):
    git clone https://github.com/mozilla-b2g/gaia.git
  2. Download an archive of the repository (it will be faster, since you
    won’t have the git history, but it will require a huge download too):
    wget https://github.com/mozilla-b2g/gaia/archive/master.zip unzip master.zip mv gaia-master gaia
  3. Download an existing profile, like this one. This is the fastest solution, since you’ll only need to download around 50-100Mo.

If you choose method 3, you can skip straight to the next part, because your profile is already generated.

Otherwise, you’ll have to build it:

cd gaia make

This will lead to the creation of a profile directory (under the gaia directory).

Move this directory upward, or create a symlink with, so it’s straight under the B2GOS directory.

Getting Mulet up and running

Mulet is a customized version of firefox designed to help testing B2G OS in desktop environment.

Once working, Mulet will open your B2G OS directly in a firefox tab,
so you can interact with the phone, use the developer tools, etc.

I’ll describe several ways to get Mulet up and running, however,
regardless of the method, we’ll always have to tell Mulet to use our
previously
generated gaia profile.

###Using docker

One of the benefits of this approach is that you won’t have to install anything on your system (apart from docker, of course).

Please head over the corresponding repository for detailed instructions.

Using a regular binary

For some reason, it’s really hard to find the correct mulet binary to use.

One that work for me was this one:

wget -O mulet.tar.bz2 https://queue.taskcluster.net/v1/task/Tg4Sld58RwmUbJnVPwBXvg/runs/0/artifacts/public%2Fbuild%2Ftarget.tar.bz2
tar -xjf mulet.tar.bz2
mv firefox mulet

Okay, you’ve got mulet installed, now, to run it, you just need this:

cd mulet
./firefox-bin --no-remote --profile …/profile --devtools

This should open a separate firefox window with developer tools enabled and a B2G OS phone :slight_smile:

2 Likes

Allow me to ask one dumb question: why docker for running mulet? It’s just as simple as a:

  • download mulet & gaia from taskcluster
  • tar xf <mulet.tar.bz2>
  • tar xf <gaia.zip>
  • ./firefox/firefox -no-remote -profile gaia/profile/ …

I don’t see the added value of Docker regarding your documentation especially when you are recommending downloading a prebuilt profile.

Besides, there is no need to move the generated profile: when passing the argument to firefox binary, you can pass a full absolute or relative path. Also, the |make| target of Gaia should mostly only depend on npm.

Providing a Docker would make sense for the device build itself, since it is a tedious error prone misdocumented part and that this also depend on the distro. But for just running Mulet, I really don’t understand the added value.

Allow me to ask one dumb question: why docker for running mulet? It’s just as simple as a:

  • download mulet & gaia from taskcluster
  • tar xf
  • tar xf
  • ./firefox/firefox -no-remote -profile gaia/profile/

This is not a dumb question! I think there where various reasons for that:

  1. It’s a way to document the process by code. Even if you don’t use the docker container, you have the Dockerfile as a reference of what to install / run and how
  2. I wanted to try running a GUI app in docker (as a personnal excercise)
  3. Downloading Mulet is not as simple as that since, to my knowledge, there is no easy way to get a link to a working version of mulet. Seriously, when you’ve got something like this, it’s really hard to find what to download. Also, even when I found the link on this interface, it wasn’t working in the end and I had to get back to this discourse post to finally find a working link. At least know, there is a working Docker image, that will work forever, even if the build artifacts are removed for the build server.
  4. I’m lazy, and if I can do something in one command instead of three, that’s better. It’s easier to remember docker-compose up or dockery-compose run mulet than firefox-bin --no-remote --profile path/to/profile --devtools.
  5. I’m more comfortable with having stuff locked in containers. It’s easier to deal with, to delete and to share.
  6. I don’t want to pollute my system with unwanted dependencies (and firefox has a lot)

I understand not everyone wants to use docker, this is why I provided different methods, but I really feel there is an added value.

I did this for consistency purpose. Since in one case you build from gaia, and in the other case you download an existing profile (so you d’ont have a gaia directory), I wanted the profile path to be consistent accross my post.

How do you plan to keep your docker image up to date?
My point is that if you have to manually update your Dockerfile everyday it’s not of much use.

What would be nice is a script that let you download the latest target.tar.bz2 from taskcluster (I’m sure they have api that let you filter by build type for that), create an up to date gaia profile and re-packages everything.

Then, if you want to use that in docker you can wrap that up in a dockerfile. Or people can just use it “natively”.

What do you think?

2 Likes

Are every latest target.tar.bz2 working well ?
Bad builds aren’t publish ? else, manually isn’t a wrong way , if someone who try for the first time to use it and it doesn’t work, it could demotivate him …

1 Like

Using Docker for learning it is okay, but I think you can make more impact with a docker image to build locally a device, and not just run mulet.

There is a way to get a stable link to the latest release via taskcluster. The treeherder links are for monitoring jobs, and downloading a precise build when needed.

This was on MDN, I don’t know what happened to it:

Also, I do remember that the “mozilla-download” tool was able to do this too.

Besides, I am lazy too and for long command you can just use alias from your shell :slight_smile:

About the dependencies, I suspect you are referring to building firefox, not just running it. Runtime dependencies for Mulet are the same as for Firefox, so I am not sure what is your poing there.

FIrst of all this docker image is not intended to be the de facto solution to run Mulet. It’s just a simple utility to bootstrap the whole thing.

I guess if we want to make this up-to-date, the long-term, clean solution would be to build an actual docker image on each successfull Mulet build, tag it with the build id/version number and push it on docker hub.

Then, you can docker pull mozilla/mulet:0.55.6or whatever, meaning you can upgrade / downgrade / test any mulet version without the need to download / extract mulet manually. This would mean you can also easily test multiple mulet version at the same time without going crazy (but I don’t know if it’s actually a real need).

Also, I may be wrong (I discovered the very existence of Mulet yesterday), but my guess is Mulet is not intended to be updated often. From what I understand, it’s just a wrapper to display B2G OS, so it’s not a big deal to have a slightly outdated version, right ?

The mozilla-download package: https://www.npmjs.com/package/mozilla-download
And how to use it: https://github.com/mozilla-b2g/gaia/blob/master/Makefile#L836

1 Like

I’m not really fond of alias, since they are not portable. And usually, when you remove the software, you forget to remove the alias. I like having thing isolated and reproducible. Also, if the options to run Mulet change, you need to update aliases on every single developer machine. If it’s in a Dockerfile, you updated only once, and the end user does not even see the change.

If I’m right, you need several dependencies to run it, such as GTK-3 and libasound2. It’s not a problem if you have firefox installed, but it can soon become a nightmare, for example if you have a different version of firefox on your host machine, which needs only GTK-2. Or if you don’t have firefox at all on your host machine. After all, fellow Chrome/Safari users may want to make a Firefox OS app without having to install firefox :slight_smile: (shame on them)

I was not thinking about having impact, I just wanted a quick way to setup a development environment. I don’t think the docker approach here is incompatible with further research to build docker containers for each device.

But again, I was not trying to push big changes to the toolchain. Seriously, there were some people (including me) struggling on telegram to get the mostbasic thing working, because the documentation is spread accross multiple sites / wikis / discourse posts, that are often outdated.

I understand that for people that are familiar with the project, a docker image can seem overkill, but for newcomers, having to read dozens of web pages just to get started is not a good thing.

Well, I am just sharing my concerns. There are plenty of good use cases with B2G for Docker, but I am still not convinced that this one is really a good one. The only valuable argument so far that resonnates is that you want to learn Docker and share this.

And you pointed it yourself, one of the big issue is the lack of uptodate and concentrated documentation. I do fear that this is not helping by just adding one more tool :). I share your concern about the familiarity, but on the other hand, at some point, building this (gonk) requires a tons of things and this creates complexity of its own, without much that we can do about it.

I do insist, though, that running Mulet is no more complicated than running Firefox: you download it, you point it to a specific gaia profile.

And the dependencies required to run Firefox at not that much, as soon as you have a graphical desktop system: what is required that is not already needed by other basic tools? Even Chromium has dependencies against gtk2 (and gtk2 with gtk3 can live together) and libasound :slight_smile:

1 Like

Just to be clear, don’t get me wrong: your contribution of making Mulet more easily accessible is a good idea, and it is welcome :slight_smile:

2 Likes

Don’t worry, I was not angry or anything (it’s sometimes hard to say when communicating via written channel).

Regarding the documentation issue, I think it’s time to get rid of the old wiki page as it was last updated on january, and some informations are obsolete. Maybe we can just provide a link to the newly created MDN wiki page ?

1 Like

Hi all, I’m sorry for the delay. I have to confess I’m a newbie with docker, mulet, profiles and, in general, with building process.

We have a lot of guides, some of which are at this point outdated and I need to make things a little less confusing.

I’m sorry, if I’m going to be redundant with what all have you have written before (and, of course, let me thank you all for your huge help (first of all @contact).


Regardless for related benefits, we now have a lot of ways to install Mulet and try B2G OS. What we need, essentially, is:

  • a Gaia profile (from what I can understand a profile is just a local copy built with some optional preferences);

[details=How to get a Gaia Profile]So far, to get a Gaia profile we can:

  1. Obtain Gaia from git [Clone git repo and create manually a profile] (https://developer.mozilla.org/en-US/docs/Mozilla/B2G_OS/Mulet#How_to_run):

git clone https://github.com/mozilla-b2g/gaia.git

  1. Download an archive of the repository (it will be faster, since you
    won’t have the git history, but it will require a huge download too):

    wget https://github.com/mozilla-b2g/gaia/archive/master.zip
    unzip master.zip
    mv gaia-master gaia

  2. Download an existing profile, like this one. This is the fastest solution, since you’ll only need to download around 50-100Mo. (Who made it?:sweat_smile:)[/details]

  • a copy of Mulet

[details=How to grab a copy of Mulet]B) On the other hand, to grab a Mulet copy we can:

  1. Download working binaries for Linux from Taskcluster, as explained in the wiki. Note: we also have Mac OS and Windows binaries here.
    For more info, see the old wiky page or the new one, written yestarday by Alaistair Pharo.

  2. Use docker (take a look at the repository provided in this post by @contact);

  3. Use a script to build Mulet on you computer. One of the option was to build it locally following the script here : Task inspector taskcluster mulet4. Thanks to @m.ducorps.

  4. Probably we can also compile Mulet on our own, without any script … ! [/details]


In the end, @kskarthik with his [package] (https://discourse.mozilla-community.org/t/mulet-gaia-for-linux/10375), offer us a single-step solution. You just need to grab the archive and follow the guide to obtain mulet and a gaia profile. Everything is in it.


Now we have to run Mulet and, obviously, this step depends on the way you’ve followed.

Sorry if I had to rewrite many things (and I also know there are a lot of missing detalis), but it is just to make a summary to move to the wiki.

Is there anything missing? Are all these processess working or are there some deprecated?

p.s. Feel free to stone me :grin:

1 Like

We should be building gaia profile as part of the devices builds on
taskcluster so there should really be no need for someone who wants to run
to have to build it by hand.

I agree we should straighten all docs and consolidate. Any help is welcome
to identify the current status and help clarify things up.

And we should refrain ourselves to build new things except if we can
provide a good argumentation of why it is absolutely needed. The more
tools, the messier. This is a project that has received a lot of attention
so in general we should, I guess, assume that a problen we identify is
not new and just try to fix what exists to solve it :slight_smile:

<
https://ci5.googleusercontent.com/proxy/nraIEkUcKsDKNLKrMG7lZGMlv_T5ckikcXzbBfox6Fw4hNXUfhpSquF8DqUyGB3SHkpwKgYlMIXFKI-EtE4dLMl6A3LSDMRjAQtp3uCuJ0jbcVBXhIZMel8Nbd4MHmaJgfonFa9apCw-MSzxHPCHi6s1G_-BaKkuS1OhgA=s0-d-e1-ft#https://discourse.mozilla-community.org/user_avatar/discourse.mozilla-community.org/luca/45/4500_1.png>
Luca
August 20

Hi all, I’m sorry for the deleay. I have to confess I’m a newbie with
docker, mulet, profiles and, in general, with building process.

We have a lot of guides, some of which are at this point outdated and I
need to make things a little less confusing.

I’m sorry, if I’m going to be redundant with what all have you have
written before (and, of course, let me thank you all for your huge help
(first of all @contact).


Regardless for related benefits, we now have a lot of ways to install
Mulet and try B2G OS**. What we need, essentially, is**:

a Gaia profile (from what I can understand a profile is just a local copy
built with some optional preferences);

How to get a Gaia Profile

a copy of Mulet

How to grab a copy of Mulet


In the end, @kskarthik with his package, offer us a single-step solution.
You just need to grab the archive and follow the guide to obtain mulet and
a gaia profile. Everything is in it.


Now we have to run Mulet and, obviously, this step depends on the way
you’ve followed.

Sorry if I had to rewrite many things (and I also know there are a lot of
missing detalis), but it is just to make a summary to move to the wiki.

Is there anything missing? Are all these processess working or are there
some deprecated?

To summup i guess we need to identify :

  • people who wants to just use a device
  • people who wants to hack on a device
  • people who wants to hack but don’t have a device

The first case should be addressed with B2G install addon.

The second case, people will have to setup a full android build
environment. We have docs but they are outdated for sure since we moved
gecko build system pieces to share with Firefox for Android pieces. I guess
this was documented on discourse with the thread from Thomas.

The third case is for people to hack on gaia with Mulet and that is
documented I guess. We should make sure the docs are accurate though.

I know it’s not fun to do but anyone willing to accurately follow the docs,
that is searching on its own, applying the documented steps, identifying
everything wrong, out of date, misleading or unclear, will do a great job
in this area.

Maybe we should track this on a dedicated topic on discourse. And maybe it
should not be a one person job otherwise I fear it might be too tedious /
time-consuming and free time used to contribute is highly valuable so it
should not be wasted.

And dont fear of asking questions if you cannot find. But please search
before :slight_smile:

Thanks all for your help!

We should be building gaia profile as part of the devices builds on
taskcluster so there should really be no need for someone who wants to run
to have to build it by hand.

I agree we should straighten all docs and consolidate. Any help is
welcome to identify the current status and help clarify things up.

And we should refrain ourselves to build new things except if we can
provide a good argumentation of why it is absolutely needed. The more
tools, the messier. This is a project that has received a lot of attention
so in general we should, I guess, assume that a problen we identify is
not new and just try to fix what exists to solve it :slight_smile:

<
https://ci5.googleusercontent.com/proxy/nraIEkUcKsDKNLKrMG7lZGMlv_T5ckikcXzbBfox6Fw4hNXUfhpSquF8DqUyGB3SHkpwKgYlMIXFKI-EtE4dLMl6A3LSDMRjAQtp3uCuJ0jbcVBXhIZMel8Nbd4MHmaJgfonFa9apCw-MSzxHPCHi6s1G_-BaKkuS1OhgA=s0-d-e1-ft#https://discourse.mozilla-community.org/user_avatar/discourse.mozilla-community.org/luca/45/4500_1.png>
Luca

August 20

Hi all, I’m sorry for the deleay. I have to confess I’m a newbie with
docker, mulet, profiles and, in general, with building process.

We have a lot of guides, some of which are at this point outdated and I
need to make things a little less confusing.

I’m sorry, if I’m going to be redundant with what all have you have
written before (and, of course, let me thank you all for your huge help
(first of all @contact).


Regardless for related benefits, we now have a lot of ways to install
Mulet and try B2G OS**. What we need, essentially, is**:

a Gaia profile (from what I can understand a profile is just a local
copy built with some optional preferences);

How to get a Gaia Profile

a copy of Mulet

How to grab a copy of Mulet


In the end, @kskarthik with his package, offer us a single-step
solution. You just need to grab the archive and follow the guide to obtain
mulet and a gaia profile. Everything is in it.


Now we have to run Mulet and, obviously, this step depends on the way
you’ve followed.

Sorry if I had to rewrite many things (and I also know there are a lot
of missing detalis), but it is just to make a summary to move to the wiki.

Is there anything missing? Are all these processess working or are there
some deprecated?

2 Likes

I was just thinking that on MDN, the first option used to run Gaia is WebIDE:

The quickest way to try Gaia is via WebIDE,
a developer tool available in Firefox for Desktop. It provides a number
of useful tools to help you test, deploy and debug HTML5 web apps on
Firefox OS phones and the Firefox OS Simulator, directly from your
browser.

I’ve never used it before. It’s simply a Firefox Plugin, using which you can simulate Firefox OS. There are a lot of options in terms of screen dimensions and FirefoxOS versions.

As expected Firefox 2.2 is the classical one, but there is also a 2.6 version and I think this is actually B2GOS (looking at the working apps and so on). I don’t really know if it’s the latest version of B2G OS but it seemed so to me.

Is WebIDE still valid? Or, if not, is there something I’m not considering?

I know it’s not fun to do but anyone willing to accurately follow the docs,
that is searching on its own, applying the documented steps, identifying
everything wrong, out of date, misleading or unclear, will do a great job
in this area.

Yeah, maintaining docs is a hard task for one person. I still find oudated fxos docs till date on mdn. Me & chris are trying our best to fix them. We are receiving feedback from community too :slight_smile:

2 Likes

And everyone finding a mistake / something missing / unclear in the docs is welcome to take a little time to fix it - piece after piece, the doc is improving thanks to all those little efforts ! :slight_smile:

1 Like

If you need help, I’m here!