Commit 763da991 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis 🤸🏽

Initial commit

parents
*.gem
.bundle
vendor/bundle
pkg/*
.vagrant
bin/*
files/**/cache/
vendor/cookbooks
site :opscode
cookbook "omnibus"
source 'https://rubygems.org'
gem 'omnibus', '~> 1.2.0'
gem 'omnibus-software', :git => 'git://github.com/opscode/omnibus-software.git', :branch => 'master'
# gitlab Omnibus project
This project creates full-stack platform-specific packages for
`gitlab`!
## Installation
We'll assume you have Ruby 1.9+ and Bundler installed. First ensure all
required gems are installed and ready to use:
```shell
$ bundle install --binstubs
```
## Usage
### Build
You create a platform-specific package using the `build project` command:
```shell
$ bin/omnibus build project gitlab
```
The platform/architecture type of the package created will match the platform
where the `build project` command is invoked. So running this command on say a
MacBook Pro will generate a Mac OS X specific package. After the build
completes packages will be available in `pkg/`.
### Clean
You can clean up all temporary files generated during the build process with
the `clean` command:
```shell
$ bin/omnibus clean
```
Adding the `--purge` purge option removes __ALL__ files generated during the
build including the project install directory (`/opt/gitlab`) and
the package cache directory (`/var/cache/omnibus/pkg`):
```shell
$ bin/omnibus clean --purge
```
### Help
Full help for the Omnibus command line interface can be accessed with the
`help` command:
```shell
$ bin/omnibus help
```
## Vagrant-based Virtualized Build Lab
Every Omnibus project ships will a project-specific
[Berksfile](http://berkshelf.com/) and [Vagrantfile](http://www.vagrantup.com/)
that will allow you to build your projects on the following platforms:
* CentOS 5 64-bit
* CentOS 6 64-bit
* Ubuntu 10.04 64-bit
* Ubuntu 11.04 64-bit
* Ubuntu 12.04 64-bit
Please note this build-lab is only meant to get you up and running quickly;
there's nothing inherent in Omnibus that restricts you to just building CentOS
or Ubuntu packages. See the Vagrantfile to add new platforms to your build lab.
The only requirements for standing up this virtualized build lab are:
* VirtualBox - native packages exist for most platforms and can be downloaded
from the [VirtualBox downloads page](https://www.virtualbox.org/wiki/Downloads).
* Vagrant 1.2.1+ - native packages exist for most platforms and can be downloaded
from the [Vagrant downloads page](http://downloads.vagrantup.com/).
The [vagrant-berkshelf](https://github.com/RiotGames/vagrant-berkshelf) and
[vagrant-omnibus](https://github.com/schisamo/vagrant-omnibus) Vagrant plugins
are also required and can be installed easily with the following commands:
```shell
$ vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-omnibus
```
Once the pre-requisites are installed you can build your package across all
platforms with the following command:
```shell
$ vagrant up
```
If you would like to build a package for a single platform the command looks like this:
```shell
$ vagrant up PLATFORM
```
The complete list of valid platform names can be viewed with the
`vagrant status` command.
# -*- mode: ruby -*-
# vi: set ft=ruby :
require "vagrant"
if Vagrant::VERSION < "1.2.1"
raise "The Omnibus Build Lab is only compatible with Vagrant 1.2.1+"
end
host_project_path = File.expand_path("..", __FILE__)
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
project_name = "gitlab"
Vagrant.configure("2") do |config|
config.vm.hostname = "#{project_name}-omnibus-build-lab"
config.vm.define 'ubuntu-10.04' do |c|
c.berkshelf.berksfile_path = "./Berksfile"
c.vm.box = "opscode-ubuntu-10.04"
c.vm.box_url = "http://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_chef-11.2.0.box"
end
config.vm.define 'ubuntu-11.04' do |c|
c.berkshelf.berksfile_path = "./Berksfile"
c.vm.box = "opscode-ubuntu-11.04"
c.vm.box_url = "http://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-11.04.box"
end
config.vm.define 'ubuntu-12.04' do |c|
c.berkshelf.berksfile_path = "./Berksfile"
c.vm.box = "canonical-ubuntu-12.04"
c.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
end
config.vm.define 'centos-5' do |c|
c.berkshelf.berksfile_path = "./Berksfile"
c.vm.box = "opscode-centos-5.8"
c.vm.box_url = "http://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.8_chef-11.2.0.box"
end
config.vm.define 'centos-6' do |c|
c.berkshelf.berksfile_path = "./Berksfile"
c.vm.box = "opscode-centos-6.3"
c.vm.box_url = "http://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.3_chef-11.2.0.box"
end
config.vm.provider :virtualbox do |vb|
# Give enough horsepower to build without taking all day.
vb.customize [
"modifyvm", :id,
"--memory", "1536",
"--cpus", "2"
]
end
# Ensure a recent version of the Chef Omnibus packages are installed
config.omnibus.chef_version = :latest
# Enable the berkshelf-vagrant plugin
config.berkshelf.enabled = true
# The path to the Berksfile to use with Vagrant Berkshelf
config.berkshelf.berksfile_path = "./Berksfile"
config.ssh.max_tries = 40
config.ssh.timeout = 120
config.ssh.forward_agent = true
host_project_path = File.expand_path("..", __FILE__)
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
config.vm.synced_folder host_project_path, guest_project_path
# prepare VM to be an Omnibus builder
config.vm.provision :chef_solo do |chef|
chef.json = {
"omnibus" => {
"build_user" => "vagrant",
"build_dir" => guest_project_path,
"install_dir" => "/opt/#{project_name}"
}
}
chef.run_list = [
"recipe[omnibus::default]"
]
end
config.vm.provision :shell, :inline => <<-OMNIBUS_BUILD
export PATH=/usr/local/bin:$PATH
cd #{guest_project_path}
su vagrant -c "bundle install --binstubs"
su vagrant -c "bin/omnibus build project #{project_name}"
OMNIBUS_BUILD
end
name "gitlab"
maintainer "CHANGE ME"
homepage "CHANGEME.com"
replaces "gitlab"
install_path "/opt/gitlab"
build_version Omnibus::BuildVersion.new.semver
build_iteration 1
# creates required build directories
dependency "preparation"
# gitlab dependencies/components
# dependency "somedep"
# version manifest file
dependency "version-manifest"
exclude "\.git*"
exclude "bundler\/git"
# This is an example software definition for a C project.
#
# Lots of software definitions for popular open source software
# already exist in `opscode-omnibus`:
#
# https://github.com/opscode/omnibus-software/tree/master/config/software
#
name "c-example"
version "1.0.0"
dependency "zlib"
dependency "openssl"
source :url => "http://itchy.neckbeard.se/download/c-example-1.0.0.tar.gz",
:md5 => "8e23151f569fb54afef093ac0695077d"
relative_path 'c-example-1.0.0'
env = {
"LDFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
"CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
"LD_RUN_PATH" => "#{install_dir}/embedded/lib"
}
build do
command ["./configure",
"--prefix=#{install_dir}/embedded",
"--disable-debug",
"--enable-optimize",
"--disable-ldap",
"--disable-ldaps",
"--disable-rtsp",
"--enable-proxy",
"--disable-dependency-tracking",
"--enable-ipv6",
"--without-libidn",
"--with-ssl=#{install_dir}/embedded",
"--with-zlib=#{install_dir}/embedded"].join(" "), :env => env
command "make -j #{max_build_jobs}", :env => env
command "make install"
end
# This is an example software definition for an Erlang project.
#
# Lots of software definitions for popular open source software
# already exist in `opscode-omnibus`:
#
# https://github.com/opscode/omnibus-software/tree/master/config/software
#
name "erlang-example"
version "1.0.0"
dependency "erlang"
dependency "rebar"
dependency "rsync"
source :git => "git://github.com/example/erlang.git"
relative_path "erlang-example"
env = {
"PATH" => "#{install_dir}/embedded/bin:#{ENV["PATH"]}",
"LDFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
"CFLAGS" => "-L#{install_dir}/embedded/lib -I#{install_dir}/embedded/include",
"LD_RUN_PATH" => "#{install_dir}/embedded/lib"
}
build do
command "make distclean", :env => env
command "make rel", :env => env
command "mkdir -p #{install_dir}/embedded/service/example-erlang"
command ["#{install_dir}/embedded/bin/rsync",
"-a",
"--delete",
"--exclude=.git/***",
"--exclude=.gitignore",
"./rel/erlang-example/",
"#{install_dir}/embedded/service/erlang-example/"].join(" ")
command "rm -rf #{install_dir}/embedded/service/erlang-example/log"
end
# This is an example software definition for a Ruby project.
#
# Lots of software definitions for popular open source software
# already exist in `opscode-omnibus`:
#
# https://github.com/opscode/omnibus-software/tree/master/config/software
#
name "ruby-example"
version "1.0.0"
dependency "ruby"
dependency "rubygems"
dependency "bundler"
dependency "rsync"
source :git => "git://github.com/example/ruby.git"
relative_path "ruby-example"
build do
bundle "install --path=#{install_dir}/embedded/service/gem"
command "mkdir -p #{install_dir}/embedded/service/ruby-example"
command "#{install_dir}/embedded/bin/rsync -a --delete --exclude=.git/*** --exclude=.gitignore ./ #{install_dir}/embedded/service/ruby-example/"
end
# s3_access_key "something"
# s3_secret_key "something"
# s3_bucket "some-bucket"
# use_s3_caching true
# solaris_compiler "gcc"
#!/bin/bash
#
# Install a full gitlab
#
PROGNAME=`basename $0`
INSTALLER_DIR=`dirname $0`
DEST_DIR=/opt/gitlab
CONFIG_DIR=/etc/gitlab
USAGE="usage: $0"
error_exit()
{
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
exit 1
}
# move the actual files into place
rm -rf $DEST_DIR/* || error_exit "Cannot remove contents of $DEST_DIR"
mkdir -p $DEST_DIR || error_exit "Cannot create $DEST_DIR"
cp -R $INSTALLER_DIR $DEST_DIR || error_exit "Cannot install to $DEST_DIR"
rm -f $DEST_DIR/$PROGNAME
# You may want to symlink your packages bin files into /usr/bin
# ln -sf $DEST_DIR/bin/gitlab /usr/bin || error_exit "Cannot link gitlab to /usr/bin"
exit 0
#!/bin/bash
#
# Perform necessary gitlab setup steps
# after package is installed.
#
PROGNAME=$(basename $0)
function error_exit
{
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
exit 1
}
echo "Thank you for installing gitlab!"
exit 0
#!/bin/bash
#
# Perform necessary gitlab removal steps
# after package is uninstalled.
#
echo "gitlab has been uninstalled!"
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment