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

for part of ui, can you write a dockerfile for the environment setting etc ? #50

Closed
koeichen opened this issue Jul 17, 2020 · 15 comments
Closed

Comments

@koeichen
Copy link

For part of ui, Hope perfetto team can support a dockerfile from the environment setting.
I trying to build perfetto ui on my server, but I met lots of problem from environment setting, like downloading npm package.
I hope perfetto team can provide a dockerfile for ui parts.

@primiano
Copy link
Collaborator

Can you explain what the problem is?
AFAIK you just need to run: tools/install-build-deps --ui
This will install a hermetic copy of node and npm (so, no, you don't need to download your own npm)
The build system does the rest.

It's not clear to me what's the problem a docker container would solve

@koeichen
Copy link
Author

koeichen commented Jul 20, 2020

On Ubuntu server, our team met multiple problems. For me, it is:

        npm ERR! file sh
        npm ERR! code ELIFECYCLE
        npm ERR! errno ENOENT
        npm ERR! syscall spawn
        npm ERR! bufferutil@4.0.1 install: `node-gyp-build`
        npm ERR! spawn ENOENT
        npm ERR!
        npm ERR! Failed at the bufferutil@4.0.1 install script.
        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
        npm ERR! A complete log of this run can be found in:
        npm ERR!     /root/.npm/_logs/2020-07-20T03_52_10_813Z-debug.log
        Traceback (most recent call last):
          File "tools/install-build-deps", line 435, in <module>
            sys.exit(Main())
          File "tools/install-build-deps", line 414, in Main
            InstallNodeModules()
          File "tools/install-build-deps", line 294, in InstallNodeModules
            cwd=UI_DIR)
          File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
            raise CalledProcessError(retcode, cmd)
        subprocess.CalledProcessError: Command '['/root/perfetto/ui/npm', 'install', '--no-save']' returned non-zero exit status 1

@LalitMaganti
Copy link
Collaborator

This seems like an interesting issue. We've run into this ourselves now and then but we've never managed to identify a fix for it.

Using docker may be the most pragmatic way but unfortunately we don't have the bandwidth to investigate that at the moment. This may be something we revisit down the line.

@koeichen
Copy link
Author

If we can't solve this problem through dockerfile now, and westill want to deploy similar ui.perfetto.dev service, can you tell us, what environment you deploy ui.perfetto.dev service? Hope answer can include Linux kernel version and os-release info. Thank you!

@primiano
Copy link
Collaborator

for us it works on:

  • Debian rodete w/ 5.2.17-1rodete3-amd64
  • Pretty much and debian-based and ubuntu-based virtual machine we tried (e.g. TravisCI, Google Cloud Platform images)

Now that you make me realize, we do have a Dockerfile which is guaranteed to build, it's the one that ci.perfetto.dev uses.

You can the sources here:
https://github.com/google/perfetto/blob/master/infra/ci/sandbox/Dockerfile

The image is here:
docker pull eu.gcr.io/perfetto-ci/sandbox@sha256:9855b3cad890963ed5a15fa801f83e91158809e429c759ebbd2f89816c73a1f5

@koeichen
Copy link
Author

Thank you

@vsoch
Copy link

vsoch commented Jan 17, 2023

@primiano what ports and needed for that container? E.g., what is the docker run command?

@LalitMaganti
Copy link
Collaborator

That container is just for building the UI not for exposing the UI.

The UI is a fully static site so if you're trying to serve it, you should use the Docker version of any mainstream server (nginx, Caddy, traefik etc).

@vsoch
Copy link

vsoch commented Jan 17, 2023

Gotcha - I'm just looking to run a tiny version, so I was looking at ui/run-dev-server, e.g.,

ENTRYPOINT ["./ui/run-dev-server", "--serve-host", "0.0.0.0"]

Have you seen any docker-compose or similar setups (even manual docker or kubernetes would work) of someone running all the components together?

@vsoch
Copy link

vsoch commented Jan 17, 2023

What I'm trying so far is this Dockerfile:

FROM python:3

# docker build -t perfetto .

RUN git clone https://github.com/google/perfetto /opt/perfetto
WORKDIR /opt/perfetto

RUN tools/install-build-deps --ui
RUN tools/gn gen out/debug --args='is_debug=true'
RUN tools/ninja -C out/debug ui

ENTRYPOINT ["./ui/run-dev-server", "--serve-host", "0.0.0.0"]

Then:

$ docker run -it -p 8000:8000 perfetto --serve-host 0.0.0.0 --serve-port 8000 --serve

Ahh - I see - I wasn't patient enough! The frontend ui seems to finish building after I start (so at first the connection is reset) but when I let it wait... tada!!
image

I don't know if that's the full fledged thing I can run (I'll do some basic testing) but this is great!

@LalitMaganti
Copy link
Collaborator

The run-dev-server script exposes the UI on port 10000. However please do not run such an instance in production: the UI's dev server is not at all intended for being exposed to the internet and there could be any number of issues (i.e. security) with it.

Not sure what you mean by "all the components": the UI is really the only thing you'd want to run in a docker container.

@vsoch
Copy link

vsoch commented Jan 17, 2023

We want to primarily make a small app for users on a cluster, so it wouldn't be production exposed and it would only be maybe one person per app. However, if there is a production deployment that is known how to do, that would be really useful to be able to share. Do you know of one, akin to what I mentioned above? This above should at least serve for testing!

@LalitMaganti
Copy link
Collaborator

No I'm not aware of any such deployment but as I say, once the UI is built it's just a static site: you can serve it with any server. e.g. for nginx: https://www.docker.com/blog/how-to-use-the-official-nginx-docker-image/

@vsoch
Copy link

vsoch commented Jan 17, 2023

ohh gotcha - I can make a docker-compose set of containers to test this. And this also clarifies that point (sorry was not reading carefully!) #170 (comment)

@vsoch
Copy link

vsoch commented Jan 18, 2023

Thanks for the help! Here are examples of the single Docker / docker-compose setup with a self-signed cert that I threw together, in case someone else is looking for them! Please PR / suggest improvements to the repo too. https://github.com/rse-ops/perfetto-compose.

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

No branches or pull requests

4 participants