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

Be compatible with Upstart #1

Open
anselal opened this issue Feb 19, 2017 · 5 comments
Open

Be compatible with Upstart #1

anselal opened this issue Feb 19, 2017 · 5 comments

Comments

@anselal
Copy link
Contributor

anselal commented Feb 19, 2017

From @HLFH on February 11, 2017 10:40

Hi,

With Upstart, you can use setuid and setgid.
So, please migrate from SysVinit + Forever to Upstart + Forever.

Here is an example:

#!upstart

description "Wekan Upstart Script"
 
start on startup
stop on shutdown
 
expect fork

env NAME="Wekan"
env NODE_PATH="/home/username/.nvm/v0.10.40/bin"
env APPLICATION_PATH="/home/username/wekan/bundle/main.js"
env PIDFILE=/var/run/wekan.pid
env LOGFILE=/var/log/wekan.log
env MONGO_URL="mongodb://127.0.0.1:27017/wekan"
env ROOT_URL="http://127.0.0.1"
env MAIL_URL='smtp://user:[email protected]:25/'
env PORT="8080"

script
    PATH=$NODE_PATH:$PATH

    exec forever \
        --pidFile $PIDFILE \
        -a \
        -l $LOGFILE \
        --minUptime 5000 \
        --spinSleepTime 2000 \
        start $APPLICATION_PATH

end script
 
pre-stop script
    PATH=$NODE_PATH:$PATH

    exec forever stop $APPLICATION_PATH
end script

Copied from original issue: anselal/wekan#20

@anselal
Copy link
Contributor Author

anselal commented Feb 19, 2017

@HLFH I haven't used upstart yet. I will take a look at it.

@anselal
Copy link
Contributor Author

anselal commented Feb 19, 2017

From @xet7 on February 13, 2017 7:37

@HLFH

I haven't used upstart, I currently only use systemd on Ubuntu 16.04 or Debian 8:
https://github.com/wekan/wekan/wiki/Install-and-Update#optional-run-wekan-as-service

@anselal
Copy link
Contributor Author

anselal commented Feb 19, 2017

@HLFH I think I will stick to SysVinit for Ubuntu 14, and migrate to systemd for ubuntu 16 so there will be the support possible from us, for both versions. Thanx @xet7

@anselal
Copy link
Contributor Author

anselal commented Feb 19, 2017

From @HLFH on February 13, 2017 15:11

@anselal Ubuntu 14.04 supports UpStart. SysVinit is obsolete for Wekan use, even on Ubuntu 14.04. With Upstart, you have setuid and setgid features, so you can run Wekan as wekan user and not as root, which is quite better in terms of security, isnt' it?

#!upstart

description "Wekan Upstart Script"

start on startup
stop on shutdown

expect fork

setuid wekan
setgid wekan

env NAME="Wekan"
env NODE_PATH="/var/www/wekan/.nvm/v0.10.48/bin"
env APPLICATION_PATH="/var/www/wekan/main.js"
env PIDFILE=/var/run/wekan.pid
env LOGFILE=/var/log/wekan.log
env MONGO_URL="mongodb://127.0.0.1:27017/wekan"
env ROOT_URL="https://wekan.example.com"
env MAIL_URL="smtp://[email protected]:[email protected]:25/"
env MAIL_FROM="[email protected]"
env PORT="8080"

script
    exec 2>>/dev/.initramfs/wekan.log
    set -x
    PATH=$NODE_PATH:$PATH

    exec forever \
        --pidFile $PIDFILE \
        -a \
        -l $LOGFILE \
        --minUptime 5000 \
        --spinSleepTime 2000 \
        start $APPLICATION_PATH

end script

pre-stop script
    PATH=$NODE_PATH:$PATH

    exec forever stop $APPLICATION_PATH
end script

@anselal
Copy link
Contributor Author

anselal commented Mar 3, 2017

If you think that there is a problem running wekan as root you can always edit the script and change the user running it. I will give upstart and systemd a try in the next releases, but as long as there are no problems with sysvinit I will stick with my implementation

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

1 participant