1

I am running Ubuntu 14.04.

I am trying to make a service capable of deploying an application. The process is very simple:

  1. I have a node script listening on port 2133 for a POST request
  2. When this script gets a request, it triggers a bash script that has to clone a git repository
  3. The bash script should run a composer install command to install the dependencies of the application.

When I launch my script with node index.js, everything works fine.

I then made an upstart service, defined with the following config file:

description "Service permettant le déploiement d'une application depuis bitbucket"
author "Mathieu Marteau"

start on filesystem runlevel [2345]
stop on shutdown
respawn
setuid mmarteau

exec /usr/bin/node /home/mmarteau/deploy/index.js

The service works fine, all of my bash file is running, except for the one command composer install.

I've got nothing in the /var/log/upstart/myservice.log.

I also tried to replace the composer install command with the full path: /usr/local/bin/composer install; but this has no effect either.

Where should I look to solve my problem?

Thank you very much for your help!

EDIT: My problem is solved when I replace the composer install by sudo composer install. I don't understand because everything works when I launch my node script logged as mmarteau but it does need a sudo with the upstart service. I thought that the setuid mmarteau was the necessary line...

Hammerbot
  • 175
  • 2
  • 8
  • Check current working directory. I'm pretty sure it's `/` and probably composer doesn't expect that – Alexey Ten Jul 19 '16 at 07:41
  • I placed a `pwd;` in my bash script to check that, and it shows the right directory... Before running composer, I `cd` into the directory in by bash script – Hammerbot Jul 19 '16 at 07:48
  • The problem is solved when I replace the `composer install;` by `sudo composer install`. But I'm not sure that this is the proper solution... – Hammerbot Jul 19 '16 at 07:57

0 Answers0