Public bug reported:

I met a problem to use systemd to startup a program which needs to talk
to GDK Broadway backend.

(We are prepared to contribute $Aus 1000 for speedy fix.)
Is this the correct location?

The whole story is that I am in the progress to migrate a GTK+3
application to web based on Nignx/Nodejs/Broadway. Using systemd to
startup a Nodejs application which will "spawn" a Broadway instance and
a GTK+3 application when user logins in. And the GTK+3 application will
"display" on that Broadway instance.

Interesting thing is that when I execute that Nodejs application through
terminal, everything works perfectly.

When I use systemd to startup that Nodejs application, after user logins
in, Broadway instance is up, the GTK+3 application is up then exit with
the error message: "Gtk-WARNING **: cannot open display:"


I googled for a while and didn't find many useful information. So I am not sure 
it is that systemd doesn't support GUI or I just made a stupid mistake.

Anyway, thanks a lot in advance.


The systemd service file of the Nodejs application looks like this:

[Unit]
Description=XXXXXXXXX
After=Our-Nginx.service

[Service]
ExecStart=/usr/bin/nodejs /path/to/Nodejs/application
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=Nodejs_application

[Install]
WantedBy=multi-user.target


The Nodejs application code looks like this:

... ...

var spawn = require('child_process').spawn;

... ...

var env = Object.create(process.env);
env.LOGNAME                         = username;
env.GDK_BACKEND                 = 'broadway';
env.BROADWAY_DISPLAY        = port_id;
env.SAL_USE_VCLPLUGIN        = 'gtk3';
env.UBUNTU_MENUPROXY      = '';
env.LIBOVERLAY_SCROLLBAR = '';
env.HOME                                = 'XXXXXXX';

const instance = spawn('/path/to/gtk3/application', [], { env: env });
instance.stdout.on('data', (data) => {
      console.log(`stdout: ${data}`);
});

instance.stderr.on('data', (data) => {
      console.log(`stderr: ${data}`);
});
instance.on('close', (code) => {
      console.log(`child process exited with code ${code}`);
});

** Affects: ubuntu-docs (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of
Documentation Packages, which is subscribed to ubuntu-docs in Ubuntu.
https://bugs.launchpad.net/bugs/1624783

Title:
  Systemd startup Broadway backend

Status in ubuntu-docs package in Ubuntu:
  New

Bug description:
  I met a problem to use systemd to startup a program which needs to
  talk to GDK Broadway backend.

  (We are prepared to contribute $Aus 1000 for speedy fix.)
  Is this the correct location?

  The whole story is that I am in the progress to migrate a GTK+3
  application to web based on Nignx/Nodejs/Broadway. Using systemd to
  startup a Nodejs application which will "spawn" a Broadway instance
  and a GTK+3 application when user logins in. And the GTK+3 application
  will "display" on that Broadway instance.

  Interesting thing is that when I execute that Nodejs application
  through terminal, everything works perfectly.

  When I use systemd to startup that Nodejs application, after user
  logins in, Broadway instance is up, the GTK+3 application is up then
  exit with the error message: "Gtk-WARNING **: cannot open display:"

  
  I googled for a while and didn't find many useful information. So I am not 
sure it is that systemd doesn't support GUI or I just made a stupid mistake.

  Anyway, thanks a lot in advance.

  
  The systemd service file of the Nodejs application looks like this:

  [Unit]
  Description=XXXXXXXXX
  After=Our-Nginx.service

  [Service]
  ExecStart=/usr/bin/nodejs /path/to/Nodejs/application
  Restart=always
  RestartSec=5
  StandardOutput=syslog
  StandardError=syslog
  SyslogIdentifier=Nodejs_application

  [Install]
  WantedBy=multi-user.target

  
  The Nodejs application code looks like this:

  ... ...

  var spawn = require('child_process').spawn;

  ... ...

  var env = Object.create(process.env);
  env.LOGNAME                         = username;
  env.GDK_BACKEND                 = 'broadway';
  env.BROADWAY_DISPLAY        = port_id;
  env.SAL_USE_VCLPLUGIN        = 'gtk3';
  env.UBUNTU_MENUPROXY      = '';
  env.LIBOVERLAY_SCROLLBAR = '';
  env.HOME                                = 'XXXXXXX';

  const instance = spawn('/path/to/gtk3/application', [], { env: env });
  instance.stdout.on('data', (data) => {
        console.log(`stdout: ${data}`);
  });

  instance.stderr.on('data', (data) => {
        console.log(`stderr: ${data}`);
  });
  instance.on('close', (code) => {
        console.log(`child process exited with code ${code}`);
  });

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-docs/+bug/1624783/+subscriptions

-- 
Mailing list: https://launchpad.net/~documentation-packages
Post to     : documentation-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~documentation-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to