Skip to content

Instantly share code, notes, and snippets.

Depends: libclass-accessor-perl, libhttp-server-simple-perl, libjson-perl, liblist-moreutils-perl, libparams-validate-perl, libparent-perl, libtry-tiny-perl, libwww-perl, perl (>= 5.6.0-16)
#!/usr/bin/perl
use Ubic::Service::Plack;
my $service = Ubic::Service::Plack->new({
server => "FCGI",
server_args => { listen => "/tmp/app.sock", nproc => 5 },
app => "/opt/my-app/app.psgi",
pidfile => "/opt/my-app/app.pid",
port => 8080,
ubic_log => ""/opt/my-app/log/ubic.log",
@berekuk
berekuk / my-app
Created January 19, 2012 17:10
/etc/init.d/my-app
#!/bin/sh
export UBIC_SERVICE_DIR=/opt/app/ubic/service
export UBIC_DATA_DIR=/opt/app/ubic/data
ubic $1 my-app
package X;
use Mo;
package Y;
use Mo qw(build); # 'build' fills @Y::ISA with Mo::Object::Build instead of Mo::Object
extends "X"; # but extends() always *replaces* @ISA
@berekuk
berekuk / gist:1295455
Created October 18, 2011 13:44
Mo vs namespace::autoclean
$ perl -e 'package X; use namespace::autoclean; use Mo qw(build); sub BUILD { warn "build" }; X->new'
$ perl -e 'package X; use Mo qw(build); sub BUILD { warn "build" }; X->new'
build at -e line 1.
my %defaults = (
fhs => {
config => '/etc/ubic/ubic.cfg',
data_dir => '/var/lib/ubic',
service_dir => '/etc/ubic/service',
log_dir => '/var/log/ubic',
},
freebsd => {
config => '/usr/local/etc/ubic/ubic.cfg',
data_dir => '/var/db/ubic',
[21:45:13] <jo-jo> [17:09:53] something that will work is, yes, but that kind of line my $ pid_dir = '/var/lib/ubic/ubic-daemon'; not agree with the ideology of freebsd. That was fun to do if someone port.
[21:45:14] <mmcleric_> [17:18:46] jo-jo: I see (sorry, was away on $job meeting)
[21:45:14] <mmcleric_> [17:18:59] what would be the proper dir on freebsd, then?
[21:45:14] <mmcleric_> [17:20:32] btw, '/var/lib/ubic/ubic-daemon' is a dir from ubic-daemon script, which is... well, let's say I'm not sure why this script is still in distribution
[21:45:14] <mmcleric_> [17:22:04] because ubic-daemon script lets you quickly daemonize anything, but you can't stop your daemon later or control it in any way :) so it's generally useless, just use services and 'ubic start' instead
[21:45:14] <mmcleric_> [17:23:27] so, on the subject of dirs - 'ubic-admin setup' script let you choose "data dir" - it's /var/lib/ubic by default if you're root, but you can set it to anything you like
[21:45:14] <mmcleric_> [17:27:59] on
package Isa;
use MooseX::Role::Parameterized;
parameter 'extra' => (
is => 'ro',
isa => 'ArrayRef[Str]',
required => 1,
);
* * * * * . /Users/mmcleric/etc/bash/local && ubic-watchdog ubic.watchdog >>/dev/null 2>>/dev/null
{
"service": "ubic",
"subservices": [
{
"service": "ping",
"enabled": 0,
},
{
"service": "watchdog",
"enabled": 1,