From 4030da901ae7effbe104f0961f9518f60622df4f Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 19 Dec 2013 11:07:28 -0800 Subject: [PATCH] Vagrant+salt+Makefile for build --- Makefile | 88 +++++++++++++++++++++++++++++++ debian/calamari-clients.install | 0 debian/calamari-clients.postinst | 3 ++ debian/calamari-clients.prerm | 3 ++ debian/changelog | 5 ++ debian/compat | 1 + debian/control | 13 +++++ debian/copyright | 1 + debian/rules | 6 +++ vagrant/Vagrantfile | 22 ++++++++ vagrant/salt/minion | 2 + vagrant/salt/roots/build_deps.sls | 42 +++++++++++++++ vagrant/salt/roots/top.sls | 4 ++ 13 files changed, 190 insertions(+) create mode 100644 Makefile create mode 100644 debian/calamari-clients.install create mode 100755 debian/calamari-clients.postinst create mode 100755 debian/calamari-clients.prerm create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 vagrant/Vagrantfile create mode 100644 vagrant/salt/minion create mode 100644 vagrant/salt/roots/build_deps.sls create mode 100644 vagrant/salt/roots/top.sls diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..46abda4f --- /dev/null +++ b/Makefile @@ -0,0 +1,88 @@ +VERSION=1.0.0 +DISTNAMEVER=calamari-clients_$(VERSION) +PKGDIR=calamari-clients-$(VERSION) +TARNAME = ../$(DISTNAMEVER).tar.gz +SRC := $(shell pwd) + +INSTALL=/usr/bin/install + +UI_BASEDIR = $(DESTDIR)/opt/calamari/webapp/content +UI_SUBDIRS = admin login dashboard +CONFIG_JSON = dashboard/dist/scripts/config.json + +FINDCMD =find . \ + -name .git -prune \ + -o -name node_modules -prune \ + -o -name .tmp -prune \ + -o -name .sass-cache -prune \ + -o -name debian -prune \ + -o -print0 + +# add in just the debian files we want +DEBFILES = \ + changelog \ + compat \ + control \ + copyright \ + rules \ + source/format + +build: build-ui $(CONFIG_JSON) + +build-ui: + @echo "building ui" + set -e ;\ + for d in $(UI_SUBDIRS); do \ + echo $$d; \ + (cd $$d; \ + npm install --loglevel warn && \ + bower --allow-root install && \ + grunt --no-color saveRevision && \ + grunt --no-color build; ) \ + done + +# for right now, this contains two useful things that should be set +# when running against a live cluster. We could preinstall it in the +# package or do it in a postinstall; it has more visibility here + +$(CONFIG_JSON): build-ui + echo '{ "offline": false, "graphite-host": "/graphite" }' \ + > $(CONFIG_JSON) + + +# NB we do not build source packages +dpkg: + dpkg-buildpackage -b -us -uc + +install: + @echo "install" + for d in $(UI_SUBDIRS); do \ + instdir=$$(basename $$d); \ + $(INSTALL) -d $(UI_BASEDIR)/$$instdir; \ + cp -rp $$d/dist/* $(UI_BASEDIR)/$$instdir; \ + done + +clean: + for d in $(UI_SUBDIRS); do \ + echo $$d; \ + (cd $$d; \ + if [ -d node_modules ] ; then grunt --no-color clean; fi) \ + done + @rm -f $(CONFIG_JSON) + +dist: + @echo "making dist tarball in $(TARNAME)" + for d in $(UI_SUBDIRS); do \ + echo $$d; \ + (cd $$d; \ + npm install --silent; \ + grunt --no-color saveRevision) \ + done + @rm -rf $(PKGDIR) + @$(FINDCMD) | cpio --null -p -d $(PKGDIR) + @tar -zcf $(TARNAME) $(PKGDIR) + @rm -rf $(PKGDIR) + @echo "tar file made in $(TARNAME)" + +.PHONY: dist clean build dpkg install + diff --git a/debian/calamari-clients.install b/debian/calamari-clients.install new file mode 100644 index 00000000..e69de29b diff --git a/debian/calamari-clients.postinst b/debian/calamari-clients.postinst new file mode 100755 index 00000000..8c3cbfc3 --- /dev/null +++ b/debian/calamari-clients.postinst @@ -0,0 +1,3 @@ +#!/bin/bash + +exit 0 diff --git a/debian/calamari-clients.prerm b/debian/calamari-clients.prerm new file mode 100755 index 00000000..8c3cbfc3 --- /dev/null +++ b/debian/calamari-clients.prerm @@ -0,0 +1,3 @@ +#!/bin/bash + +exit 0 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..a7ecfd8d --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +calamari-clients (0.1) UNRELEASED; urgency=low + + * Initial release. + + -- Inktank Weds, 18 Dec 2013 14:20:00 -0800 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..45a4fb75 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..7eafb2d8 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: calamari-clients +Section: misc +Priority: extra +Homepage: http://www.inktank.com/ +Maintainer: Inktank +Standards-Version: 3.9.2 +Build-Depends: ruby, rubygems, make, git, nodejs + +Package: calamari-clients +Architecture: all +Depends: calamari-server +Description: Inktank Calamari user interface + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..ade490a5 --- /dev/null +++ b/debian/copyright @@ -0,0 +1 @@ +Copyright (c) 2013, Inktank Storage, Inc. All rights reserved. diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..f66dd138 --- /dev/null +++ b/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f +export DH_VERBOSE=1 + +%: + # keep your *(#$& hands off my venvs + dh $@ --without python2 --without python3 --without pycentral --without pysupport diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile new file mode 100644 index 00000000..3ac35d32 --- /dev/null +++ b/vagrant/Vagrantfile @@ -0,0 +1,22 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + config.vm.box = "precise64" + config.vm.box_url = "http://files.vagrantup.com/precise64.box" + + config.vm.provider :virtualbox do |vb| + vb.customize ["modifyvm", :id, "--memory", "512"] + vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"] + end + + config.vm.synced_folder "../../", "/git" + config.vm.synced_folder "salt/roots/", "/srv/salt/" + config.vm.provision :salt do |salt| + salt.minion_config = "salt/minion" + salt.run_highstate = true + end +end diff --git a/vagrant/salt/minion b/vagrant/salt/minion new file mode 100644 index 00000000..62304604 --- /dev/null +++ b/vagrant/salt/minion @@ -0,0 +1,2 @@ +master: localhost +file_client: local \ No newline at end of file diff --git a/vagrant/salt/roots/build_deps.sls b/vagrant/salt/roots/build_deps.sls new file mode 100644 index 00000000..d42255f8 --- /dev/null +++ b/vagrant/salt/roots/build_deps.sls @@ -0,0 +1,42 @@ +build_deps: + pkg.installed: + - pkgs: + - ruby + - rubygems + - python-software-properties + - g++ + - make + - git + - debhelper + +install_node: + pkgrepo.managed: + - humanname: node.js PPA + - name: deb http://ppa.launchpad.net/chris-lea/node.js/ubuntu precise main + - dist: precise + - file: /etc/apt/sources.list.d/node.list + - keyid: B9316A7BC7917B12 + - keyserver: keyserver.ubuntu.com + pkg.latest: + - name: nodejs + - refresh: True + +bower: + cmd.run: + - name: npm install -g bower@1.2.8 + require: + - pkg: install_node + +grunt-cli: + cmd.run: + - name: npm install -g grunt-cli + require: + - pkg: install_node + +animate: + gem: + - installed + require: + - pkg: rubygems + + diff --git a/vagrant/salt/roots/top.sls b/vagrant/salt/roots/top.sls new file mode 100644 index 00000000..7c7d61c7 --- /dev/null +++ b/vagrant/salt/roots/top.sls @@ -0,0 +1,4 @@ + +base: + '*': + - build_deps