docs: fix issues
[parser.git] / tosca2heat / heat-translator / translator / tests / data / artifacts / nodejs / config.sh
1 #!/bin/bash
2 # This script installs an app for nodejs: the app intended is the paypal app
3 # and it is configured to connect to the mongodb server
4 # The environment variables github_url and mongodb_ip are expected to be set up
5 export app_dir=/opt/app
6 git clone $github_url /opt/app
7 if [ -f /opt/app/package.json ]; then
8    cd  /opt/app/ && npm install
9    sed -i "s/localhost/$mongodb_ip/" config.json
10 fi
11
12 cat > /etc/init/nodeapp.conf <<EOS
13 description "node.js app"
14  
15 start on (net-device-up
16           and local-filesystems
17           and runlevel [2345])
18 stop on runlevel [!2345]
19  
20 expect fork
21 respawn
22  
23 script
24   export HOME=/
25   export NODE_PATH=/usr/lib/node
26   exec /usr/bin/node ${app_dir}/app.js >> /var/log/nodeapp.log 2>&1 &
27 end script
28 EOS