How to deploy PHP/HTML website with Gitlab CI

Setting up Gitlab-CI to deploy your PHP & HTML (or any other ‘static’ site) is quite simple, but poorly documented. After a few weeks of fiddling around I found the following solution. I’d love to hear everyone’s feedback.

Requirements:

  1. Your webserver must have root access (to install the runner).
  2. Your site/codebase should be rather small and not too complex.
    • This example uses rsync to move/sync two folders, so sites that can self-update their DB like wordpress should be OK, but I have not tested it.
    • We’re going to use rsync to move/sync two folders, so sites that self-manage media content, like wordpress, will lose that media content. You will need to tweak the rsync script to handle this yourself.
  3. A gitlab install or repo you have permission to add runners to.
  4. These instructions are for Linux (Ubuntu 14.04 specifically) but they should be applicable to any OS supported by the runner.

Continue reading “How to deploy PHP/HTML website with Gitlab CI”

HowTo: Remove message requirement when assigning tickets in OSTicket

Sometimes you just need to assign a ticket to another team member quickly and move on, but OSTicket insists on a leaving an assignment message. This is especially annoying when the reason for the assignment is blatantly obvious (such as a sales inquiry being assigned to a sales rep in the dept).

In OSTicket v1.9.7 open scp/tickets.php and locate the following block (around line 171):

 //Comments are not required on self-assignment (claim)
if($claim && !$_POST['assign_comments'])
$_POST['assign_comments'] = sprintf(__('Ticket claimed by %s'),$thisstaff->getName());
elseif(!$_POST['assign_comments'])
$errors['assign_comments'] = __('Assignment comments required');
elseif(strlen($_POST['assign_comments'])<5)
$errors['assign_comments'] = __('Comment too short');

If you want to remove the comment requirement altogether then either comment out or remove the last 4 lines like so:

//Comments are not required on self-assignment (claim)
if($claim && !$_POST['assign_comments'])
$_POST['assign_comments'] = sprintf(__('Ticket claimed by %s'),$thisstaff->getName());

If you just want to shorten the minimum requirement, then change the 2nd to last line.

From:

elseif(strlen($_POST['assign_comments'])<5)

to:

elseif(strlen($_POST['assign_comments'])<3)