diff options
author | Oliver Poignant <oliver@poignant.se> | 2016-03-13 22:24:15 +0100 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2016-03-13 22:24:15 +0100 |
commit | 00244a1b198b5557610398e8435a0f993f6adcc0 (patch) | |
tree | f601cd99ae9d8c478e79e4ba21e72919d83a4077 | |
parent | b68a015e5e31f049b091ffcebb7c0db4e60c6818 (diff) | |
download | Git-Auto-Deploy-00244a1b198b5557610398e8435a0f993f6adcc0.zip Git-Auto-Deploy-00244a1b198b5557610398e8435a0f993f6adcc0.tar.gz Git-Auto-Deploy-00244a1b198b5557610398e8435a0f993f6adcc0.tar.bz2 |
Updated docs
-rw-r--r-- | docs/Install as a python module.md | 12 | ||||
-rw-r--r-- | docs/Start automatically on boot.md | 48 | ||||
-rwxr-xr-x | platforms/debian/stdeb/git-auto-deploy.init | 4 | ||||
-rwxr-xr-x | platforms/linux/initfiles/debianLSBInitScripts/git-auto-deploy (renamed from platforms/linux/initfiles/debianLSBInitScripts/gitautodeploy) | 4 | ||||
-rw-r--r-- | platforms/linux/initfiles/systemd/git-auto-deploy.service (renamed from platforms/linux/initfiles/systemd/gitautodeploy.service) | 2 |
5 files changed, 45 insertions, 25 deletions
diff --git a/docs/Install as a python module.md b/docs/Install as a python module.md index 5e45e0d..2f24ea4 100644 --- a/docs/Install as a python module.md +++ b/docs/Install as a python module.md @@ -1,6 +1,6 @@ -## Install as a python module (experimental) +# Install as a python module (experimental) -### Download and install +## Download and install Install using [pip](http://www.pip-installer.org/en/latest/), a package manager for Python, by running the following command. @@ -21,21 +21,19 @@ You may need to run the above commands with `sudo`. Once ```Git-Auto-Deploy``` has been installed as a python module, it can be started using the executable ```git-auto-deploy```. During installation with pip, the executable is usually installed in ```/usr/local/bin/git-auto-deploy```. This can vary depending on platform. -### Configuration +## Configuration Copy the content of [config.json.sample](./config.json.sample) and save it anywhere you like, for example ```~/git-auto-deploy.conf.json```. Modify it to match your project setup. [Read more about the configuration options](./docs/Configuration.md). [](./docs/Configuration.md) -### Running the application +## Running the application Run the application using the executable ```git-auto-deploy``` which has been provided by pip. Provide the path to your configuration file as a command line argument. referencing the ```gitautodeploy``` module (the directory ```Git-Auto-Deploy/gitautodeploy```). git-auto-deploy --config ~/git-auto-deploy.conf.json -### Start automatically on boot - -#### Using crontab +## Start automatically on boot using crontab The easiest way to configure your system to automatically start ```Git-Auto-Deploy``` after a reboot is using crontab. Open crontab in edit mode using ```crontab -e``` and add the entry below. diff --git a/docs/Start automatically on boot.md b/docs/Start automatically on boot.md index 055d932..963d50a 100644 --- a/docs/Start automatically on boot.md +++ b/docs/Start automatically on boot.md @@ -2,25 +2,47 @@ ```Git-Auto-Deploy``` can be automatically started at boot time using various techniques. Below you'll find a couple of suggested approaches with instructions. +The following instructions assumes that you are running ```Git-Auto-Deploy``` from a clone of this repository. In such a case, ```Git-Auto-Deploy``` is started by invoking ```python``` and referencing the ```gitautodeploy``` python module which is found in the cloned repository. Such a command can look like ```python /path/to/Git-Auto-Deploy/gitautodeploy --daemon-mode```. + +If you have used any of the alternative installation methods (install with pip or as a debian package), you will instead start ```Git-Auto-Deploy``` using a installed executable. ```Git-Auto-Deploy``` would then be started using a command like ```git-auto-deploy --daemon-mode``` instead. If you have installed ```Git-Auto-Deploy``` in this way, you will need to modify the paths and commands used in the instructions below. + ## Crontab The easiest way to configure your system to automatically start ```Git-Auto-Deploy``` after a reboot is using crontab. Open crontab in edit mode using ```crontab -e``` and add the following: -```@reboot /usr/bin/python /path/to/gitautodeploy --daemon-mode --quiet``` + @reboot /usr/bin/python /path/to/Git-Auto-Deploy/gitautodeploy --daemon-mode --quiet ## Debian and Sys-V like init system. -* Copy file ```initfiles/debianLSBInitScripts/gitautodeploy``` to ```/etc/init.d/``` -* Make it executable: ```chmod 755 /etc/init.d/gitautodeploy``` -* Also you need to make ```GitAutoDeploy.py``` executable (if it isn't already): ```chmod 755 GitAutoDeploy.py``` -* This init script assumes that you have ```GitAutoDeploy.py``` installed in ```/opt/Git-Auto-Deploy/``` and that the ```pidfilepath``` config option is set to ```/var/run/gitautodeploy.pid```. If this is not the case, edit the ```gitautodeploy``` init script and modify ```DAEMON```, ```PWD``` and ```PIDFILE```. -* Now you need to add the correct symbolic link to your specific runlevel dir to get the script executed on each start up. On Debian_Sys-V just do ```update-rc.d gitautodeploy defaults``` +Copy the sample init script into ```/etc/init.d/``` and make it executable. + + cp platforms/linux/initfiles/debianLSBInitScripts/git-auto-deploy /etc/init.d/ + chmod 755 /etc/init.d/git-auto-deploy + +The init script assumes that you have ```Git-Auto-Deploy``` installed in ```/opt/Git-Auto-Deploy/``` and that the ```pidfilepath``` config option is set to ```/var/run/git-auto-deploy.pid```. If this is not the case, edit the ```git-auto-deploy``` init script and modify ```DAEMON```, ```PWD``` and ```PIDFILE```. + +Now you need to add the correct symbolic link to your specific runlevel dir to get the script executed on each start up. On Debian_Sys-V just do; + + update-rc.d git-auto-deploy defaults ## Systemd -* Copy file ```initfiles/systemd/gitautodeploy.service``` to ```/etc/systemd/system``` -* Also you need to make ```GitAutoDeploy.py``` executable (if it isn't already): ```chmod 755 GitAutoDeploy.py``` -* And also you need to create the user and the group ```www-data``` if those not exists ```useradd -U www-data``` -* This init script assumes that you have ```GitAutoDeploy.py``` installed in ```/opt/Git-Auto-Deploy/```. If this is not the case, edit the ```gitautodeploy.service``` service file and modify ```ExecStart``` and ```WorkingDirectory```. -* now reload daemons ```systemctl daemon-reload``` -* Fire it up ```systemctl start gitautodeploy``` -* Make is start on system boot ```systemctl enable gitautodeploy``` +Copy the sample systemd service file ```git-auto-deploy.service``` into ```/etc/systemd/system```; + + cp platforms/linux/initfiles/systemd/git-auto-deploy.service /etc/systemd/system + +Create the user and group specified in git-auto-deploy.service (```www-data```) if those do not exist already. + + useradd -U www-data + +This init script assumes that you have ```Git-Auto-Deploy``` installed in ```/opt/Git-Auto-Deploy/```. If this is not the case, edit the ```git-auto-deploy.service``` service file and modify ```ExecStart``` and ```WorkingDirectory```. + +Now, reload daemons and fire ut up; + + systemctl daemon-reload + systemctl start git-auto-deploy + +Make is start automaticallt on system boot + + systemctl enable gitautodeploy + + diff --git a/platforms/debian/stdeb/git-auto-deploy.init b/platforms/debian/stdeb/git-auto-deploy.init index 3d7f0bf..9a0a84c 100755 --- a/platforms/debian/stdeb/git-auto-deploy.init +++ b/platforms/debian/stdeb/git-auto-deploy.init @@ -14,7 +14,7 @@ NAME="git-auto-deploy" PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="GitAutodeploy" -DAEMON="/usr/bin/git-auto-deploy" +DAEMON=$(which $NAME) DAEMON_UID="git-auto-deploy" DAEMON_GID="git-auto-deploy" RUNDIR=/var/run/$NAME @@ -24,7 +24,7 @@ OPTIONS="--daemon-mode --pid-file $PIDFILE --config /etc/$NAME.conf.json" SCRIPTNAME="/etc/init.d/$NAME" # Exit if the package is not installed -#[ -x $DAEMON ] || echo "$name is not installed" && exit 0 +#[ -x $DAEMON ] || echo "$NAME is not installed" && exit 0 # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh diff --git a/platforms/linux/initfiles/debianLSBInitScripts/gitautodeploy b/platforms/linux/initfiles/debianLSBInitScripts/git-auto-deploy index 9768a69..9a00315 100755 --- a/platforms/linux/initfiles/debianLSBInitScripts/gitautodeploy +++ b/platforms/linux/initfiles/debianLSBInitScripts/git-auto-deploy @@ -20,12 +20,12 @@ DAEMON_GID=root RUNDIR=/var/run/$NAME PIDFILE=/var/run/$NAME.pid PWD=/opt/Git-Auto-Deploy/ -OPTIONS="--daemon-mode --quiet --pid-file /var/run/gitautodeploy.pid --log-file /var/log/gitautodeploy.log" +OPTIONS="--daemon-mode --quiet --pid-file /var/run/git-auto-deploy.pid --log-file /var/log/git-auto-deploy.log" USER=root SCRIPTNAME=/etc/init.d/$NAME # Exit if the package is not installed -[ -x $DAEMON ] || exit 0 +#[ -x $DAEMON ] || echo "$NAME is not installed" && exit 0 # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh diff --git a/platforms/linux/initfiles/systemd/gitautodeploy.service b/platforms/linux/initfiles/systemd/git-auto-deploy.service index 71cb1c5..c73ff6c 100644 --- a/platforms/linux/initfiles/systemd/gitautodeploy.service +++ b/platforms/linux/initfiles/systemd/git-auto-deploy.service @@ -5,7 +5,7 @@ Description=GitAutoDeploy User=www-data Group=www-data WorkingDirectory=/opt/Git-Auto-Deploy/ -ExecStart=/opt/Git-Auto-Deploy/GitAutoDeploy.py +ExecStart=/usr/bin/python /opt/Git-Auto-Deploy/gitautodeploy --daemon-mode [Install] WantedBy=multi-user.target |