Ionic as service - ubuntu


#1

Hello.

I need the ionic working like a service. This I need for the test environment. I need get PID to control the ionic. Does exist a solution for?

I am wrapping into the supervisor.

vagrant@ubuntu-14:~$ sudo cat /etc/supervisor/conf.d/ionic-car_budget.conf 
[program:ionic-car_budget]
command=ionic serve --port=8001 --address=2.4.8.4
directory=/var/www/ionic-car_budget/ionic
autostart=true
autorestart=true
startretries=3
stderr_logfile=/var/www/ionic-car_budget/logs/error.log
stdout_logfile=/var/www/ionic-car_budget/logs/out.log

Cordova, ionic are installed globally. I run IONIC from console successfully.
Supervisor can not start it.
It seems, some environment variables are missed.

TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/ionic-cordova-lib/src/cordova/util.js:34:31)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)

path.js:360
        throw new TypeError('Arguments to path.join must be strings');

Thank you.


#2

Why do you want to run ionic serve as a service? If you simply want to serve your app as a static website just serve its www folder in any regular HTTP server like Apache or Nginx.


#3

I am creating a box for testers IONIC and Flask. Than We will create PhantomJS tests. These tests Backend and front-end together. Simple QAs will write tests.


#4

I’ve found similar solution in the network.
http://nurd.nu/2014/09/18/hello-world/ I cues are here.


#5

The point is that the web part of an Ionic app is just a bunch of static HTML, CSS, and JavaScript files that you can serve using any HTTP server. So it’s not necessary to use ionic serve, you can use any HTTP server.

ionic serve is useful for development because it provides live reload etc., but I don’t think you want livereload when running end-to-end tests.


#6

:smiley: Yes, you are right! For tests it is enough.

For translators we still need a live reload.

Thank you.